diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000..d439027a4758c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: java + +jdk: + - oraclejdk8 + +script: + - mvn compile diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java index 1a674b829b877..88bc3f48b677c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperations.java @@ -18,6 +18,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.Body; import retrofit.http.GET; @@ -68,9 +69,10 @@ interface AvailabilitySetsService { * @param parameters Parameters supplied to the Create Availability Set operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySet object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String name, AvailabilitySet parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdate(String resourceGroupName, String name, AvailabilitySet parameters) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to create or update the availability set. @@ -90,9 +92,10 @@ interface AvailabilitySetsService { * @param availabilitySetName The name of the availability set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException; + ServiceResponse delete(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to delete the availability set. @@ -111,9 +114,10 @@ interface AvailabilitySetsService { * @param availabilitySetName The name of the availability set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySet object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get the availability set. @@ -131,9 +135,10 @@ interface AvailabilitySetsService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySetListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list the availability sets. @@ -151,9 +156,10 @@ interface AvailabilitySetsService { * @param availabilitySetName The name of the availability set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listAvailableSizes(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException; + ServiceResponse listAvailableSizes(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for an availability set. @@ -171,9 +177,10 @@ interface AvailabilitySetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySetListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list the availability sets. @@ -190,9 +197,10 @@ interface AvailabilitySetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for an availability set. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java index d57b6f232373a..37b0f07e0a561 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AvailabilitySetsOperationsImpl.java @@ -24,6 +24,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -43,29 +44,26 @@ public AvailabilitySetsOperationsImpl(Retrofit retrofit, ComputeManagementClient * @param resourceGroupName The name of the resource group. * @param name Parameters supplied to the Create Availability Set operation. * @param parameters Parameters supplied to the Create Availability Set operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySet object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String name, AvailabilitySet parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdate(String resourceGroupName, String name, AvailabilitySet parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter name is required and cannot be null.")); + throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdate(resourceGroupName, name, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -82,28 +80,23 @@ public ServiceResponse createOrUpdate(String resourceGroupName, */ public Call createOrUpdateAsync(String resourceGroupName, String name, AvailabilitySet parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (name == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter name is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter name is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -133,24 +126,22 @@ private ServiceResponse createOrUpdateDelegate(Response delete(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException { + public ServiceResponse delete(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (availabilitySetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.delete(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -165,23 +156,19 @@ public ServiceResponse delete(String resourceGroupName, String availabilit */ public Call deleteAsync(String resourceGroupName, String availabilitySetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (availabilitySetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.delete(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -210,25 +197,23 @@ private ServiceResponse deleteDelegate(Response response, Re * * @param resourceGroupName The name of the resource group. * @param availabilitySetName The name of the availability set. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySet object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (availabilitySetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -243,23 +228,19 @@ public ServiceResponse get(String resourceGroupName, String ava */ public Call getAsync(String resourceGroupName, String availabilitySetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (availabilitySetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -287,21 +268,20 @@ private ServiceResponse getDelegate(Response resp * The operation to list the availability sets. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySetListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -315,18 +295,15 @@ public ServiceResponse list(String resourceGroupName) */ public Call listAsync(String resourceGroupName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -355,25 +332,23 @@ private ServiceResponse listDelegate(Response listAvailableSizes(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException { + public ServiceResponse listAvailableSizes(String resourceGroupName, String availabilitySetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (availabilitySetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAvailableSizes(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAvailableSizesDelegate(call.execute(), null); @@ -388,23 +363,19 @@ public ServiceResponse listAvailableSizes(String r */ public Call listAvailableSizesAsync(String resourceGroupName, String availabilitySetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (availabilitySetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAvailableSizes(resourceGroupName, availabilitySetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -432,13 +403,14 @@ private ServiceResponse listAvailableSizesDelegate * The operation to list the availability sets. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the AvailabilitySetListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -452,8 +424,7 @@ public ServiceResponse listNext(String nextPageLink) */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -481,13 +452,14 @@ private ServiceResponse listNextDelegate(Response listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAvailableSizesNext(nextPageLink, this.client.getAcceptLanguage()); return listAvailableSizesNextDelegate(call.execute(), null); @@ -501,8 +473,7 @@ public ServiceResponse listAvailableSizesNext(Stri */ public Call listAvailableSizesNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAvailableSizesNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java index 7ff8922c96b48..b09d4c62455be 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -46,9 +47,10 @@ interface UsageService { * @param location The location upon which resource usage is queried. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ListUsagesResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String location) throws ServiceException, IOException; + ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. @@ -65,9 +67,10 @@ interface UsageService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ListUsagesResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java index 14e18a43cf172..3a7667418769c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/UsageOperationsImpl.java @@ -21,6 +21,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -38,21 +39,20 @@ public UsageOperationsImpl(Retrofit retrofit, ComputeManagementClient client) { * Lists compute usages for a subscription. * * @param location The location upon which resource usage is queried. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ListUsagesResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String location) throws ServiceException, IOException { + public ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -66,18 +66,15 @@ public ServiceResponse list(String location) throws ServiceExc */ public Call listAsync(String location, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -105,13 +102,14 @@ private ServiceResponse listDelegate(Response re * Lists compute usages for a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ListUsagesResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -125,8 +123,7 @@ public ServiceResponse listNext(String nextPageLink) throws Se */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperations.java index 53916ff59ff19..5ce22f0d14fe4 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.List; import retrofit.Call; import retrofit.http.GET; @@ -53,9 +54,10 @@ interface VirtualMachineExtensionImagesService { * @param version the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineExtensionImage object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String location, String publisherName, String type, String version) throws ServiceException, IOException; + ServiceResponse get(String location, String publisherName, String type, String version) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a virtual machine extension image. @@ -76,9 +78,10 @@ interface VirtualMachineExtensionImagesService { * @param publisherName the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listTypes(String location, String publisherName) throws ServiceException, IOException; + ServiceResponse> listTypes(String location, String publisherName) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine extension image types. @@ -101,9 +104,10 @@ interface VirtualMachineExtensionImagesService { * @param orderBy the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listVersions(String location, String publisherName, String type, VirtualMachineImageResource filter, Integer top, String orderBy) throws ServiceException, IOException; + ServiceResponse> listVersions(String location, String publisherName, String type, VirtualMachineImageResource filter, Integer top, String orderBy) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine extension image versions. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java index be8b5ac3bc750..2240e0ba318ed 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionImagesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.List; import retrofit.Call; import retrofit.Response; @@ -44,33 +45,29 @@ public VirtualMachineExtensionImagesOperationsImpl(Retrofit retrofit, ComputeMan * @param publisherName the String value * @param type the String value * @param version the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineExtensionImage object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String location, String publisherName, String type, String version) throws ServiceException, IOException { + public ServiceResponse get(String location, String publisherName, String type, String version) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (type == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter type is required and cannot be null.")); + throw new IllegalArgumentException("Parameter type is required and cannot be null."); } if (version == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter version is required and cannot be null.")); + throw new IllegalArgumentException("Parameter version is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(location, publisherName, type, version, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -87,33 +84,27 @@ public ServiceResponse get(String location, String */ public Call getAsync(String location, String publisherName, String type, String version, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (type == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter type is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter type is required and cannot be null.")); return null; } if (version == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter version is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter version is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(location, publisherName, type, version, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -142,25 +133,23 @@ private ServiceResponse getDelegate(Response> listTypes(String location, String publisherName) throws ServiceException, IOException { + public ServiceResponse> listTypes(String location, String publisherName) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listTypes(location, publisherName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listTypesDelegate(call.execute(), null); @@ -175,23 +164,19 @@ public ServiceResponse> listTypes(String locat */ public Call listTypesAsync(String location, String publisherName, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listTypes(location, publisherName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -224,29 +209,26 @@ private ServiceResponse> listTypesDelegate(Res * @param filter The filter to apply on the operation. * @param top the Integer value * @param orderBy the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listVersions(String location, String publisherName, String type, VirtualMachineImageResource filter, Integer top, String orderBy) throws ServiceException, IOException { + public ServiceResponse> listVersions(String location, String publisherName, String type, VirtualMachineImageResource filter, Integer top, String orderBy) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (type == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter type is required and cannot be null.")); + throw new IllegalArgumentException("Parameter type is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listVersions(location, publisherName, type, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, orderBy, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listVersionsDelegate(call.execute(), null); @@ -265,28 +247,23 @@ public ServiceResponse> listVersions(String lo */ public Call listVersionsAsync(String location, String publisherName, String type, VirtualMachineImageResource filter, Integer top, String orderBy, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (type == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter type is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter type is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listVersions(location, publisherName, type, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, orderBy, this.client.getApiVersion(), this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperations.java index 9c714c5d43b2c..605dc1627c91b 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -55,10 +56,11 @@ interface VirtualMachineExtensionsService { * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineExtension object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtension extensionParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtension extensionParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to create or update the extension. @@ -80,10 +82,11 @@ interface VirtualMachineExtensionsService { * @param vmExtensionName The name of the virtual machine extension. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String vmName, String vmExtensionName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String vmName, String vmExtensionName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to delete the extension. @@ -105,9 +108,10 @@ interface VirtualMachineExtensionsService { * @param expand The expand expression to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineExtension object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String vmName, String vmExtensionName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String vmName, String vmExtensionName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get the extension. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java index 47d2a6245f7c5..d1ace31b9c2f8 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtensionsOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public VirtualMachineExtensionsOperationsImpl(Retrofit retrofit, ComputeManageme * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineExtension object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtension extensionParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtension extensionParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, vmName, vmExtensionName, this.client.getSubscriptionId(), extensionParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -109,10 +111,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmExtensionName The name of the virtual machine extension. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String vmName, String vmExtensionName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String vmName, String vmExtensionName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, vmName, vmExtensionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -165,29 +168,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmName The name of the virtual machine containing the extension. * @param vmExtensionName The name of the virtual machine extension. * @param expand The expand expression to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineExtension object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String vmName, String vmExtensionName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String vmName, String vmExtensionName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); } if (vmExtensionName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmExtensionName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmExtensionName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, vmName, vmExtensionName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -204,28 +204,23 @@ public ServiceResponse get(String resourceGroupName, St */ public Call getAsync(String resourceGroupName, String vmName, String vmExtensionName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); return null; } if (vmExtensionName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmExtensionName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmExtensionName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, vmName, vmExtensionName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperations.java index fb06de71e1964..b8c3ecfc96c20 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.List; import retrofit.Call; import retrofit.http.GET; @@ -60,9 +61,10 @@ interface VirtualMachineImagesService { * @param version the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineImage object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String location, String publisherName, String offer, String skus, String version) throws ServiceException, IOException; + ServiceResponse get(String location, String publisherName, String offer, String skus, String version) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a virtual machine image. @@ -89,9 +91,10 @@ interface VirtualMachineImagesService { * @param orderby the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String location, String publisherName, String offer, String skus, VirtualMachineImageResource filter, Integer top, String orderby) throws ServiceException, IOException; + ServiceResponse> list(String location, String publisherName, String offer, String skus, VirtualMachineImageResource filter, Integer top, String orderby) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine images. @@ -115,9 +118,10 @@ interface VirtualMachineImagesService { * @param publisherName the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listOffers(String location, String publisherName) throws ServiceException, IOException; + ServiceResponse> listOffers(String location, String publisherName) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine image offers. @@ -135,9 +139,10 @@ interface VirtualMachineImagesService { * @param location the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listPublishers(String location) throws ServiceException, IOException; + ServiceResponse> listPublishers(String location) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine image publishers. @@ -156,9 +161,10 @@ interface VirtualMachineImagesService { * @param offer the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listSkus(String location, String publisherName, String offer) throws ServiceException, IOException; + ServiceResponse> listSkus(String location, String publisherName, String offer) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of virtual machine image skus. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java index 58a6155879650..200073fd214d1 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineImagesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.List; import retrofit.Call; import retrofit.Response; @@ -45,37 +46,32 @@ public VirtualMachineImagesOperationsImpl(Retrofit retrofit, ComputeManagementCl * @param offer the String value * @param skus the String value * @param version the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineImage object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String location, String publisherName, String offer, String skus, String version) throws ServiceException, IOException { + public ServiceResponse get(String location, String publisherName, String offer, String skus, String version) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (offer == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null.")); + throw new IllegalArgumentException("Parameter offer is required and cannot be null."); } if (skus == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter skus is required and cannot be null.")); + throw new IllegalArgumentException("Parameter skus is required and cannot be null."); } if (version == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter version is required and cannot be null.")); + throw new IllegalArgumentException("Parameter version is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(location, publisherName, offer, skus, version, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -93,38 +89,31 @@ public ServiceResponse get(String location, String publishe */ public Call getAsync(String location, String publisherName, String offer, String skus, String version, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (offer == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter offer is required and cannot be null.")); return null; } if (skus == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter skus is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter skus is required and cannot be null.")); return null; } if (version == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter version is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter version is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(location, publisherName, offer, skus, version, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -158,33 +147,29 @@ private ServiceResponse getDelegate(Response * @param filter The filter to apply on the operation. * @param top the Integer value * @param orderby the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String location, String publisherName, String offer, String skus, VirtualMachineImageResource filter, Integer top, String orderby) throws ServiceException, IOException { + public ServiceResponse> list(String location, String publisherName, String offer, String skus, VirtualMachineImageResource filter, Integer top, String orderby) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (offer == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null.")); + throw new IllegalArgumentException("Parameter offer is required and cannot be null."); } if (skus == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter skus is required and cannot be null.")); + throw new IllegalArgumentException("Parameter skus is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(location, publisherName, offer, skus, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, orderby, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -204,33 +189,27 @@ public ServiceResponse> list(String location, */ public Call listAsync(String location, String publisherName, String offer, String skus, VirtualMachineImageResource filter, Integer top, String orderby, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (offer == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter offer is required and cannot be null.")); return null; } if (skus == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter skus is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter skus is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(location, publisherName, offer, skus, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, orderby, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -259,25 +238,23 @@ private ServiceResponse> listDelegate(Response * * @param location the String value * @param publisherName the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listOffers(String location, String publisherName) throws ServiceException, IOException { + public ServiceResponse> listOffers(String location, String publisherName) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listOffers(location, publisherName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listOffersDelegate(call.execute(), null); @@ -292,23 +269,19 @@ public ServiceResponse> listOffers(String loca */ public Call listOffersAsync(String location, String publisherName, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listOffers(location, publisherName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -336,21 +309,20 @@ private ServiceResponse> listOffersDelegate(Re * Gets a list of virtual machine image publishers. * * @param location the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listPublishers(String location) throws ServiceException, IOException { + public ServiceResponse> listPublishers(String location) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listPublishers(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listPublishersDelegate(call.execute(), null); @@ -364,18 +336,15 @@ public ServiceResponse> listPublishers(String */ public Call listPublishersAsync(String location, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listPublishers(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -405,29 +374,26 @@ private ServiceResponse> listPublishersDelegat * @param location the String value * @param publisherName the String value * @param offer the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the List<VirtualMachineImageResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listSkus(String location, String publisherName, String offer) throws ServiceException, IOException { + public ServiceResponse> listSkus(String location, String publisherName, String offer) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (publisherName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publisherName is required and cannot be null."); } if (offer == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null.")); + throw new IllegalArgumentException("Parameter offer is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listSkus(location, publisherName, offer, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listSkusDelegate(call.execute(), null); @@ -443,28 +409,23 @@ public ServiceResponse> listSkus(String locati */ public Call listSkusAsync(String location, String publisherName, String offer, final ServiceCallback> serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (publisherName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publisherName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); return null; } if (offer == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter offer is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter offer is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listSkus(location, publisherName, offer, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java index dbce962cda89a..d2cbd5150604c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperations.java @@ -18,6 +18,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.GET; @@ -74,10 +75,11 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException; + ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to deallocate a virtual machine scale set. @@ -98,10 +100,11 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to delete a virtual machine scale set. @@ -122,9 +125,10 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVM object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get a virtual machine scale set virtual machine. @@ -145,9 +149,10 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVMInstanceView object wrapped in ServiceResponse if successful. */ - ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException; + ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get a virtual machine scale set virtual machine. @@ -170,9 +175,10 @@ interface VirtualMachineScaleSetVMsService { * @param expand The expand expression to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVMListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String resourceGroupName, String virtualMachineScaleSetName, VirtualMachineScaleSetVM filter, String select, String expand) throws ServiceException, IOException; + ServiceResponse list(String resourceGroupName, String virtualMachineScaleSetName, VirtualMachineScaleSetVM filter, String select, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets VMs. @@ -195,10 +201,11 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException; + ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to power off (stop) a virtual machine scale set. @@ -219,10 +226,11 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse restart(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException; + ServiceResponse restart(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to restart a virtual machine scale set. @@ -243,10 +251,11 @@ interface VirtualMachineScaleSetVMsService { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse start(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException; + ServiceResponse start(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to start a virtual machine scale set. @@ -265,9 +274,10 @@ interface VirtualMachineScaleSetVMsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVMListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets VMs. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java index 76e33d6aa2547..05ef8e63a0f2f 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetVMsOperationsImpl.java @@ -24,6 +24,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -47,10 +48,11 @@ public VirtualMachineScaleSetVMsOperationsImpl(Retrofit retrofit, ComputeManagem * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException { + public ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.deallocate(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -104,10 +106,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -159,29 +162,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the virtual machine scale set. * @param instanceId The instance id of the virtual machine. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVM object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (instanceId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -197,28 +197,23 @@ public ServiceResponse get(String resourceGroupName, S */ public Call getAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); return null; } if (instanceId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter instanceId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -248,29 +243,26 @@ private ServiceResponse getDelegate(Response getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException { + public ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (instanceId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getInstanceView(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getInstanceViewDelegate(call.execute(), null); @@ -286,28 +278,23 @@ public ServiceResponse getInstanceView(Str */ public Call getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); return null; } if (instanceId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter instanceId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter instanceId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getInstanceView(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -339,25 +326,23 @@ private ServiceResponse getInstanceViewDel * @param filter The filter to apply on the operation. * @param select The list parameters. * @param expand The expand expression to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVMListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String resourceGroupName, String virtualMachineScaleSetName, VirtualMachineScaleSetVM filter, String select, String expand) throws ServiceException, IOException { + public ServiceResponse list(String resourceGroupName, String virtualMachineScaleSetName, VirtualMachineScaleSetVM filter, String select, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualMachineScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), select, expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -375,23 +360,19 @@ public ServiceResponse list(String resourceG */ public Call listAsync(String resourceGroupName, String virtualMachineScaleSetName, VirtualMachineScaleSetVM filter, String select, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualMachineScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), select, expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -423,10 +404,11 @@ private ServiceResponse listDelegate(Respons * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException { + public ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.powerOff(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -480,10 +462,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse restart(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException { + public ServiceResponse restart(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.restart(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -537,10 +520,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param instanceId The instance id of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse start(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, InterruptedException { + public ServiceResponse start(String resourceGroupName, String vmScaleSetName, String instanceId) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.start(resourceGroupName, vmScaleSetName, instanceId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -590,13 +574,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The operation to list virtual machine scale sets VMs. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetVMListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -610,8 +595,7 @@ public ServiceResponse listNext(String nextP */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java index cc57e807d1760..912a719194e89 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperations.java @@ -22,6 +22,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -101,10 +102,11 @@ interface VirtualMachineScaleSetsService { * @param parameters Parameters supplied to the Create Virtual Machine Scale Set operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineScaleSet object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String name, VirtualMachineScaleSet parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String name, VirtualMachineScaleSet parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to create or update a virtual machine scale set. @@ -125,10 +127,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to deallocate virtual machines in a virtual machine scale set. @@ -148,10 +151,11 @@ interface VirtualMachineScaleSetsService { * @param vmScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to delete a virtual machine scale set. @@ -170,9 +174,10 @@ interface VirtualMachineScaleSetsService { * @param vmScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSet object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get a virtual machine scale set. @@ -192,10 +197,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse deleteInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse deleteInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to delete virtual machines in a virtual machine scale set. @@ -215,9 +221,10 @@ interface VirtualMachineScaleSetsService { * @param vmScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetInstanceView object wrapped in ServiceResponse if successful. */ - ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException; + ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get a virtual machine scale set instance view. @@ -235,9 +242,10 @@ interface VirtualMachineScaleSetsService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets under a resource group. @@ -253,9 +261,10 @@ interface VirtualMachineScaleSetsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachineScaleSet> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machine Scale Sets in the subscription. Use nextLink property in the response to get the next page of Virtual Machine Scale Sets. Do this till nextLink is not null to fetch all the Virtual Machine Scale Sets. @@ -272,9 +281,10 @@ interface VirtualMachineScaleSetsService { * @param vmScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListSkusResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listSkus(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException; + ServiceResponse listSkus(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list available skus for a virtual machine scale set. @@ -294,10 +304,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to power off (stop) virtual machines in a virtual machine scale set. @@ -318,10 +329,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse restart(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse restart(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to restart virtual machines in a virtual machine scale set. @@ -342,10 +354,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to start virtual machines in a virtual machine scale set. @@ -366,10 +379,11 @@ interface VirtualMachineScaleSetsService { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse updateInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException; + ServiceResponse updateInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to manually upgrade virtual machines in a virtual machine scale set. @@ -388,9 +402,10 @@ interface VirtualMachineScaleSetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machine scale sets under a resource group. @@ -407,9 +422,10 @@ interface VirtualMachineScaleSetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachineScaleSet> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machine Scale Sets in the subscription. Use nextLink property in the response to get the next page of Virtual Machine Scale Sets. Do this till nextLink is not null to fetch all the Virtual Machine Scale Sets. @@ -426,9 +442,10 @@ interface VirtualMachineScaleSetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListSkusResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listSkusNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listSkusNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list available skus for a virtual machine scale set. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java index 26f25fca40977..a1161842365c0 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineScaleSetsOperationsImpl.java @@ -28,6 +28,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -51,10 +52,11 @@ public VirtualMachineScaleSetsOperationsImpl(Retrofit retrofit, ComputeManagemen * @param parameters Parameters supplied to the Create Virtual Machine Scale Set operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineScaleSet object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String name, VirtualMachineScaleSet parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String name, VirtualMachineScaleSet parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, name, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -109,10 +111,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse deallocate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.deallocate(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -161,10 +164,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -210,25 +214,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the virtual machine scale set. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSet object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -243,23 +245,19 @@ public ServiceResponse get(String resourceGroupName, Str */ public Call getAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -291,10 +289,11 @@ private ServiceResponse getDelegate(Response deleteInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse deleteInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.deleteInstances(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -346,25 +345,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the virtual machine scale set. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetInstanceView object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException { + public ServiceResponse getInstanceView(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getInstanceView(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getInstanceViewDelegate(call.execute(), null); @@ -379,23 +376,19 @@ public ServiceResponse getInstanceView(Strin */ public Call getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getInstanceView(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -423,21 +416,20 @@ private ServiceResponse getInstanceViewDeleg * The operation to list virtual machine scale sets under a resource group. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -451,18 +443,15 @@ public ServiceResponse list(String resourceGro */ public Call listAsync(String resourceGroupName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -489,17 +478,17 @@ private ServiceResponse listDelegate(Response< /** * Gets the list of Virtual Machine Scale Sets in the subscription. Use nextLink property in the response to get the next page of Virtual Machine Scale Sets. Do this till nextLink is not null to fetch all the Virtual Machine Scale Sets. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachineScaleSet> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -512,13 +501,11 @@ public ServiceResponse> listAll() throws Servic */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -547,25 +534,23 @@ private ServiceResponse> listAllDelegate(Respon * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the virtual machine scale set. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListSkusResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listSkus(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException { + public ServiceResponse listSkus(String resourceGroupName, String vmScaleSetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listSkus(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listSkusDelegate(call.execute(), null); @@ -580,23 +565,19 @@ public ServiceResponse listSkus(String res */ public Call listSkusAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listSkus(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -628,10 +609,11 @@ private ServiceResponse listSkusDelegate(R * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse powerOff(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.powerOff(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -681,10 +663,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse restart(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse restart(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.restart(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -734,10 +717,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.start(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -787,10 +771,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmInstanceIDs The list of virtual machine scale set instance IDs. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse updateInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, InterruptedException { + public ServiceResponse updateInstances(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.updateInstances(resourceGroupName, vmScaleSetName, this.client.getSubscriptionId(), vmInstanceIDs, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -841,13 +826,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The operation to list virtual machine scale sets under a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -861,8 +847,7 @@ public ServiceResponse listNext(String nextPag */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -890,13 +875,14 @@ private ServiceResponse listNextDelegate(Respo * Gets the list of Virtual Machine Scale Sets in the subscription. Use nextLink property in the response to get the next page of Virtual Machine Scale Sets. Do this till nextLink is not null to fetch all the Virtual Machine Scale Sets. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachineScaleSet> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -910,8 +896,7 @@ public ServiceResponse> listAllNext(String next */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -939,13 +924,14 @@ private ServiceResponse> listAllNextDelegate(Re * The operation to list available skus for a virtual machine scale set. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineScaleSetListSkusResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listSkusNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listSkusNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listSkusNext(nextPageLink, this.client.getAcceptLanguage()); return listSkusNextDelegate(call.execute(), null); @@ -959,8 +945,7 @@ public ServiceResponse listSkusNext(String */ public Call listSkusNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listSkusNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java index f232bd6e0689d..a05131133e671 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -46,9 +47,10 @@ interface VirtualMachineSizesService { * @param location The location upon which virtual-machine-sizes is queried. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String location) throws ServiceException, IOException; + ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available in a location for a subscription. @@ -65,9 +67,10 @@ interface VirtualMachineSizesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available in a location for a subscription. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java index 91a3d9f30c759..e6ea37af23967 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineSizesOperationsImpl.java @@ -21,6 +21,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -38,21 +39,20 @@ public VirtualMachineSizesOperationsImpl(Retrofit retrofit, ComputeManagementCli * Lists virtual-machine-sizes available in a location for a subscription. * * @param location The location upon which virtual-machine-sizes is queried. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String location) throws ServiceException, IOException { + public ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -66,18 +66,15 @@ public ServiceResponse list(String location) throw */ public Call listAsync(String location, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -105,13 +102,14 @@ private ServiceResponse listDelegate(Response listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -125,8 +123,7 @@ public ServiceResponse listNext(String nextPageLin */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java index 9fd0be755b258..e1b7635c588ba 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperations.java @@ -20,6 +20,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -96,10 +97,11 @@ interface VirtualMachinesService { * @param parameters Parameters supplied to the Capture Virtual Machine operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineCaptureResult object wrapped in ServiceResponse if successful. */ - ServiceResponse capture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse capture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Captures the VM by copying VirtualHardDisks of the VM and outputs a template that can be used to create similar VMs. @@ -120,10 +122,11 @@ interface VirtualMachinesService { * @param parameters Parameters supplied to the Create Virtual Machine operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachine object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String vmName, VirtualMachine parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String vmName, VirtualMachine parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to create or update a virtual machine. @@ -143,10 +146,11 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to delete a virtual machine. @@ -166,9 +170,10 @@ interface VirtualMachinesService { * @param expand The expand expression to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachine object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String vmName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String vmName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to get a virtual machine. @@ -188,10 +193,11 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse deallocate(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException; + ServiceResponse deallocate(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses. @@ -210,9 +216,10 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse generalize(String resourceGroupName, String vmName) throws ServiceException, IOException; + ServiceResponse generalize(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException; /** * Sets the state of the VM as Generalized. @@ -230,9 +237,10 @@ interface VirtualMachinesService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machines under a resource group. @@ -248,9 +256,10 @@ interface VirtualMachinesService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines. @@ -267,9 +276,10 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listAvailableSizes(String resourceGroupName, String vmName) throws ServiceException, IOException; + ServiceResponse listAvailableSizes(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for a virtual machine. @@ -288,10 +298,11 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse powerOff(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException; + ServiceResponse powerOff(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to power off (stop) a virtual machine. @@ -310,10 +321,11 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse restart(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException; + ServiceResponse restart(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to restart a virtual machine. @@ -332,10 +344,11 @@ interface VirtualMachinesService { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse start(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException; + ServiceResponse start(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The operation to start a virtual machine. @@ -353,9 +366,10 @@ interface VirtualMachinesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The operation to list virtual machines under a resource group. @@ -372,9 +386,10 @@ interface VirtualMachinesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines. @@ -391,9 +406,10 @@ interface VirtualMachinesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachineSizeListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists virtual-machine-sizes available to be used for a virtual machine. diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java index d7d33b9a0a32e..1dabf133eb988 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachinesOperationsImpl.java @@ -26,6 +26,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -49,10 +50,11 @@ public VirtualMachinesOperationsImpl(Retrofit retrofit, ComputeManagementClient * @param parameters Parameters supplied to the Capture Virtual Machine operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachineCaptureResult object wrapped in ServiceResponse if successful. */ - public ServiceResponse capture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse capture(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.capture(resourceGroupName, vmName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -107,10 +109,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param parameters Parameters supplied to the Create Virtual Machine operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualMachine object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String vmName, VirtualMachine parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String vmName, VirtualMachine parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, vmName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -164,10 +167,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -214,25 +218,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. * @param expand The expand expression to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualMachine object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String vmName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String vmName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, vmName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -248,23 +250,19 @@ public ServiceResponse get(String resourceGroupName, String vmNa */ public Call getAsync(String resourceGroupName, String vmName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, vmName, this.client.getSubscriptionId(), expand, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -295,10 +293,11 @@ private ServiceResponse getDelegate(Response respo * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse deallocate(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse deallocate(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.deallocate(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -344,24 +343,22 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse generalize(String resourceGroupName, String vmName) throws ServiceException, IOException { + public ServiceResponse generalize(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.generalize(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return generalizeDelegate(call.execute(), null); @@ -376,23 +373,19 @@ public ServiceResponse generalize(String resourceGroupName, String vmName) */ public Call generalizeAsync(String resourceGroupName, String vmName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.generalize(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -419,21 +412,20 @@ private ServiceResponse generalizeDelegate(Response response * The operation to list virtual machines under a resource group. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -447,18 +439,15 @@ public ServiceResponse> list(String resourceGroupName) */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -485,17 +474,17 @@ private ServiceResponse> listDelegate(Response> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -508,13 +497,11 @@ public ServiceResponse> listAll() throws ServiceExcepti */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -543,25 +530,23 @@ private ServiceResponse> listAllDelegate(Response listAvailableSizes(String resourceGroupName, String vmName) throws ServiceException, IOException { + public ServiceResponse listAvailableSizes(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAvailableSizes(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAvailableSizesDelegate(call.execute(), null); @@ -576,23 +561,19 @@ public ServiceResponse listAvailableSizes(String r */ public Call listAvailableSizesAsync(String resourceGroupName, String vmName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (vmName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter vmName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter vmName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAvailableSizes(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -623,10 +604,11 @@ private ServiceResponse listAvailableSizesDelegate * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse powerOff(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse powerOff(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.powerOff(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -674,10 +656,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse restart(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse restart(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.restart(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -725,10 +708,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param vmName The name of the virtual machine. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse start(String resourceGroupName, String vmName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse start(String resourceGroupName, String vmName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.start(resourceGroupName, vmName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -773,13 +757,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The operation to list virtual machines under a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualMachine> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -793,8 +778,7 @@ public ServiceResponse> listNext(String nextPageLink) t */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -822,13 +806,14 @@ private ServiceResponse> listNextDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -842,8 +827,7 @@ public ServiceResponse> listAllNext(String nextPageLink */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -871,13 +855,14 @@ private ServiceResponse> listAllNextDelegate(Response listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listAvailableSizesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAvailableSizesNext(nextPageLink, this.client.getAcceptLanguage()); return listAvailableSizesNextDelegate(call.execute(), null); @@ -891,8 +876,7 @@ public ServiceResponse listAvailableSizesNext(Stri */ public Call listAvailableSizesNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAvailableSizesNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java index 5bcfa26d44673..021e2574251a9 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -74,10 +75,11 @@ interface ApplicationGatewaysService { * @param applicationGatewayName The name of the applicationgateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete applicationgateway operation deletes the specified applicationgateway. @@ -96,9 +98,10 @@ interface ApplicationGatewaysService { * @param applicationGatewayName The name of the applicationgateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ApplicationGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get applicationgateway operation retreives information about the specified applicationgateway. @@ -118,10 +121,11 @@ interface ApplicationGatewaysService { * @param parameters Parameters supplied to the create/delete ApplicationGateway operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ApplicationGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGateway parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put ApplicationGateway operation creates/updates a ApplicationGateway @@ -140,9 +144,10 @@ interface ApplicationGatewaysService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List ApplicationGateway opertion retrieves all the applicationgateways in a resource group. @@ -158,9 +163,10 @@ interface ApplicationGatewaysService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The List applicationgateway opertion retrieves all the applicationgateways in a subscription. @@ -177,10 +183,11 @@ interface ApplicationGatewaysService { * @param applicationGatewayName The name of the application gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse start(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException; + ServiceResponse start(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Start ApplicationGateway operation starts application gatewayin the specified resource group through Network resource provider. @@ -199,10 +206,11 @@ interface ApplicationGatewaysService { * @param applicationGatewayName The name of the application gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse stop(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException; + ServiceResponse stop(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The STOP ApplicationGateway operation stops application gatewayin the specified resource group through Network resource provider. @@ -220,9 +228,10 @@ interface ApplicationGatewaysService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List ApplicationGateway opertion retrieves all the applicationgateways in a resource group. @@ -239,9 +248,10 @@ interface ApplicationGatewaysService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List applicationgateway opertion retrieves all the applicationgateways in a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java index 0fa7dbfe1ec24..f6aee0424dddc 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ApplicationGatewaysOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public ApplicationGatewaysOperationsImpl(Retrofit retrofit, NetworkManagementCli * @param applicationGatewayName The name of the applicationgateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -94,25 +96,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param applicationGatewayName The name of the applicationgateway. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ApplicationGateway object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (applicationGatewayName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter applicationGatewayName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter applicationGatewayName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -127,23 +127,19 @@ public ServiceResponse get(String resourceGroupName, String */ public Call getAsync(String resourceGroupName, String applicationGatewayName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (applicationGatewayName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter applicationGatewayName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter applicationGatewayName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -175,10 +171,11 @@ private ServiceResponse getDelegate(Response r * @param parameters Parameters supplied to the create/delete ApplicationGateway operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ApplicationGateway object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGateway parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -229,21 +226,20 @@ public void onResponse(Response response, Retrofit retrofit) { * The List ApplicationGateway opertion retrieves all the applicationgateways in a resource group. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -257,18 +253,15 @@ public ServiceResponse> list(String resourceGroupNa */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -295,17 +288,17 @@ private ServiceResponse> listDelegate(Response> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -318,13 +311,11 @@ public ServiceResponse> listAll() throws ServiceExc */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -355,10 +346,11 @@ private ServiceResponse> listAllDelegate(Response start(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse start(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.start(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -406,10 +398,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param applicationGatewayName The name of the application gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse stop(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse stop(String resourceGroupName, String applicationGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.stop(resourceGroupName, applicationGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -454,13 +447,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The List ApplicationGateway opertion retrieves all the applicationgateways in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -474,8 +468,7 @@ public ServiceResponse> listNext(String nextPageLin */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -503,13 +496,14 @@ private ServiceResponse> listNextDelegate(Response< * The List applicationgateway opertion retrieves all the applicationgateways in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ApplicationGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -523,8 +517,7 @@ public ServiceResponse> listAllNext(String nextPage */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java index 028996dee7f8d..1fca55a9f7406 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface ExpressRouteCircuitAuthorizationsService { * @param authorizationName The name of the authorization. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete authorization operation deletes the specified authorization from the specified ExpressRouteCircuit. @@ -86,9 +88,10 @@ interface ExpressRouteCircuitAuthorizationsService { * @param authorizationName The name of the authorization. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuitAuthorization object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, IllegalArgumentException; /** * The GET authorization operation retrieves the specified authorization from the specified ExpressRouteCircuit. @@ -110,10 +113,11 @@ interface ExpressRouteCircuitAuthorizationsService { * @param authorizationParameters Parameters supplied to the create/update ExpressRouteCircuitAuthorization operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ExpressRouteCircuitAuthorization object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorization authorizationParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorization authorizationParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put Authorization operation creates/updates an authorization in thespecified ExpressRouteCircuits @@ -134,9 +138,10 @@ interface ExpressRouteCircuitAuthorizationsService { * @param circuitName The name of the curcuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitAuthorization> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The List authorization operation retrieves all the authorizations in an ExpressRouteCircuit. @@ -154,9 +159,10 @@ interface ExpressRouteCircuitAuthorizationsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitAuthorization> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List authorization operation retrieves all the authorizations in an ExpressRouteCircuit. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java index 1f24451f048a8..7e5abbce086d8 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitAuthorizationsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public ExpressRouteCircuitAuthorizationsOperationsImpl(Retrofit retrofit, Networ * @param authorizationName The name of the authorization. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, circuitName, authorizationName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -101,29 +103,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param circuitName The name of the express route circuit. * @param authorizationName The name of the authorization. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuitAuthorization object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String circuitName, String authorizationName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (authorizationName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter authorizationName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter authorizationName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, circuitName, authorizationName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -139,28 +138,23 @@ public ServiceResponse get(String resourceGrou */ public Call getAsync(String resourceGroupName, String circuitName, String authorizationName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (authorizationName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter authorizationName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter authorizationName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, circuitName, authorizationName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -193,10 +187,11 @@ private ServiceResponse getDelegate(Response createOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorization authorizationParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String authorizationName, ExpressRouteCircuitAuthorization authorizationParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, circuitName, authorizationName, this.client.getSubscriptionId(), authorizationParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -253,25 +248,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the curcuit. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitAuthorization> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -286,23 +279,19 @@ public ServiceResponse> list(String r */ public Call listAsync(String resourceGroupName, String circuitName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -330,13 +319,14 @@ private ServiceResponse> listDelegate * The List authorization operation retrieves all the authorizations in an ExpressRouteCircuit. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitAuthorization> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -350,8 +340,7 @@ public ServiceResponse> listNext(Stri */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java index 0cb7fee4870ff..c23d2b8926543 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface ExpressRouteCircuitPeeringsService { * @param peeringName The name of the peering. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete peering operation deletes the specified peering from the ExpressRouteCircuit. @@ -86,9 +88,10 @@ interface ExpressRouteCircuitPeeringsService { * @param peeringName The name of the peering. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuitPeering object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, IllegalArgumentException; /** * The GET peering operation retrieves the specified authorization from the ExpressRouteCircuit. @@ -110,10 +113,11 @@ interface ExpressRouteCircuitPeeringsService { * @param peeringParameters Parameters supplied to the create/update ExpressRouteCircuit Peering operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ExpressRouteCircuitPeering object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeering peeringParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeering peeringParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put Pering operation creates/updates an peering in the specified ExpressRouteCircuits @@ -134,9 +138,10 @@ interface ExpressRouteCircuitPeeringsService { * @param circuitName The name of the curcuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitPeering> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The List peering operation retrieves all the peerings in an ExpressRouteCircuit. @@ -154,9 +159,10 @@ interface ExpressRouteCircuitPeeringsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitPeering> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List peering operation retrieves all the peerings in an ExpressRouteCircuit. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java index 82a65271cc8b5..d8bc92eb9b033 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitPeeringsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public ExpressRouteCircuitPeeringsOperationsImpl(Retrofit retrofit, NetworkManag * @param peeringName The name of the peering. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, circuitName, peeringName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -101,29 +103,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param circuitName The name of the express route circuit. * @param peeringName The name of the peering. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuitPeering object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String circuitName, String peeringName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (peeringName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter peeringName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, circuitName, peeringName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -139,28 +138,23 @@ public ServiceResponse get(String resourceGroupName, */ public Call getAsync(String resourceGroupName, String circuitName, String peeringName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (peeringName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter peeringName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter peeringName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, circuitName, peeringName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -193,10 +187,11 @@ private ServiceResponse getDelegate(Response createOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeering peeringParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeering peeringParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, circuitName, peeringName, this.client.getSubscriptionId(), peeringParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -253,25 +248,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the curcuit. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitPeering> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -286,23 +279,19 @@ public ServiceResponse> list(String resourc */ public Call listAsync(String resourceGroupName, String circuitName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -330,13 +319,14 @@ private ServiceResponse> listDelegate(Respo * The List peering operation retrieves all the peerings in an ExpressRouteCircuit. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitPeering> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -350,8 +340,7 @@ public ServiceResponse> listNext(String nex */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java index 57569ca415192..4bf69d01d4208 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperations.java @@ -20,6 +20,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -88,10 +89,11 @@ interface ExpressRouteCircuitsService { * @param circuitName The name of the express route Circuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String circuitName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete ExpressRouteCircuit operation deletes the specified ExpressRouteCircuit. @@ -110,9 +112,10 @@ interface ExpressRouteCircuitsService { * @param circuitName The name of the circuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuit object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get ExpressRouteCircuit operation retreives information about the specified ExpressRouteCircuit. @@ -132,10 +135,11 @@ interface ExpressRouteCircuitsService { * @param parameters Parameters supplied to the create/delete ExpressRouteCircuit operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ExpressRouteCircuit object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuit parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuit parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put ExpressRouteCircuit operation creates/updates a ExpressRouteCircuit @@ -155,9 +159,10 @@ interface ExpressRouteCircuitsService { * @param circuitName The name of the circuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitArpTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listArpTable(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse> listArpTable(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The ListArpTable from ExpressRouteCircuit opertion retrieves the currently advertised arp table associated with the ExpressRouteCircuits in a resource group. @@ -176,9 +181,10 @@ interface ExpressRouteCircuitsService { * @param circuitName The name of the circuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitRoutesTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listRoutesTable(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse> listRoutesTable(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The ListRoutesTable from ExpressRouteCircuit opertion retrieves the currently advertised routes table associated with the ExpressRouteCircuits in a resource group. @@ -197,9 +203,10 @@ interface ExpressRouteCircuitsService { * @param circuitName The name of the loadBalancer. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitStats> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listStats(String resourceGroupName, String circuitName) throws ServiceException, IOException; + ServiceResponse> listStats(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException; /** * The Liststats ExpressRouteCircuit opertion retrieves all the stats from a ExpressRouteCircuits in a resource group. @@ -217,9 +224,10 @@ interface ExpressRouteCircuitsService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a resource group. @@ -235,9 +243,10 @@ interface ExpressRouteCircuitsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a subscription. @@ -253,9 +262,10 @@ interface ExpressRouteCircuitsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitArpTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listArpTableNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listArpTableNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The ListArpTable from ExpressRouteCircuit opertion retrieves the currently advertised arp table associated with the ExpressRouteCircuits in a resource group. @@ -272,9 +282,10 @@ interface ExpressRouteCircuitsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitRoutesTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listRoutesTableNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listRoutesTableNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The ListRoutesTable from ExpressRouteCircuit opertion retrieves the currently advertised routes table associated with the ExpressRouteCircuits in a resource group. @@ -291,9 +302,10 @@ interface ExpressRouteCircuitsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitStats> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listStatsNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listStatsNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The Liststats ExpressRouteCircuit opertion retrieves all the stats from a ExpressRouteCircuits in a resource group. @@ -310,9 +322,10 @@ interface ExpressRouteCircuitsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a resource group. @@ -329,9 +342,10 @@ interface ExpressRouteCircuitsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java index ac035cd7600b1..4fcd17561aa5f 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteCircuitsOperationsImpl.java @@ -26,6 +26,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -48,10 +49,11 @@ public ExpressRouteCircuitsOperationsImpl(Retrofit retrofit, NetworkManagementCl * @param circuitName The name of the express route Circuit. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String circuitName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -97,25 +99,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the circuit. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ExpressRouteCircuit object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -130,23 +130,19 @@ public ServiceResponse get(String resourceGroupName, String */ public Call getAsync(String resourceGroupName, String circuitName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -178,10 +174,11 @@ private ServiceResponse getDelegate(Response * @param parameters Parameters supplied to the create/delete ExpressRouteCircuit operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ExpressRouteCircuit object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuit parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuit parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, circuitName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -233,25 +230,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the circuit. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitArpTable> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listArpTable(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse> listArpTable(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listArpTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listArpTableDelegate(call.execute(), null); @@ -266,23 +261,19 @@ public ServiceResponse> listArpTable(Strin */ public Call listArpTableAsync(String resourceGroupName, String circuitName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listArpTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -311,25 +302,23 @@ private ServiceResponse> listArpTableDeleg * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the circuit. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitRoutesTable> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listRoutesTable(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse> listRoutesTable(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listRoutesTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listRoutesTableDelegate(call.execute(), null); @@ -344,23 +333,19 @@ public ServiceResponse> listRoutesTable */ public Call listRoutesTableAsync(String resourceGroupName, String circuitName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listRoutesTable(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -389,25 +374,23 @@ private ServiceResponse> listRoutesTabl * * @param resourceGroupName The name of the resource group. * @param circuitName The name of the loadBalancer. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitStats> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listStats(String resourceGroupName, String circuitName) throws ServiceException, IOException { + public ServiceResponse> listStats(String resourceGroupName, String circuitName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (circuitName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter circuitName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listStats(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listStatsDelegate(call.execute(), null); @@ -422,23 +405,19 @@ public ServiceResponse> listStats(String reso */ public Call listStatsAsync(String resourceGroupName, String circuitName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (circuitName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter circuitName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter circuitName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listStats(resourceGroupName, circuitName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -466,21 +445,20 @@ private ServiceResponse> listStatsDelegate(Re * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a resource group. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -494,18 +472,15 @@ public ServiceResponse> list(String resourceGroupN */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -532,17 +507,17 @@ private ServiceResponse> listDelegate(Response> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -555,13 +530,11 @@ public ServiceResponse> listAll() throws ServiceEx */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -589,13 +562,14 @@ private ServiceResponse> listAllDelegate(Response< * The ListArpTable from ExpressRouteCircuit opertion retrieves the currently advertised arp table associated with the ExpressRouteCircuits in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitArpTable> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listArpTableNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listArpTableNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listArpTableNext(nextPageLink, this.client.getAcceptLanguage()); return listArpTableNextDelegate(call.execute(), null); @@ -609,8 +583,7 @@ public ServiceResponse> listArpTableNext(S */ public Call listArpTableNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listArpTableNext(nextPageLink, this.client.getAcceptLanguage()); @@ -638,13 +611,14 @@ private ServiceResponse> listArpTableNextD * The ListRoutesTable from ExpressRouteCircuit opertion retrieves the currently advertised routes table associated with the ExpressRouteCircuits in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitRoutesTable> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listRoutesTableNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listRoutesTableNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listRoutesTableNext(nextPageLink, this.client.getAcceptLanguage()); return listRoutesTableNextDelegate(call.execute(), null); @@ -658,8 +632,7 @@ public ServiceResponse> listRoutesTable */ public Call listRoutesTableNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listRoutesTableNext(nextPageLink, this.client.getAcceptLanguage()); @@ -687,13 +660,14 @@ private ServiceResponse> listRoutesTabl * The Liststats ExpressRouteCircuit opertion retrieves all the stats from a ExpressRouteCircuits in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuitStats> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listStatsNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listStatsNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listStatsNext(nextPageLink, this.client.getAcceptLanguage()); return listStatsNextDelegate(call.execute(), null); @@ -707,8 +681,7 @@ public ServiceResponse> listStatsNext(String */ public Call listStatsNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listStatsNext(nextPageLink, this.client.getAcceptLanguage()); @@ -736,13 +709,14 @@ private ServiceResponse> listStatsNextDelegat * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -756,8 +730,7 @@ public ServiceResponse> listNext(String nextPageLi */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -785,13 +758,14 @@ private ServiceResponse> listNextDelegate(Response * The List ExpressRouteCircuit opertion retrieves all the ExpressRouteCircuits in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteCircuit> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -805,8 +779,7 @@ public ServiceResponse> listAllNext(String nextPag */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java index e576a8f3f4dae..45ca794e0e884 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -46,9 +47,10 @@ interface ExpressRouteServiceProvidersService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteServiceProvider> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list() throws ServiceException, IOException; + ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteServiceProvider opertion retrieves all the available ExpressRouteServiceProviders. @@ -64,9 +66,10 @@ interface ExpressRouteServiceProvidersService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteServiceProvider> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List ExpressRouteServiceProvider opertion retrieves all the available ExpressRouteServiceProviders. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java index b0a5a9b82d369..abccfc25b9c95 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/ExpressRouteServiceProvidersOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -38,17 +39,17 @@ public ExpressRouteServiceProvidersOperationsImpl(Retrofit retrofit, NetworkMana /** * The List ExpressRouteServiceProvider opertion retrieves all the available ExpressRouteServiceProviders. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteServiceProvider> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list() throws ServiceException, IOException { + public ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -61,13 +62,11 @@ public ServiceResponse> list() throws Serv */ public Call listAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -95,13 +94,14 @@ private ServiceResponse> listDelegate(Resp * The List ExpressRouteServiceProvider opertion retrieves all the available ExpressRouteServiceProviders. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ExpressRouteServiceProvider> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -115,8 +115,7 @@ public ServiceResponse> listNext(String ne */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java index 8aee93bb67e02..ffbbce060b0da 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -67,10 +68,11 @@ interface LoadBalancersService { * @param loadBalancerName The name of the loadBalancer. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String loadBalancerName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String loadBalancerName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete loadbalancer operation deletes the specified loadbalancer. @@ -90,9 +92,10 @@ interface LoadBalancersService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LoadBalancer object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String loadBalancerName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String loadBalancerName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get ntework interface operation retreives information about the specified network interface. @@ -113,10 +116,11 @@ interface LoadBalancersService { * @param parameters Parameters supplied to the create/delete LoadBalancer operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the LoadBalancer object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancer parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancer parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put LoadBalancer operation creates/updates a LoadBalancer @@ -134,9 +138,10 @@ interface LoadBalancersService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LoadBalancer> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a subscription. @@ -152,9 +157,10 @@ interface LoadBalancersService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LoadBalancer> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a resource group. @@ -171,9 +177,10 @@ interface LoadBalancersService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LoadBalancer> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a subscription. @@ -190,9 +197,10 @@ interface LoadBalancersService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LoadBalancer> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List loadBalancer opertion retrieves all the loadbalancers in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java index 086b22d4a7a4e..7ec62bef46cc4 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LoadBalancersOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public LoadBalancersOperationsImpl(Retrofit retrofit, NetworkManagementClient cl * @param loadBalancerName The name of the loadBalancer. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String loadBalancerName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String loadBalancerName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, loadBalancerName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param loadBalancerName The name of the loadBalancer. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LoadBalancer object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String loadBalancerName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String loadBalancerName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (loadBalancerName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, loadBalancerName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, String loadBa */ public Call getAsync(String resourceGroupName, String loadBalancerName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (loadBalancerName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, loadBalancerName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response respons * @param parameters Parameters supplied to the create/delete LoadBalancer operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the LoadBalancer object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancer parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String loadBalancerName, LoadBalancer parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, loadBalancerName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -230,17 +227,17 @@ public void onResponse(Response response, Retrofit retrofit) { /** * The List loadBalancer opertion retrieves all the loadbalancers in a subscription. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LoadBalancer> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -253,13 +250,11 @@ public ServiceResponse> listAll() throws ServiceException */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -287,21 +282,20 @@ private ServiceResponse> listAllDelegate(Response> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -315,18 +309,15 @@ public ServiceResponse> list(String resourceGroupName) th */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -354,13 +345,14 @@ private ServiceResponse> listDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -374,8 +366,7 @@ public ServiceResponse> listAllNext(String nextPageLink) */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -403,13 +394,14 @@ private ServiceResponse> listAllNextDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -423,8 +415,7 @@ public ServiceResponse> listNext(String nextPageLink) thr */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java index 075976d0f320d..e6083e3d1c77a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface LocalNetworkGatewaysService { * @param parameters Parameters supplied to the Begin Create or update Local Network Gateway operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the LocalNetworkGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGateway parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put LocalNetworkGateway operation creates/updates a local network gateway in the specified resource group through Network resource provider. @@ -85,9 +87,10 @@ interface LocalNetworkGatewaysService { * @param localNetworkGatewayName The name of the local network gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LocalNetworkGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get LocalNetworkGateway operation retrieves information about the specified local network gateway through Network resource provider. @@ -106,10 +109,11 @@ interface LocalNetworkGatewaysService { * @param localNetworkGatewayName The name of the local network gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete LocalNetworkGateway operation deletes the specifed local network Gateway through Network resource provider. @@ -127,9 +131,10 @@ interface LocalNetworkGatewaysService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LocalNetworkGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List LocalNetworkGateways opertion retrieves all the local network gateways stored. @@ -146,9 +151,10 @@ interface LocalNetworkGatewaysService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LocalNetworkGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List LocalNetworkGateways opertion retrieves all the local network gateways stored. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java index f7904988a0738..f6da75901451a 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/LocalNetworkGatewaysOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public LocalNetworkGatewaysOperationsImpl(Retrofit retrofit, NetworkManagementCl * @param parameters Parameters supplied to the Begin Create or update Local Network Gateway operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the LocalNetworkGateway object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGateway parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, localNetworkGatewayName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -101,25 +103,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param localNetworkGatewayName The name of the local network gateway. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LocalNetworkGateway object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (localNetworkGatewayName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter localNetworkGatewayName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter localNetworkGatewayName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, localNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -134,23 +134,19 @@ public ServiceResponse get(String resourceGroupName, String */ public Call getAsync(String resourceGroupName, String localNetworkGatewayName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (localNetworkGatewayName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter localNetworkGatewayName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter localNetworkGatewayName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, localNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -181,10 +177,11 @@ private ServiceResponse getDelegate(Response * @param localNetworkGatewayName The name of the local network gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String localNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, localNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -229,21 +226,20 @@ public void onResponse(Response response, Retrofit retrofit) { * The List LocalNetworkGateways opertion retrieves all the local network gateways stored. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<LocalNetworkGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -257,18 +253,15 @@ public ServiceResponse> list(String resourceGroupN */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -296,13 +289,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -316,8 +310,7 @@ public ServiceResponse> listNext(String nextPageLi */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java index 9bf984a8613fc..fcda4e8d15010 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -82,10 +83,11 @@ interface NetworkInterfacesService { * @param networkInterfaceName The name of the network interface. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String networkInterfaceName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String networkInterfaceName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete netwokInterface operation deletes the specified netwokInterface. @@ -105,9 +107,10 @@ interface NetworkInterfacesService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkInterface object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String networkInterfaceName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String networkInterfaceName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get ntework interface operation retreives information about the specified network interface. @@ -128,10 +131,11 @@ interface NetworkInterfacesService { * @param parameters Parameters supplied to the create/update NetworkInterface operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the NetworkInterface object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterface parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterface parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put NetworkInterface operation creates/updates a networkInterface @@ -152,9 +156,10 @@ interface NetworkInterfacesService { * @param virtualmachineIndex The virtual machine index. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex) throws ServiceException, IOException; + ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex) throws ServiceException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine from a virtual machine scale set. @@ -174,9 +179,10 @@ interface NetworkInterfacesService { * @param virtualMachineScaleSetName The name of the virtual machine scale set. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName) throws ServiceException, IOException; + ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName) throws ServiceException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine scale set. @@ -198,9 +204,10 @@ interface NetworkInterfacesService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkInterface object wrapped in ServiceResponse if successful. */ - ServiceResponse getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) throws ServiceException, IOException; + ServiceResponse getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get ntework interface operation retreives information about the specified network interface in a virtual machine scale set. @@ -220,9 +227,10 @@ interface NetworkInterfacesService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. @@ -238,9 +246,10 @@ interface NetworkInterfacesService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a resource group. @@ -257,9 +266,10 @@ interface NetworkInterfacesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine from a virtual machine scale set. @@ -276,9 +286,10 @@ interface NetworkInterfacesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listVirtualMachineScaleSetNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listVirtualMachineScaleSetNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list network interface operation retrieves information about all network interfaces in a virtual machine scale set. @@ -295,9 +306,10 @@ interface NetworkInterfacesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. @@ -314,9 +326,10 @@ interface NetworkInterfacesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java index 56e5347949f4b..d6174fc08e4d8 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkInterfacesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public NetworkInterfacesOperationsImpl(Retrofit retrofit, NetworkManagementClien * @param networkInterfaceName The name of the network interface. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String networkInterfaceName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String networkInterfaceName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param networkInterfaceName The name of the network interface. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkInterface object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String networkInterfaceName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String networkInterfaceName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (networkInterfaceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, String ne */ public Call getAsync(String resourceGroupName, String networkInterfaceName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (networkInterfaceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response res * @param parameters Parameters supplied to the create/update NetworkInterface operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the NetworkInterface object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterface parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterface parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, networkInterfaceName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -233,29 +230,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param virtualMachineScaleSetName The name of the virtual machine scale set. * @param virtualmachineIndex The virtual machine index. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex) throws ServiceException, IOException { + public ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualMachineScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."); } if (virtualmachineIndex == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listVirtualMachineScaleSetVMNetworkInterfacesDelegate(call.execute(), null); @@ -271,28 +265,23 @@ public ServiceResponse> listVirtualMachineScaleSetVMN */ public Call listVirtualMachineScaleSetVMNetworkInterfacesAsync(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualMachineScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); return null; } if (virtualmachineIndex == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -321,25 +310,23 @@ private ServiceResponse> listVirtualMachineScaleSetVM * * @param resourceGroupName The name of the resource group. * @param virtualMachineScaleSetName The name of the virtual machine scale set. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName) throws ServiceException, IOException { + public ServiceResponse> listVirtualMachineScaleSetNetworkInterfaces(String resourceGroupName, String virtualMachineScaleSetName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualMachineScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listVirtualMachineScaleSetNetworkInterfacesDelegate(call.execute(), null); @@ -354,23 +341,19 @@ public ServiceResponse> listVirtualMachineScaleSetNet */ public Call listVirtualMachineScaleSetNetworkInterfacesAsync(String resourceGroupName, String virtualMachineScaleSetName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualMachineScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -402,33 +385,29 @@ private ServiceResponse> listVirtualMachineScaleSetNe * @param virtualmachineIndex The virtual machine index. * @param networkInterfaceName The name of the network interface. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkInterface object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) throws ServiceException, IOException { + public ServiceResponse getVirtualMachineScaleSetNetworkInterface(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualMachineScaleSetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."); } if (virtualmachineIndex == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null."); } if (networkInterfaceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getVirtualMachineScaleSetNetworkInterfaceDelegate(call.execute(), null); @@ -446,33 +425,27 @@ public ServiceResponse getVirtualMachineScaleSetNetworkInterfa */ public Call getVirtualMachineScaleSetNetworkInterfaceAsync(String resourceGroupName, String virtualMachineScaleSetName, String virtualmachineIndex, String networkInterfaceName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualMachineScaleSetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null.")); return null; } if (virtualmachineIndex == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualmachineIndex is required and cannot be null.")); return null; } if (networkInterfaceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -499,17 +472,17 @@ private ServiceResponse getVirtualMachineScaleSetNetworkInterf /** * The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -522,13 +495,11 @@ public ServiceResponse> listAll() throws ServiceExcep */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -556,21 +527,20 @@ private ServiceResponse> listAllDelegate(Response> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -584,18 +554,15 @@ public ServiceResponse> list(String resourceGroupName */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -623,13 +590,14 @@ private ServiceResponse> listDelegate(Response> listVirtualMachineScaleSetVMNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listVirtualMachineScaleSetVMNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, this.client.getAcceptLanguage()); return listVirtualMachineScaleSetVMNetworkInterfacesNextDelegate(call.execute(), null); @@ -643,8 +611,7 @@ public ServiceResponse> listVirtualMachineScaleSetVMN */ public Call listVirtualMachineScaleSetVMNetworkInterfacesNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, this.client.getAcceptLanguage()); @@ -672,13 +639,14 @@ private ServiceResponse> listVirtualMachineScaleSetVM * The list network interface operation retrieves information about all network interfaces in a virtual machine scale set. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listVirtualMachineScaleSetNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listVirtualMachineScaleSetNetworkInterfacesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, this.client.getAcceptLanguage()); return listVirtualMachineScaleSetNetworkInterfacesNextDelegate(call.execute(), null); @@ -692,8 +660,7 @@ public ServiceResponse> listVirtualMachineScaleSetNet */ public Call listVirtualMachineScaleSetNetworkInterfacesNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, this.client.getAcceptLanguage()); @@ -721,13 +688,14 @@ private ServiceResponse> listVirtualMachineScaleSetNe * The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -741,8 +709,7 @@ public ServiceResponse> listAllNext(String nextPageLi */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -770,13 +737,14 @@ private ServiceResponse> listAllNextDelegate(Response * The List networkInterfaces opertion retrieves all the networkInterfaces in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkInterface> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -790,8 +758,7 @@ public ServiceResponse> listNext(String nextPageLink) */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClient.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClient.java index 81c8c7c09857f..ac9a19dd75a3d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClient.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClient.java @@ -20,6 +20,7 @@ import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.List; import retrofit.Call; import retrofit.http.GET; @@ -237,9 +238,10 @@ interface NetworkManagementClientService { * @param domainNameLabel The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DnsNameAvailabilityResult object wrapped in ServiceResponse if successful. */ - ServiceResponse checkDnsNameAvailability(String location, String domainNameLabel) throws ServiceException, IOException; + ServiceResponse checkDnsNameAvailability(String location, String domainNameLabel) throws ServiceException, IOException, IllegalArgumentException; /** * Checks whether a domain name in the cloudapp.net zone is available for use. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java index 31802a4d40da4..d2eabf2aa7bde 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkManagementClientImpl.java @@ -26,6 +26,7 @@ import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.util.UUID; import retrofit.Call; import retrofit.Response; @@ -353,21 +354,20 @@ private void initialize() { * * @param location The location of the domain name * @param domainNameLabel The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DnsNameAvailabilityResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse checkDnsNameAvailability(String location, String domainNameLabel) throws ServiceException, IOException { + public ServiceResponse checkDnsNameAvailability(String location, String domainNameLabel) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null."); } if (this.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."); } Call call = service.checkDnsNameAvailability(location, this.getSubscriptionId(), domainNameLabel, this.getApiVersion(), this.getAcceptLanguage()); return checkDnsNameAvailabilityDelegate(call.execute(), null); @@ -382,18 +382,15 @@ public ServiceResponse checkDnsNameAvailability(Strin */ public Call checkDnsNameAvailabilityAsync(String location, String domainNameLabel, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (this.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.getSubscriptionId() is required and cannot be null.")); return null; } if (this.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.getApiVersion() is required and cannot be null.")); return null; } Call call = service.checkDnsNameAvailability(location, this.getSubscriptionId(), domainNameLabel, this.getApiVersion(), this.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java index a870336667398..348a4206feb81 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -67,10 +68,11 @@ interface NetworkSecurityGroupsService { * @param networkSecurityGroupName The name of the network security group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete NetworkSecurityGroup operation deletes the specifed network security group @@ -90,9 +92,10 @@ interface NetworkSecurityGroupsService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkSecurityGroup object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get NetworkSecurityGroups operation retrieves information about the specified network security group. @@ -113,10 +116,11 @@ interface NetworkSecurityGroupsService { * @param parameters Parameters supplied to the create/update Network Security Group operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the NetworkSecurityGroup object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroup parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroup parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put NetworkSecurityGroup operation creates/updates a network security groupin the specified resource group. @@ -134,9 +138,10 @@ interface NetworkSecurityGroupsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a subscription @@ -152,9 +157,10 @@ interface NetworkSecurityGroupsService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a resource group @@ -171,9 +177,10 @@ interface NetworkSecurityGroupsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a subscription @@ -190,9 +197,10 @@ interface NetworkSecurityGroupsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list NetworkSecurityGroups returns all network security groups in a resource group diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java index 1e18433cedef3..d3c3e35e9959d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/NetworkSecurityGroupsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public NetworkSecurityGroupsOperationsImpl(Retrofit retrofit, NetworkManagementC * @param networkSecurityGroupName The name of the network security group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param networkSecurityGroupName The name of the network security group. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the NetworkSecurityGroup object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (networkSecurityGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, Strin */ public Call getAsync(String resourceGroupName, String networkSecurityGroupName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (networkSecurityGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response * @param parameters Parameters supplied to the create/update Network Security Group operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the NetworkSecurityGroup object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroup parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroup parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -230,17 +227,17 @@ public void onResponse(Response response, Retrofit retrofit) { /** * The list NetworkSecurityGroups returns all network security groups in a subscription * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -253,13 +250,11 @@ public ServiceResponse> listAll() throws ServiceE */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -287,21 +282,20 @@ private ServiceResponse> listAllDelegate(Response * The list NetworkSecurityGroups returns all network security groups in a resource group * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -315,18 +309,15 @@ public ServiceResponse> list(String resourceGroup */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -354,13 +345,14 @@ private ServiceResponse> listDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -374,8 +366,7 @@ public ServiceResponse> listAllNext(String nextPa */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -403,13 +394,14 @@ private ServiceResponse> listAllNextDelegate(Resp * The list NetworkSecurityGroups returns all network security groups in a resource group * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<NetworkSecurityGroup> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -423,8 +415,7 @@ public ServiceResponse> listNext(String nextPageL */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java index c4e875435c7d9..963b33f4908ca 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -67,10 +68,11 @@ interface PublicIPAddressesService { * @param publicIpAddressName The name of the subnet. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String publicIpAddressName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String publicIpAddressName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete publicIpAddress operation deletes the specified publicIpAddress. @@ -90,9 +92,10 @@ interface PublicIPAddressesService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PublicIPAddress object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String publicIpAddressName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String publicIpAddressName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get publicIpAddress operation retreives information about the specified pubicIpAddress @@ -113,10 +116,11 @@ interface PublicIPAddressesService { * @param parameters Parameters supplied to the create/update PublicIPAddress operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the PublicIPAddress object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String publicIpAddressName, PublicIPAddress parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String publicIpAddressName, PublicIPAddress parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put PublicIPAddress operation creates/updates a stable/dynamic PublicIP address @@ -134,9 +138,10 @@ interface PublicIPAddressesService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a subscription. @@ -152,9 +157,10 @@ interface PublicIPAddressesService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a resource group. @@ -171,9 +177,10 @@ interface PublicIPAddressesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a subscription. @@ -190,9 +197,10 @@ interface PublicIPAddressesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a resource group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java index ef11d2a0c3957..e8a87fc6aab8e 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/PublicIPAddressesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public PublicIPAddressesOperationsImpl(Retrofit retrofit, NetworkManagementClien * @param publicIpAddressName The name of the subnet. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String publicIpAddressName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String publicIpAddressName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, publicIpAddressName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param publicIpAddressName The name of the subnet. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PublicIPAddress object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String publicIpAddressName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String publicIpAddressName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (publicIpAddressName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter publicIpAddressName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter publicIpAddressName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, publicIpAddressName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, String pub */ public Call getAsync(String resourceGroupName, String publicIpAddressName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (publicIpAddressName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter publicIpAddressName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter publicIpAddressName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, publicIpAddressName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response resp * @param parameters Parameters supplied to the create/update PublicIPAddress operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the PublicIPAddress object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String publicIpAddressName, PublicIPAddress parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String publicIpAddressName, PublicIPAddress parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, publicIpAddressName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -230,17 +227,17 @@ public void onResponse(Response response, Retrofit retrofit) { /** * The List publicIpAddress opertion retrieves all the publicIpAddresses in a subscription. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -253,13 +250,11 @@ public ServiceResponse> listAll() throws ServiceExcept */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -287,21 +282,20 @@ private ServiceResponse> listAllDelegate(Response> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -315,18 +309,15 @@ public ServiceResponse> list(String resourceGroupName) */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -354,13 +345,14 @@ private ServiceResponse> listDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -374,8 +366,7 @@ public ServiceResponse> listAllNext(String nextPageLin */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -403,13 +394,14 @@ private ServiceResponse> listAllNextDelegate(Response< * The List publicIpAddress opertion retrieves all the publicIpAddresses in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PublicIPAddress> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -423,8 +415,7 @@ public ServiceResponse> listNext(String nextPageLink) */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java index 9aeddd9b520d8..11c7baecff930 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -67,10 +68,11 @@ interface RouteTablesService { * @param routeTableName The name of the route table. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String routeTableName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String routeTableName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete RouteTable operation deletes the specifed Route Table @@ -90,9 +92,10 @@ interface RouteTablesService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the RouteTable object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String routeTableName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String routeTableName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get RouteTables operation retrieves information about the specified route table. @@ -113,10 +116,11 @@ interface RouteTablesService { * @param parameters Parameters supplied to the create/update Route Table operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the RouteTable object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, RouteTable parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, RouteTable parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put RouteTable operation creates/updates a route tablein the specified resource group. @@ -135,9 +139,10 @@ interface RouteTablesService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<RouteTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a resource group @@ -153,9 +158,10 @@ interface RouteTablesService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<RouteTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a subscription @@ -171,9 +177,10 @@ interface RouteTablesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<RouteTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a resource group @@ -190,9 +197,10 @@ interface RouteTablesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<RouteTable> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list RouteTables returns all route tables in a subscription diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java index 4b171c541a668..e09b09ccfe1a6 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RouteTablesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public RouteTablesOperationsImpl(Retrofit retrofit, NetworkManagementClient clie * @param routeTableName The name of the route table. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String routeTableName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String routeTableName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the RouteTable object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String routeTableName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String routeTableName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (routeTableName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter routeTableName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, String routeTab */ public Call getAsync(String resourceGroupName, String routeTableName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (routeTableName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response response, * @param parameters Parameters supplied to the create/update Route Table operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the RouteTable object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, RouteTable parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, RouteTable parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, routeTableName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -231,21 +228,20 @@ public void onResponse(Response response, Retrofit retrofit) { * The list RouteTables returns all route tables in a resource group * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<RouteTable> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -259,18 +255,15 @@ public ServiceResponse> list(String resourceGroupName) thro */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -297,17 +290,17 @@ private ServiceResponse> listDelegate(Response> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -320,13 +313,11 @@ public ServiceResponse> listAll() throws ServiceException, */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -354,13 +345,14 @@ private ServiceResponse> listAllDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -374,8 +366,7 @@ public ServiceResponse> listNext(String nextPageLink) throw */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -403,13 +394,14 @@ private ServiceResponse> listNextDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -423,8 +415,7 @@ public ServiceResponse> listAllNext(String nextPageLink) th */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java index 0f0f104fa0fcf..d81648e98f3ee 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface RoutesService { * @param routeName The name of the route. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete route operation deletes the specified route from a route table. @@ -86,9 +88,10 @@ interface RoutesService { * @param routeName The name of the route. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Route object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get route operation retreives information about the specified route from the route table. @@ -110,10 +113,11 @@ interface RoutesService { * @param routeParameters Parameters supplied to the create/update routeoperation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the Route object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, String routeName, Route routeParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, String routeName, Route routeParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put route operation creates/updates a route in the specified route table @@ -134,9 +138,10 @@ interface RoutesService { * @param routeTableName The name of the route table. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Route> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String routeTableName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String routeTableName) throws ServiceException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the routes in a route table. @@ -154,9 +159,10 @@ interface RoutesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Route> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the routes in a route table. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java index a89d8e4791667..7ca363aa92998 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/RoutesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public RoutesOperationsImpl(Retrofit retrofit, NetworkManagementClient client) { * @param routeName The name of the route. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, routeTableName, routeName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -101,29 +103,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. * @param routeName The name of the route. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Route object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String routeTableName, String routeName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (routeTableName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter routeTableName is required and cannot be null."); } if (routeName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter routeName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter routeName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, routeTableName, routeName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -139,28 +138,23 @@ public ServiceResponse get(String resourceGroupName, String routeTableNam */ public Call getAsync(String resourceGroupName, String routeTableName, String routeName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (routeTableName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); return null; } if (routeName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter routeName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter routeName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, routeTableName, routeName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -193,10 +187,11 @@ private ServiceResponse getDelegate(Response response, Retr * @param routeParameters Parameters supplied to the create/update routeoperation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the Route object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, String routeName, Route routeParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String routeTableName, String routeName, Route routeParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, routeTableName, routeName, this.client.getSubscriptionId(), routeParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -253,25 +248,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Route> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String routeTableName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String routeTableName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (routeTableName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter routeTableName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -286,23 +279,19 @@ public ServiceResponse> list(String resourceGroupName, String ro */ public Call listAsync(String resourceGroupName, String routeTableName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (routeTableName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter routeTableName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, routeTableName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -330,13 +319,14 @@ private ServiceResponse> listDelegate(Response res * The List network security rule opertion retrieves all the routes in a route table. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Route> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -350,8 +340,7 @@ public ServiceResponse> listNext(String nextPageLink) throws Ser */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java index 16355501d25ac..3bc562d3cecd6 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface SecurityRulesService { * @param securityRuleName The name of the security rule. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete network security rule operation deletes the specified network security rule. @@ -86,9 +88,10 @@ interface SecurityRulesService { * @param securityRuleName The name of the security rule. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the SecurityRule object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get NetworkSecurityRule operation retreives information about the specified network security rule. @@ -110,10 +113,11 @@ interface SecurityRulesService { * @param securityRuleParameters Parameters supplied to the create/update network security rule operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the SecurityRule object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRule securityRuleParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRule securityRuleParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put network security rule operation creates/updates a security rule in the specified network security group @@ -134,9 +138,10 @@ interface SecurityRulesService { * @param networkSecurityGroupName The name of the network security group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<SecurityRule> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the security rules in a network security group. @@ -154,9 +159,10 @@ interface SecurityRulesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<SecurityRule> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List network security rule opertion retrieves all the security rules in a network security group. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java index 68a37cb69f2f7..5d4bead5f5055 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SecurityRulesOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public SecurityRulesOperationsImpl(Retrofit retrofit, NetworkManagementClient cl * @param securityRuleName The name of the security rule. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, networkSecurityGroupName, securityRuleName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -101,29 +103,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param networkSecurityGroupName The name of the network security group. * @param securityRuleName The name of the security rule. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the SecurityRule object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (networkSecurityGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."); } if (securityRuleName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter securityRuleName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, networkSecurityGroupName, securityRuleName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -139,28 +138,23 @@ public ServiceResponse get(String resourceGroupName, String networ */ public Call getAsync(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (networkSecurityGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); return null; } if (securityRuleName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter securityRuleName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, networkSecurityGroupName, securityRuleName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -193,10 +187,11 @@ private ServiceResponse getDelegate(Response respons * @param securityRuleParameters Parameters supplied to the create/update network security rule operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the SecurityRule object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRule securityRuleParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRule securityRuleParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, this.client.getSubscriptionId(), securityRuleParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -253,25 +248,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param networkSecurityGroupName The name of the network security group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<SecurityRule> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String networkSecurityGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (networkSecurityGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -286,23 +279,19 @@ public ServiceResponse> list(String resourceGroupName, St */ public Call listAsync(String resourceGroupName, String networkSecurityGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (networkSecurityGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, networkSecurityGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -330,13 +319,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -350,8 +340,7 @@ public ServiceResponse> listNext(String nextPageLink) thr */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java index fd048c144ed76..9ef78375e09f8 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -62,10 +63,11 @@ interface SubnetsService { * @param subnetName The name of the subnet. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String virtualNetworkName, String subnetName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String virtualNetworkName, String subnetName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The delete subnet operation deletes the specified subnet. @@ -87,9 +89,10 @@ interface SubnetsService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Subnet object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String virtualNetworkName, String subnetName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String virtualNetworkName, String subnetName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get subnet operation retreives information about the specified subnet. @@ -112,10 +115,11 @@ interface SubnetsService { * @param subnetParameters Parameters supplied to the create/update Subnet operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the Subnet object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put Subnet operation creates/updates a subnet in thespecified virtual network @@ -136,9 +140,10 @@ interface SubnetsService { * @param virtualNetworkName The name of the virtual network. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subnet> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, IllegalArgumentException; /** * The List subnets opertion retrieves all the subnets in a virtual network. @@ -156,9 +161,10 @@ interface SubnetsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subnet> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List subnets opertion retrieves all the subnets in a virtual network. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java index 4a36b38da0efc..b2b6d54609704 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public SubnetsOperationsImpl(Retrofit retrofit, NetworkManagementClient client) * @param subnetName The name of the subnet. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String virtualNetworkName, String subnetName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String virtualNetworkName, String subnetName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, virtualNetworkName, subnetName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -102,29 +104,26 @@ public void onResponse(Response response, Retrofit retrofit) { * @param virtualNetworkName The name of the virtual network. * @param subnetName The name of the subnet. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Subnet object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String virtualNetworkName, String subnetName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String virtualNetworkName, String subnetName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); } if (subnetName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter subnetName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, virtualNetworkName, subnetName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -141,28 +140,23 @@ public ServiceResponse get(String resourceGroupName, String virtualNetwo */ public Call getAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualNetworkName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); return null; } if (subnetName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter subnetName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter subnetName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, virtualNetworkName, subnetName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -195,10 +189,11 @@ private ServiceResponse getDelegate(Response response, Ret * @param subnetParameters Parameters supplied to the create/update Subnet operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the Subnet object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, this.client.getSubscriptionId(), subnetParameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -255,25 +250,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param virtualNetworkName The name of the virtual network. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subnet> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -288,23 +281,19 @@ public ServiceResponse> list(String resourceGroupName, String v */ public Call listAsync(String resourceGroupName, String virtualNetworkName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualNetworkName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -332,13 +321,14 @@ private ServiceResponse> listDelegate(Response re * The List subnets opertion retrieves all the subnets in a virtual network. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subnet> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -352,8 +342,7 @@ public ServiceResponse> listNext(String nextPageLink) throws Se */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java index 28a6d20243145..e4cccf4dbc673 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -46,9 +47,10 @@ interface UsagesService { * @param location The location upon which resource usage is queried. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsagesListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String location) throws ServiceException, IOException; + ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. @@ -65,9 +67,10 @@ interface UsagesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsagesListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists compute usages for a subscription. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java index 359ef6ff8e875..d394f4fda0a2c 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/UsagesOperationsImpl.java @@ -21,6 +21,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -38,21 +39,20 @@ public UsagesOperationsImpl(Retrofit retrofit, NetworkManagementClient client) { * Lists compute usages for a subscription. * * @param location The location upon which resource usage is queried. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsagesListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String location) throws ServiceException, IOException { + public ServiceResponse list(String location) throws ServiceException, IOException, IllegalArgumentException { if (location == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null.")); + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -66,18 +66,15 @@ public ServiceResponse list(String location) throws ServiceExc */ public Call listAsync(String location, final ServiceCallback serviceCallback) { if (location == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter location is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter location is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(location, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -105,13 +102,14 @@ private ServiceResponse listDelegate(Response re * Lists compute usages for a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsagesListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -125,8 +123,7 @@ public ServiceResponse listNext(String nextPageLink) throws Se */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java index 13e37f9b77b04..4ccb47a8f9d4d 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperations.java @@ -20,6 +20,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -75,10 +76,11 @@ interface VirtualNetworkGatewayConnectionsService { * @param parameters Parameters supplied to the Begin Create or update Virtual Network Gateway connection operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetworkGatewayConnection object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put VirtualNetworkGatewayConnection operation creates/updates a virtual network gateway connection in the specified resource group through Network resource provider. @@ -98,9 +100,10 @@ interface VirtualNetworkGatewayConnectionsService { * @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetworkGatewayConnection object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get VirtualNetworkGatewayConnection operation retrieves information about the specified virtual network gateway connection through Network resource provider. @@ -119,10 +122,11 @@ interface VirtualNetworkGatewayConnectionsService { * @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete VirtualNetworkGatewayConnection operation deletes the specifed virtual network Gateway connection through Network resource provider. @@ -141,9 +145,10 @@ interface VirtualNetworkGatewayConnectionsService { * @param connectionSharedKeyName The virtual network gateway connection shared key name. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ConnectionSharedKeyResult object wrapped in ServiceResponse if successful. */ - ServiceResponse getSharedKey(String resourceGroupName, String connectionSharedKeyName) throws ServiceException, IOException; + ServiceResponse getSharedKey(String resourceGroupName, String connectionSharedKeyName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified virtual network gateway connection shared key through Network resource provider. @@ -161,9 +166,10 @@ interface VirtualNetworkGatewayConnectionsService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGatewayConnection> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. @@ -182,10 +188,11 @@ interface VirtualNetworkGatewayConnectionsService { * @param parameters Parameters supplied to the Begin Reset Virtual Network Gateway connection shared key operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ConnectionResetSharedKey object wrapped in ServiceResponse if successful. */ - ServiceResponse resetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse resetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @@ -206,10 +213,11 @@ interface VirtualNetworkGatewayConnectionsService { * @param parameters Parameters supplied to the Begin Set Virtual Network Gateway conection Shared key operation throughNetwork resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ConnectionSharedKey object wrapped in ServiceResponse if successful. */ - ServiceResponse setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @@ -228,9 +236,10 @@ interface VirtualNetworkGatewayConnectionsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGatewayConnection> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java index ce216aadbc5e7..4caad8a559a19 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewayConnectionsOperationsImpl.java @@ -26,6 +26,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -49,10 +50,11 @@ public VirtualNetworkGatewayConnectionsOperationsImpl(Retrofit retrofit, Network * @param parameters Parameters supplied to the Begin Create or update Virtual Network Gateway connection operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetworkGatewayConnection object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -104,25 +106,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetworkGatewayConnection object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkGatewayConnectionName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -137,23 +137,19 @@ public ServiceResponse get(String resourceGroup */ public Call getAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualNetworkGatewayConnectionName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -184,10 +180,11 @@ private ServiceResponse getDelegate(Response delete(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayConnectionName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -233,25 +230,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param connectionSharedKeyName The virtual network gateway connection shared key name. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ConnectionSharedKeyResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse getSharedKey(String resourceGroupName, String connectionSharedKeyName) throws ServiceException, IOException { + public ServiceResponse getSharedKey(String resourceGroupName, String connectionSharedKeyName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (connectionSharedKeyName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter connectionSharedKeyName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter connectionSharedKeyName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getSharedKey(resourceGroupName, connectionSharedKeyName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getSharedKeyDelegate(call.execute(), null); @@ -266,23 +261,19 @@ public ServiceResponse getSharedKey(String resourceGr */ public Call getSharedKeyAsync(String resourceGroupName, String connectionSharedKeyName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (connectionSharedKeyName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter connectionSharedKeyName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter connectionSharedKeyName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getSharedKey(resourceGroupName, connectionSharedKeyName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -310,21 +301,20 @@ private ServiceResponse getSharedKeyDelegate(Response * The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGatewayConnection> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -338,18 +328,15 @@ public ServiceResponse> list(String re */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -381,10 +368,11 @@ private ServiceResponse> listDelegate( * @param parameters Parameters supplied to the Begin Reset Virtual Network Gateway connection shared key operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ConnectionResetSharedKey object wrapped in ServiceResponse if successful. */ - public ServiceResponse resetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse resetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -439,10 +427,11 @@ public void onResponse(Response response, Retrofit retrofit) { * @param parameters Parameters supplied to the Begin Set Virtual Network Gateway conection Shared key operation throughNetwork resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ConnectionSharedKey object wrapped in ServiceResponse if successful. */ - public ServiceResponse setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -493,13 +482,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGatewayConnection> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -513,8 +503,7 @@ public ServiceResponse> listNext(Strin */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java index 250e854ebb877..dcfcb3f30ea9b 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -66,10 +67,11 @@ interface VirtualNetworkGatewaysService { * @param parameters Parameters supplied to the Begin Create or update Virtual Network Gateway operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetworkGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put VirtualNetworkGateway operation creates/updates a virtual network gateway in the specified resource group through Network resource provider. @@ -89,9 +91,10 @@ interface VirtualNetworkGatewaysService { * @param virtualNetworkGatewayName The name of the virtual network gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetworkGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException; /** * The Get VirtualNetworkGateway operation retrieves information about the specified virtual network gateway through Network resource provider. @@ -110,10 +113,11 @@ interface VirtualNetworkGatewaysService { * @param virtualNetworkGatewayName The name of the virtual network gateway. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete VirtualNetworkGateway operation deletes the specifed virtual network Gateway through Network resource provider. @@ -131,9 +135,10 @@ interface VirtualNetworkGatewaysService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. @@ -152,10 +157,11 @@ interface VirtualNetworkGatewaysService { * @param parameters Parameters supplied to the Begin Reset Virtual Network Gateway operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetworkGateway object wrapped in ServiceResponse if successful. */ - ServiceResponse reset(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse reset(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Reset VirtualNetworkGateway operation resets the primary of the virtual network gatewayin the specified resource group through Network resource provider. @@ -174,9 +180,10 @@ interface VirtualNetworkGatewaysService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGateway> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java index f33dac0971c0c..bb6702affa1c0 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworkGatewaysOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -46,10 +47,11 @@ public VirtualNetworkGatewaysOperationsImpl(Retrofit retrofit, NetworkManagement * @param parameters Parameters supplied to the Begin Create or update Virtual Network Gateway operation through Network resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetworkGateway object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -101,25 +103,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayName The name of the virtual network gateway. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetworkGateway object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkGatewayName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -134,23 +134,19 @@ public ServiceResponse get(String resourceGroupName, Stri */ public Call getAsync(String resourceGroupName, String virtualNetworkGatewayName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualNetworkGatewayName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -181,10 +177,11 @@ private ServiceResponse getDelegate(Response delete(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String virtualNetworkGatewayName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -229,21 +226,20 @@ public void onResponse(Response response, Retrofit retrofit) { * The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. * * @param resourceGroupName The name of the resource group. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -257,18 +253,15 @@ public ServiceResponse> list(String resourceGrou */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -300,10 +293,11 @@ private ServiceResponse> listDelegate(Response reset(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse reset(String resourceGroupName, String virtualNetworkGatewayName, VirtualNetworkGateway parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.reset(resourceGroupName, virtualNetworkGatewayName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -354,13 +348,14 @@ public void onResponse(Response response, Retrofit retrofit) { * The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetworkGateway> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -374,8 +369,7 @@ public ServiceResponse> listNext(String nextPage */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java index 8b3e60d7f68d6..f032a6d56ea04 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -67,10 +68,11 @@ interface VirtualNetworksService { * @param virtualNetworkName The name of the virtual network. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Delete VirtualNetwork operation deletes the specifed virtual network @@ -90,9 +92,10 @@ interface VirtualNetworksService { * @param expand expand references resources. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetwork object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String virtualNetworkName, String expand) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String virtualNetworkName, String expand) throws ServiceException, IOException, IllegalArgumentException; /** * The Get VirtualNetwork operation retrieves information about the specified virtual network. @@ -113,10 +116,11 @@ interface VirtualNetworksService { * @param parameters Parameters supplied to the create/update Virtual Network operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetwork object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * The Put VirtualNetwork operation creates/updates a virtual network in the specified resource group. @@ -134,9 +138,10 @@ interface VirtualNetworksService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetwork> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAll() throws ServiceException, IOException; + ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a subscription @@ -152,9 +157,10 @@ interface VirtualNetworksService { * @param resourceGroupName The name of the resource group. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetwork> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a resource group @@ -171,9 +177,10 @@ interface VirtualNetworksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetwork> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a subscription @@ -190,9 +197,10 @@ interface VirtualNetworksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetwork> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * The list VirtualNetwork returns all Virtual Networks in a resource group diff --git a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java index 13f6ab46b19e8..27b3169eb3c39 100644 --- a/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java +++ b/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/VirtualNetworksOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -45,10 +46,11 @@ public VirtualNetworksOperationsImpl(Retrofit retrofit, NetworkManagementClient * @param virtualNetworkName The name of the virtual network. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String virtualNetworkName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -95,25 +97,23 @@ public void onResponse(Response response, Retrofit retrofit) { * @param resourceGroupName The name of the resource group. * @param virtualNetworkName The name of the virtual network. * @param expand expand references resources. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the VirtualNetwork object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String virtualNetworkName, String expand) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String virtualNetworkName, String expand) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -129,23 +129,19 @@ public ServiceResponse get(String resourceGroupName, String virt */ public Call getAsync(String resourceGroupName, String virtualNetworkName, String expand, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (virtualNetworkName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), this.client.getApiVersion(), expand, this.client.getAcceptLanguage()); @@ -177,10 +173,11 @@ private ServiceResponse getDelegate(Response respo * @param parameters Parameters supplied to the create/update Virtual Network operation * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the VirtualNetwork object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetwork parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, virtualNetworkName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -230,17 +227,17 @@ public void onResponse(Response response, Retrofit retrofit) { /** * The list VirtualNetwork returns all Virtual Networks in a subscription * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<VirtualNetwork> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAll() throws ServiceException, IOException { + public ServiceResponse> listAll() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAllDelegate(call.execute(), null); @@ -253,13 +250,11 @@ public ServiceResponse> listAll() throws ServiceExcepti */ public Call listAllAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAll(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -287,21 +282,20 @@ private ServiceResponse> listAllDelegate(Response> list(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -315,18 +309,15 @@ public ServiceResponse> list(String resourceGroupName) */ public Call listAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -354,13 +345,14 @@ private ServiceResponse> listDelegate(Response> listAllNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAllNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); return listAllNextDelegate(call.execute(), null); @@ -374,8 +366,7 @@ public ServiceResponse> listAllNext(String nextPageLink */ public Call listAllNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAllNext(nextPageLink, this.client.getAcceptLanguage()); @@ -403,13 +394,14 @@ private ServiceResponse> listAllNextDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -423,8 +415,7 @@ public ServiceResponse> listNext(String nextPageLink) t */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java index 17a7f2a887e3e..607cf9bb76d54 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -52,9 +53,10 @@ interface DeploymentOperationsService { * @param operationId Operation Id. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentOperation object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String deploymentName, String operationId) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String deploymentName, String operationId) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of deployments operations. @@ -75,9 +77,10 @@ interface DeploymentOperationsService { * @param top Query parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<DeploymentOperation> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, String deploymentName, Integer top) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, String deploymentName, Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of deployments operations. @@ -96,9 +99,10 @@ interface DeploymentOperationsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<DeploymentOperation> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of deployments operations. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java index e10103f1a1bf0..f87ac572c0440 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentOperationsOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -41,29 +42,26 @@ public DeploymentOperationsOperationsImpl(Retrofit retrofit, ResourceManagementC * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment. * @param operationId Operation Id. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentOperation object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String deploymentName, String operationId) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String deploymentName, String operationId) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (operationId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, deploymentName, operationId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -79,28 +77,23 @@ public ServiceResponse get(String resourceGroupName, String */ public Call getAsync(String resourceGroupName, String deploymentName, String operationId, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (operationId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter operationId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, deploymentName, operationId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -130,25 +123,23 @@ private ServiceResponse getDelegate(Response * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment. * @param top Query parameters. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<DeploymentOperation> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String resourceGroupName, String deploymentName, Integer top) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, String deploymentName, Integer top) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, deploymentName, this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -164,23 +155,19 @@ public ServiceResponse> list(String resourceGroupN */ public Call listAsync(String resourceGroupName, String deploymentName, Integer top, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, deploymentName, this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -208,13 +195,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -228,8 +216,7 @@ public ServiceResponse> listNext(String nextPageLi */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java index 2825c99586351..dff8d4bbaa749 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperations.java @@ -20,6 +20,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -75,10 +76,11 @@ interface DeploymentsService { * @param deploymentName The name of the deployment to be deleted. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String deploymentName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Begin deleting deployment.To determine whether the operation has finished processing the request, call GetLongRunningOperationStatus. @@ -97,9 +99,10 @@ interface DeploymentsService { * @param deploymentName The name of the deployment. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Boolean object wrapped in ServiceResponse if successful. */ - ServiceResponse checkExistence(String resourceGroupName, String deploymentName) throws ServiceException, IOException; + ServiceResponse checkExistence(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException; /** * Checks whether deployment exists. @@ -119,10 +122,11 @@ interface DeploymentsService { * @param parameters Additional parameters supplied to the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the DeploymentExtended object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse createOrUpdate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Create a named template deployment using a template. @@ -142,9 +146,10 @@ interface DeploymentsService { * @param deploymentName The name of the deployment. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentExtended object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String deploymentName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException; /** * Get a deployment. @@ -163,9 +168,10 @@ interface DeploymentsService { * @param deploymentName The name of the deployment. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse cancel(String resourceGroupName, String deploymentName) throws ServiceException, IOException; + ServiceResponse cancel(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException; /** * Cancel a currently running template deployment. @@ -185,9 +191,10 @@ interface DeploymentsService { * @param parameters Deployment to validate. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentValidateResult object wrapped in ServiceResponse if successful. */ - ServiceResponse validate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException; + ServiceResponse validate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Validate a deployment template. @@ -208,9 +215,10 @@ interface DeploymentsService { * @param top Query parameters. If null is passed returns all deployments. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<DeploymentExtended> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String resourceGroupName, DeploymentExtendedFilter filter, Integer top) throws ServiceException, IOException; + ServiceResponse> list(String resourceGroupName, DeploymentExtendedFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of deployments. @@ -229,9 +237,10 @@ interface DeploymentsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<DeploymentExtended> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of deployments. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java index 47e75fa12eace..b88a3bac6b1af 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/DeploymentsOperationsImpl.java @@ -28,6 +28,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -50,10 +51,11 @@ public DeploymentsOperationsImpl(Retrofit retrofit, ResourceManagementClient cli * @param deploymentName The name of the deployment to be deleted. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse delete(String resourceGroupName, String deploymentName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -99,25 +101,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group to check. The name is case insensitive. * @param deploymentName The name of the deployment. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Boolean object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse checkExistence(String resourceGroupName, String deploymentName) throws ServiceException, IOException { + public ServiceResponse checkExistence(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.checkExistence(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return checkExistenceDelegate(call.execute(), null); @@ -132,23 +132,19 @@ public ServiceResponse checkExistence(String resourceGroupName, String */ public Call checkExistenceAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.checkExistence(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -181,10 +177,11 @@ private ServiceResponse checkExistenceDelegate(Response response, * @param parameters Additional parameters supplied to the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the DeploymentExtended object wrapped in ServiceResponse if successful. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse createOrUpdate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.createOrUpdate(resourceGroupName, deploymentName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -236,25 +233,23 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group to get. The name is case insensitive. * @param deploymentName The name of the deployment. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentExtended object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName, String deploymentName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -269,23 +264,19 @@ public ServiceResponse get(String resourceGroupName, String */ public Call getAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -314,24 +305,22 @@ private ServiceResponse getDelegate(Response r * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse cancel(String resourceGroupName, String deploymentName) throws ServiceException, IOException { + public ServiceResponse cancel(String resourceGroupName, String deploymentName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.cancel(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return cancelDelegate(call.execute(), null); @@ -346,23 +335,19 @@ public ServiceResponse cancel(String resourceGroupName, String deploymentN */ public Call cancelAsync(String resourceGroupName, String deploymentName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.cancel(resourceGroupName, deploymentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -391,29 +376,26 @@ private ServiceResponse cancelDelegate(Response response, Re * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param deploymentName The name of the deployment. * @param parameters Deployment to validate. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the DeploymentValidateResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse validate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException { + public ServiceResponse validate(String resourceGroupName, String deploymentName, Deployment parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (deploymentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.validate(resourceGroupName, deploymentName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -430,28 +412,23 @@ public ServiceResponse validate(String resourceGroupNa */ public Call validateAsync(String resourceGroupName, String deploymentName, Deployment parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (deploymentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter deploymentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -483,21 +460,20 @@ private ServiceResponse validateDelegate(Response> list(String resourceGroupName, DeploymentExtendedFilter filter, Integer top) throws ServiceException, IOException { + public ServiceResponse> list(String resourceGroupName, DeploymentExtendedFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -513,18 +489,15 @@ public ServiceResponse> list(String resourceGroupNa */ public Call listAsync(String resourceGroupName, DeploymentExtendedFilter filter, Integer top, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -552,13 +525,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -572,8 +546,7 @@ public ServiceResponse> listNext(String nextPageLin */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperations.java index 8b8a3e9a4ec59..ec52bcf322fc1 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.Body; import retrofit.http.GET; @@ -91,9 +92,10 @@ interface ManagementLocksService { * @param parameters The management lock parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdateAtResourceGroupLevel(String resourceGroupName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdateAtResourceGroupLevel(String resourceGroupName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create or update a management lock at the resource group level. @@ -118,9 +120,10 @@ interface ManagementLocksService { * @param parameters Create or update management lock parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdateAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdateAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create or update a management lock at the resource level or any level below resource. @@ -148,9 +151,10 @@ interface ManagementLocksService { * @param lockName The name of lock. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) throws ServiceException, IOException; + ServiceResponse deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) throws ServiceException, IOException, IllegalArgumentException; /** * Deletes the management lock of a resource or any level below resource. @@ -173,9 +177,10 @@ interface ManagementLocksService { * @param parameters The management lock parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdateAtSubscriptionLevel(String lockName, ManagementLockObject parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdateAtSubscriptionLevel(String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create or update a management lock at the subscription level. @@ -193,9 +198,10 @@ interface ManagementLocksService { * @param lockName The name of lock. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse deleteAtSubscriptionLevel(String lockName) throws ServiceException, IOException; + ServiceResponse deleteAtSubscriptionLevel(String lockName) throws ServiceException, IOException, IllegalArgumentException; /** * Deletes the management lock of a subscription. @@ -212,9 +218,10 @@ interface ManagementLocksService { * @param lockName Name of the management lock. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String lockName) throws ServiceException, IOException; + ServiceResponse get(String lockName) throws ServiceException, IOException, IllegalArgumentException; /** * Gets the management lock of a scope. @@ -232,9 +239,10 @@ interface ManagementLocksService { * @param lockName The name of lock. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse deleteAtResourceGroupLevel(String resourceGroup, String lockName) throws ServiceException, IOException; + ServiceResponse deleteAtResourceGroupLevel(String resourceGroup, String lockName) throws ServiceException, IOException, IllegalArgumentException; /** * Deletes the management lock of a resource group. @@ -253,9 +261,10 @@ interface ManagementLocksService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtResourceGroupLevel(String resourceGroupName, ManagementLockObject filter) throws ServiceException, IOException; + ServiceResponse> listAtResourceGroupLevel(String resourceGroupName, ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a resource group. @@ -278,9 +287,10 @@ interface ManagementLocksService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, ManagementLockObject filter) throws ServiceException, IOException; + ServiceResponse> listAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a resource or any level below resource. @@ -302,9 +312,10 @@ interface ManagementLocksService { * @param nextLink NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of management locks at resource level or below. @@ -321,9 +332,10 @@ interface ManagementLocksService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtSubscriptionLevel(ManagementLockObject filter) throws ServiceException, IOException; + ServiceResponse> listAtSubscriptionLevel(ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a subscription. @@ -340,9 +352,10 @@ interface ManagementLocksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtResourceGroupLevelNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAtResourceGroupLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a resource group. @@ -359,9 +372,10 @@ interface ManagementLocksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtResourceLevelNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAtResourceLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a resource or any level below resource. @@ -378,9 +392,10 @@ interface ManagementLocksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNextNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNextNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of management locks at resource level or below. @@ -397,9 +412,10 @@ interface ManagementLocksService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listAtSubscriptionLevelNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listAtSubscriptionLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets all the management locks of a subscription. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperationsImpl.java index 1bda79fe40956..579a38fb433e2 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ManagementLocksOperationsImpl.java @@ -24,6 +24,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -43,29 +44,26 @@ public ManagementLocksOperationsImpl(Retrofit retrofit, AuthorizationClient clie * @param resourceGroupName The resource group name. * @param lockName The lock name. * @param parameters The management lock parameters. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdateAtResourceGroupLevel(String resourceGroupName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdateAtResourceGroupLevel(String resourceGroupName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -82,28 +80,23 @@ public ServiceResponse createOrUpdateAtResourceGroupLevel( */ public Call createOrUpdateAtResourceGroupLevelAsync(String resourceGroupName, String lockName, ManagementLockObject parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -139,45 +132,38 @@ private ServiceResponse createOrUpdateAtResourceGroupLevel * @param resourceName Resource identity. * @param lockName The name of lock. * @param parameters Create or update management lock parameters. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ManagementLockObject object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdateAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdateAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdateAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -198,48 +184,39 @@ public ServiceResponse createOrUpdateAtResourceLevel(Strin */ public Call createOrUpdateAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, ManagementLockObject parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -274,40 +251,34 @@ private ServiceResponse createOrUpdateAtResourceLevelDeleg * @param resourceType Resource identity. * @param resourceName Resource identity. * @param lockName The name of lock. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) throws ServiceException, IOException { + public ServiceResponse deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.deleteAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteAtResourceLevelDelegate(call.execute(), null); @@ -326,43 +297,35 @@ public ServiceResponse deleteAtResourceLevel(String resourceGroupName, Str */ public Call deleteAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.deleteAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -392,25 +355,23 @@ private ServiceResponse deleteAtResourceLevelDelegate(Response createOrUpdateAtSubscriptionLevel(String lockName, ManagementLockObject parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdateAtSubscriptionLevel(String lockName, ManagementLockObject parameters) throws ServiceException, IOException, IllegalArgumentException { if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdateAtSubscriptionLevel(lockName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -426,23 +387,19 @@ public ServiceResponse createOrUpdateAtSubscriptionLevel(S */ public Call createOrUpdateAtSubscriptionLevelAsync(String lockName, ManagementLockObject parameters, final ServiceCallback serviceCallback) { if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -472,20 +429,19 @@ private ServiceResponse createOrUpdateAtSubscriptionLevelD * Deletes the management lock of a subscription. * * @param lockName The name of lock. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse deleteAtSubscriptionLevel(String lockName) throws ServiceException, IOException { + public ServiceResponse deleteAtSubscriptionLevel(String lockName) throws ServiceException, IOException, IllegalArgumentException { if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.deleteAtSubscriptionLevel(lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteAtSubscriptionLevelDelegate(call.execute(), null); @@ -499,18 +455,15 @@ public ServiceResponse deleteAtSubscriptionLevel(String lockName) throws S */ public Call deleteAtSubscriptionLevelAsync(String lockName, final ServiceCallback serviceCallback) { if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.deleteAtSubscriptionLevel(lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -539,21 +492,20 @@ private ServiceResponse deleteAtSubscriptionLevelDelegate(Response get(String lockName) throws ServiceException, IOException { + public ServiceResponse get(String lockName) throws ServiceException, IOException, IllegalArgumentException { if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -567,18 +519,15 @@ public ServiceResponse get(String lockName) throws Service */ public Call getAsync(String lockName, final ServiceCallback serviceCallback) { if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -608,24 +557,22 @@ private ServiceResponse getDelegate(Response * * @param resourceGroup The resource group names. * @param lockName The name of lock. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse deleteAtResourceGroupLevel(String resourceGroup, String lockName) throws ServiceException, IOException { + public ServiceResponse deleteAtResourceGroupLevel(String resourceGroup, String lockName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroup == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); } if (lockName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter lockName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.deleteAtResourceGroupLevel(resourceGroup, lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteAtResourceGroupLevelDelegate(call.execute(), null); @@ -640,23 +587,19 @@ public ServiceResponse deleteAtResourceGroupLevel(String resourceGroup, St */ public Call deleteAtResourceGroupLevelAsync(String resourceGroup, String lockName, final ServiceCallback serviceCallback) { if (resourceGroup == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); return null; } if (lockName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter lockName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter lockName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.deleteAtResourceGroupLevel(resourceGroup, lockName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -686,21 +629,20 @@ private ServiceResponse deleteAtResourceGroupLevelDelegate(Response> listAtResourceGroupLevel(String resourceGroupName, ManagementLockObject filter) throws ServiceException, IOException { + public ServiceResponse> listAtResourceGroupLevel(String resourceGroupName, ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAtResourceGroupLevel(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAtResourceGroupLevelDelegate(call.execute(), null); @@ -715,18 +657,15 @@ public ServiceResponse> listAtResourceGroupLevel( */ public Call listAtResourceGroupLevelAsync(String resourceGroupName, ManagementLockObject filter, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAtResourceGroupLevel(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -759,37 +698,32 @@ private ServiceResponse> listAtResourceGroupLevel * @param resourceType Resource identity. * @param resourceName Resource identity. * @param filter The filter to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, ManagementLockObject filter) throws ServiceException, IOException { + public ServiceResponse> listAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAtResourceLevelDelegate(call.execute(), null); @@ -808,38 +742,31 @@ public ServiceResponse> listAtResourceLevel(Strin */ public Call listAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, ManagementLockObject filter, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -867,17 +794,17 @@ private ServiceResponse> listAtResourceLevelDeleg * Get a list of management locks at resource level or below. * * @param nextLink NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextLink) throws ServiceException, IOException, IllegalArgumentException { if (nextLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } Call call = service.listNext(nextLink, this.client.getSubscriptionId(), this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -891,13 +818,11 @@ public ServiceResponse> listNext(String nextLink) */ public Call listNextAsync(String nextLink, final ServiceCallback> serviceCallback) { if (nextLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } Call call = service.listNext(nextLink, this.client.getSubscriptionId(), this.client.getAcceptLanguage()); @@ -925,17 +850,17 @@ private ServiceResponse> listNextDelegate(Respons * Gets all the management locks of a subscription. * * @param filter The filter to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAtSubscriptionLevel(ManagementLockObject filter) throws ServiceException, IOException { + public ServiceResponse> listAtSubscriptionLevel(ManagementLockObject filter) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listAtSubscriptionLevel(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listAtSubscriptionLevelDelegate(call.execute(), null); @@ -949,13 +874,11 @@ public ServiceResponse> listAtSubscriptionLevel(M */ public Call listAtSubscriptionLevelAsync(ManagementLockObject filter, final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listAtSubscriptionLevel(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -983,13 +906,14 @@ private ServiceResponse> listAtSubscriptionLevelD * Gets all the management locks of a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAtResourceGroupLevelNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAtResourceGroupLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAtResourceGroupLevelNext(nextPageLink, this.client.getAcceptLanguage()); return listAtResourceGroupLevelNextDelegate(call.execute(), null); @@ -1003,8 +927,7 @@ public ServiceResponse> listAtResourceGroupLevelN */ public Call listAtResourceGroupLevelNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAtResourceGroupLevelNext(nextPageLink, this.client.getAcceptLanguage()); @@ -1032,13 +955,14 @@ private ServiceResponse> listAtResourceGroupLevel * Gets all the management locks of a resource or any level below resource. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAtResourceLevelNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAtResourceLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAtResourceLevelNext(nextPageLink, this.client.getAcceptLanguage()); return listAtResourceLevelNextDelegate(call.execute(), null); @@ -1052,8 +976,7 @@ public ServiceResponse> listAtResourceLevelNext(S */ public Call listAtResourceLevelNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAtResourceLevelNext(nextPageLink, this.client.getAcceptLanguage()); @@ -1081,13 +1004,14 @@ private ServiceResponse> listAtResourceLevelNextD * Get a list of management locks at resource level or below. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNextNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNextNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNextNext(nextPageLink, this.client.getAcceptLanguage()); return listNextNextDelegate(call.execute(), null); @@ -1101,8 +1025,7 @@ public ServiceResponse> listNextNext(String nextP */ public Call listNextNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNextNext(nextPageLink, this.client.getAcceptLanguage()); @@ -1130,13 +1053,14 @@ private ServiceResponse> listNextNextDelegate(Res * Gets all the management locks of a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ManagementLockObject> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listAtSubscriptionLevelNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listAtSubscriptionLevelNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listAtSubscriptionLevelNext(nextPageLink, this.client.getAcceptLanguage()); return listAtSubscriptionLevelNextDelegate(call.execute(), null); @@ -1150,8 +1074,7 @@ public ServiceResponse> listAtSubscriptionLevelNe */ public Call listAtSubscriptionLevelNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listAtSubscriptionLevelNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java index 8571015c03522..e452bd511c9f5 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.Body; import retrofit.http.GET; @@ -91,9 +92,10 @@ interface PolicyAssignmentsService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForResource(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String filter) throws ServiceException, IOException; + ServiceResponse> listForResource(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource. @@ -116,9 +118,10 @@ interface PolicyAssignmentsService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForResourceGroup(String resourceGroupName, String filter) throws ServiceException, IOException; + ServiceResponse> listForResourceGroup(String resourceGroupName, String filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource group. @@ -137,9 +140,10 @@ interface PolicyAssignmentsService { * @param policyAssignmentName Policy assignment name. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse delete(String scope, String policyAssignmentName) throws ServiceException, IOException; + ServiceResponse delete(String scope, String policyAssignmentName) throws ServiceException, IOException, IllegalArgumentException; /** * Delete policy assignment. @@ -159,9 +163,10 @@ interface PolicyAssignmentsService { * @param parameters Policy assignment. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse create(String scope, String policyAssignmentName, PolicyAssignment parameters) throws ServiceException, IOException; + ServiceResponse create(String scope, String policyAssignmentName, PolicyAssignment parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create policy assignment. @@ -181,9 +186,10 @@ interface PolicyAssignmentsService { * @param policyAssignmentName Policy assignment name. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String scope, String policyAssignmentName) throws ServiceException, IOException; + ServiceResponse get(String scope, String policyAssignmentName) throws ServiceException, IOException, IllegalArgumentException; /** * Get single policy assignment. @@ -201,9 +207,10 @@ interface PolicyAssignmentsService { * @param policyAssignmentId Policy assignment Id * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse deleteById(String policyAssignmentId) throws ServiceException, IOException; + ServiceResponse deleteById(String policyAssignmentId) throws ServiceException, IOException, IllegalArgumentException; /** * Delete policy assignment. @@ -221,9 +228,10 @@ interface PolicyAssignmentsService { * @param parameters Policy assignment. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse createById(String policyAssignmentId, PolicyAssignment parameters) throws ServiceException, IOException; + ServiceResponse createById(String policyAssignmentId, PolicyAssignment parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create policy assignment by Id. @@ -241,9 +249,10 @@ interface PolicyAssignmentsService { * @param policyAssignmentId Policy assignment Id * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object wrapped in ServiceResponse if successful. */ - ServiceResponse getById(String policyAssignmentId) throws ServiceException, IOException; + ServiceResponse getById(String policyAssignmentId) throws ServiceException, IOException, IllegalArgumentException; /** * Get single policy assignment. @@ -260,9 +269,10 @@ interface PolicyAssignmentsService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(String filter) throws ServiceException, IOException; + ServiceResponse> list(String filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the subscription. @@ -280,9 +290,10 @@ interface PolicyAssignmentsService { * @param filter The filter to apply on the operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForScope(String scope, String filter) throws ServiceException, IOException; + ServiceResponse> listForScope(String scope, String filter) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the scope. @@ -300,9 +311,10 @@ interface PolicyAssignmentsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForResourceNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listForResourceNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource. @@ -319,9 +331,10 @@ interface PolicyAssignmentsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForResourceGroupNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listForResourceGroupNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the resource group. @@ -338,9 +351,10 @@ interface PolicyAssignmentsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the subscription. @@ -357,9 +371,10 @@ interface PolicyAssignmentsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listForScopeNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listForScopeNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy assignments of the scope. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java index ed97e131afa27..89050622579d1 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyAssignmentsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -45,37 +46,32 @@ public PolicyAssignmentsOperationsImpl(Retrofit retrofit, ResourceManagementClie * @param resourceType The resource type. * @param resourceName The resource name. * @param filter The filter to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listForResource(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String filter) throws ServiceException, IOException { + public ServiceResponse> listForResource(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String filter) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listForResourceDelegate(call.execute(), null); @@ -94,38 +90,31 @@ public ServiceResponse> listForResource(String resour */ public Call listForResourceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String filter, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -154,21 +143,20 @@ private ServiceResponse> listForResourceDelegate(Resp * * @param resourceGroupName Resource group name. * @param filter The filter to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listForResourceGroup(String resourceGroupName, String filter) throws ServiceException, IOException { + public ServiceResponse> listForResourceGroup(String resourceGroupName, String filter) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listForResourceGroupDelegate(call.execute(), null); @@ -183,18 +171,15 @@ public ServiceResponse> listForResourceGroup(String r */ public Call listForResourceGroupAsync(String resourceGroupName, String filter, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listForResourceGroup(resourceGroupName, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -223,25 +208,23 @@ private ServiceResponse> listForResourceGroupDelegate * * @param scope Scope. * @param policyAssignmentName Policy assignment name. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse delete(String scope, String policyAssignmentName) throws ServiceException, IOException { + public ServiceResponse delete(String scope, String policyAssignmentName) throws ServiceException, IOException, IllegalArgumentException { if (scope == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null.")); + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (policyAssignmentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.delete(scope, policyAssignmentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -256,23 +239,19 @@ public ServiceResponse delete(String scope, String policyAssig */ public Call deleteAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { if (scope == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter scope is required and cannot be null.")); return null; } if (policyAssignmentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.delete(scope, policyAssignmentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -302,29 +281,26 @@ private ServiceResponse deleteDelegate(Response * @param scope Scope. * @param policyAssignmentName Policy assignment name. * @param parameters Policy assignment. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse create(String scope, String policyAssignmentName, PolicyAssignment parameters) throws ServiceException, IOException { + public ServiceResponse create(String scope, String policyAssignmentName, PolicyAssignment parameters) throws ServiceException, IOException, IllegalArgumentException { if (scope == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null.")); + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (policyAssignmentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.create(scope, policyAssignmentName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -341,28 +317,23 @@ public ServiceResponse create(String scope, String policyAssig */ public Call createAsync(String scope, String policyAssignmentName, PolicyAssignment parameters, final ServiceCallback serviceCallback) { if (scope == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter scope is required and cannot be null.")); return null; } if (policyAssignmentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -392,25 +363,23 @@ private ServiceResponse createDelegate(Response * * @param scope Scope. * @param policyAssignmentName Policy assignment name. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String scope, String policyAssignmentName) throws ServiceException, IOException { + public ServiceResponse get(String scope, String policyAssignmentName) throws ServiceException, IOException, IllegalArgumentException { if (scope == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null.")); + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (policyAssignmentName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(scope, policyAssignmentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -425,23 +394,19 @@ public ServiceResponse get(String scope, String policyAssignme */ public Call getAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { if (scope == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter scope is required and cannot be null.")); return null; } if (policyAssignmentName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(scope, policyAssignmentName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -469,21 +434,20 @@ private ServiceResponse getDelegate(Response res * Delete policy assignment. * * @param policyAssignmentId Policy assignment Id + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyAssignment object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse deleteById(String policyAssignmentId) throws ServiceException, IOException { + public ServiceResponse deleteById(String policyAssignmentId) throws ServiceException, IOException, IllegalArgumentException { if (policyAssignmentId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.deleteById(policyAssignmentId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteByIdDelegate(call.execute(), null); @@ -497,18 +461,15 @@ public ServiceResponse deleteById(String policyAssignmentId) t */ public Call deleteByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { if (policyAssignmentId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.deleteById(policyAssignmentId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -537,25 +498,23 @@ private ServiceResponse deleteByIdDelegate(Response createById(String policyAssignmentId, PolicyAssignment parameters) throws ServiceException, IOException { + public ServiceResponse createById(String policyAssignmentId, PolicyAssignment parameters) throws ServiceException, IOException, IllegalArgumentException { if (policyAssignmentId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createById(policyAssignmentId, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -571,23 +530,19 @@ public ServiceResponse createById(String policyAssignmentId, P */ public Call createByIdAsync(String policyAssignmentId, PolicyAssignment parameters, final ServiceCallback serviceCallback) { if (policyAssignmentId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -616,21 +571,20 @@ private ServiceResponse createByIdDelegate(Response getById(String policyAssignmentId) throws ServiceException, IOException { + public ServiceResponse getById(String policyAssignmentId) throws ServiceException, IOException, IllegalArgumentException { if (policyAssignmentId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getById(policyAssignmentId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getByIdDelegate(call.execute(), null); @@ -644,18 +598,15 @@ public ServiceResponse getById(String policyAssignmentId) thro */ public Call getByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { if (policyAssignmentId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getById(policyAssignmentId, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -683,17 +634,17 @@ private ServiceResponse getByIdDelegate(Response * Gets policy assignments of the subscription. * * @param filter The filter to apply on the operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(String filter) throws ServiceException, IOException { + public ServiceResponse> list(String filter) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -707,13 +658,11 @@ public ServiceResponse> list(String filter) throws Se */ public Call listAsync(String filter, final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -742,21 +691,20 @@ private ServiceResponse> listDelegate(Response> listForScope(String scope, String filter) throws ServiceException, IOException { + public ServiceResponse> listForScope(String scope, String filter) throws ServiceException, IOException, IllegalArgumentException { if (scope == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null.")); + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listForScope(scope, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listForScopeDelegate(call.execute(), null); @@ -771,18 +719,15 @@ public ServiceResponse> listForScope(String scope, St */ public Call listForScopeAsync(String scope, String filter, final ServiceCallback> serviceCallback) { if (scope == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter scope is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter scope is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listForScope(scope, this.client.getSubscriptionId(), filter, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -810,13 +755,14 @@ private ServiceResponse> listForScopeDelegate(Respons * Gets policy assignments of the resource. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listForResourceNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listForResourceNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listForResourceNext(nextPageLink, this.client.getAcceptLanguage()); return listForResourceNextDelegate(call.execute(), null); @@ -830,8 +776,7 @@ public ServiceResponse> listForResourceNext(String ne */ public Call listForResourceNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listForResourceNext(nextPageLink, this.client.getAcceptLanguage()); @@ -859,13 +804,14 @@ private ServiceResponse> listForResourceNextDelegate( * Gets policy assignments of the resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listForResourceGroupNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listForResourceGroupNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listForResourceGroupNext(nextPageLink, this.client.getAcceptLanguage()); return listForResourceGroupNextDelegate(call.execute(), null); @@ -879,8 +825,7 @@ public ServiceResponse> listForResourceGroupNext(Stri */ public Call listForResourceGroupNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listForResourceGroupNext(nextPageLink, this.client.getAcceptLanguage()); @@ -908,13 +853,14 @@ private ServiceResponse> listForResourceGroupNextDele * Gets policy assignments of the subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<PolicyAssignment> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -928,8 +874,7 @@ public ServiceResponse> listNext(String nextPageLink) */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -957,13 +902,14 @@ private ServiceResponse> listNextDelegate(Response> listForScopeNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listForScopeNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listForScopeNext(nextPageLink, this.client.getAcceptLanguage()); return listForScopeNextDelegate(call.execute(), null); @@ -977,8 +923,7 @@ public ServiceResponse> listForScopeNext(String nextP */ public Call listForScopeNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listForScopeNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperations.java index 51e831326691c..63161a97cc3c7 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.Body; import retrofit.http.GET; @@ -52,9 +53,10 @@ interface PolicyDefinitionsService { * @param parameters The policy definition properties * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyDefinition object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String policyDefinitionName, PolicyDefinition parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdate(String policyDefinitionName, PolicyDefinition parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create or update policy definition. @@ -72,9 +74,10 @@ interface PolicyDefinitionsService { * @param policyDefinitionName The policy definition name. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyDefinition object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String policyDefinitionName) throws ServiceException, IOException; + ServiceResponse get(String policyDefinitionName) throws ServiceException, IOException, IllegalArgumentException; /** * Gets policy definition. @@ -91,9 +94,10 @@ interface PolicyDefinitionsService { * @param policyDefinitionName The policy definition name. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String policyDefinitionName) throws ServiceException, IOException; + ServiceResponse delete(String policyDefinitionName) throws ServiceException, IOException, IllegalArgumentException; /** * Deletes policy definition. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperationsImpl.java index 8dc80825d16c0..42c4c79345db6 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/PolicyDefinitionsOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -40,25 +41,23 @@ public PolicyDefinitionsOperationsImpl(Retrofit retrofit, ResourceManagementClie * * @param policyDefinitionName The policy definition name. * @param parameters The policy definition properties + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PolicyDefinition object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdate(String policyDefinitionName, PolicyDefinition parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdate(String policyDefinitionName, PolicyDefinition parameters) throws ServiceException, IOException, IllegalArgumentException { if (policyDefinitionName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdate(policyDefinitionName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -74,23 +73,19 @@ public ServiceResponse createOrUpdate(String policyDefinitionN */ public Call createOrUpdateAsync(String policyDefinitionName, PolicyDefinition parameters, final ServiceCallback serviceCallback) { if (policyDefinitionName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -119,21 +114,20 @@ private ServiceResponse createOrUpdateDelegate(Response get(String policyDefinitionName) throws ServiceException, IOException { + public ServiceResponse get(String policyDefinitionName) throws ServiceException, IOException, IllegalArgumentException { if (policyDefinitionName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(policyDefinitionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -147,18 +141,15 @@ public ServiceResponse get(String policyDefinitionName) throws */ public Call getAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { if (policyDefinitionName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(policyDefinitionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -186,20 +177,19 @@ private ServiceResponse getDelegate(Response res * Deletes policy definition. * * @param policyDefinitionName The policy definition name. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse delete(String policyDefinitionName) throws ServiceException, IOException { + public ServiceResponse delete(String policyDefinitionName) throws ServiceException, IOException, IllegalArgumentException { if (policyDefinitionName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.delete(policyDefinitionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -213,18 +203,15 @@ public ServiceResponse delete(String policyDefinitionName) throws ServiceE */ public Call deleteAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { if (policyDefinitionName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.delete(policyDefinitionName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java index 75ff8b50e8255..5a8e9a65bc976 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -57,9 +58,10 @@ interface ProvidersService { * @param resourceProviderNamespace Namespace of the resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object wrapped in ServiceResponse if successful. */ - ServiceResponse unregister(String resourceProviderNamespace) throws ServiceException, IOException; + ServiceResponse unregister(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException; /** * Unregisters provider from a subscription. @@ -76,9 +78,10 @@ interface ProvidersService { * @param resourceProviderNamespace Namespace of the resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object wrapped in ServiceResponse if successful. */ - ServiceResponse register(String resourceProviderNamespace) throws ServiceException, IOException; + ServiceResponse register(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException; /** * Registers provider to be used with a subscription. @@ -95,9 +98,10 @@ interface ProvidersService { * @param top Query parameters. If null is passed returns all deployments. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Provider> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(Integer top) throws ServiceException, IOException; + ServiceResponse> list(Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. @@ -114,9 +118,10 @@ interface ProvidersService { * @param resourceProviderNamespace Namespace of the resource provider. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceProviderNamespace) throws ServiceException, IOException; + ServiceResponse get(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a resource provider. @@ -133,9 +138,10 @@ interface ProvidersService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Provider> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java index c520cf20e084e..0ebc819957ed9 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ProvidersOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -39,21 +40,20 @@ public ProvidersOperationsImpl(Retrofit retrofit, ResourceManagementClient clien * Unregisters provider from a subscription. * * @param resourceProviderNamespace Namespace of the resource provider. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse unregister(String resourceProviderNamespace) throws ServiceException, IOException { + public ServiceResponse unregister(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.unregister(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return unregisterDelegate(call.execute(), null); @@ -67,18 +67,15 @@ public ServiceResponse unregister(String resourceProviderNamespace) th */ public Call unregisterAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.unregister(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -106,21 +103,20 @@ private ServiceResponse unregisterDelegate(Response resp * Registers provider to be used with a subscription. * * @param resourceProviderNamespace Namespace of the resource provider. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse register(String resourceProviderNamespace) throws ServiceException, IOException { + public ServiceResponse register(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.register(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return registerDelegate(call.execute(), null); @@ -134,18 +130,15 @@ public ServiceResponse register(String resourceProviderNamespace) thro */ public Call registerAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.register(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -173,17 +166,17 @@ private ServiceResponse registerDelegate(Response respon * Gets a list of resource providers. * * @param top Query parameters. If null is passed returns all deployments. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Provider> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(Integer top) throws ServiceException, IOException { + public ServiceResponse> list(Integer top) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -197,13 +190,11 @@ public ServiceResponse> list(Integer top) throws ServiceExcep */ public Call listAsync(Integer top, final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -231,21 +222,20 @@ private ServiceResponse> listDelegate(Response * Gets a resource provider. * * @param resourceProviderNamespace Namespace of the resource provider. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Provider object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceProviderNamespace) throws ServiceException, IOException { + public ServiceResponse get(String resourceProviderNamespace) throws ServiceException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -259,18 +249,15 @@ public ServiceResponse get(String resourceProviderNamespace) throws Se */ public Call getAsync(String resourceProviderNamespace, final ServiceCallback serviceCallback) { if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceProviderNamespace, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -298,13 +285,14 @@ private ServiceResponse getDelegate(Response response, R * Gets a list of resource providers. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Provider> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -318,8 +306,7 @@ public ServiceResponse> listNext(String nextPageLink) throws */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java index 9c489060805b2..613d1f8461278 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperations.java @@ -20,6 +20,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -79,9 +80,10 @@ interface ResourceGroupsService { * @param top Query parameters. If null is passed returns all resource groups. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listResources(String resourceGroupName, GenericResourceFilter filter, Integer top) throws ServiceException, IOException; + ServiceResponse> listResources(String resourceGroupName, GenericResourceFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -100,9 +102,10 @@ interface ResourceGroupsService { * @param resourceGroupName The name of the resource group to check. The name is case insensitive. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Boolean object wrapped in ServiceResponse if successful. */ - ServiceResponse checkExistence(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse checkExistence(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * Checks whether resource group exists. @@ -120,9 +123,10 @@ interface ResourceGroupsService { * @param parameters Parameters supplied to the create or update resource group service operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdate(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create a resource group. @@ -140,10 +144,11 @@ interface ResourceGroupsService { * @param resourceGroupName The name of the resource group to be deleted. The name is case insensitive. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName) throws ServiceException, IOException, InterruptedException; + ServiceResponse delete(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Begin deleting resource group.To determine whether the operation has finished processing the request, call GetLongRunningOperationStatus. @@ -160,9 +165,10 @@ interface ResourceGroupsService { * @param resourceGroupName The name of the resource group to get. The name is case insensitive. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * Get a resource group. @@ -180,9 +186,10 @@ interface ResourceGroupsService { * @param parameters Parameters supplied to the update state resource group service operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object wrapped in ServiceResponse if successful. */ - ServiceResponse patch(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException; + ServiceResponse patch(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource groups, though if a field is unspecified current value will be carried over. @@ -201,9 +208,10 @@ interface ResourceGroupsService { * @param top Query parameters. If null is passed returns all resource groups. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ResourceGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(ResourceGroupFilter filter, Integer top) throws ServiceException, IOException; + ServiceResponse> list(ResourceGroupFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a collection of resource groups. @@ -221,9 +229,10 @@ interface ResourceGroupsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listResourcesNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listResourcesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -240,9 +249,10 @@ interface ResourceGroupsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ResourceGroup> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a collection of resource groups. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java index 94b2154bcfe9d..8ca94a02a9d71 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceGroupsOperationsImpl.java @@ -28,6 +28,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -49,21 +50,20 @@ public ResourceGroupsOperationsImpl(Retrofit retrofit, ResourceManagementClient * @param resourceGroupName Query parameters. If null is passed returns all resource groups. * @param filter The filter to apply on the operation. * @param top Query parameters. If null is passed returns all resource groups. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listResources(String resourceGroupName, GenericResourceFilter filter, Integer top) throws ServiceException, IOException { + public ServiceResponse> listResources(String resourceGroupName, GenericResourceFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listResources(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listResourcesDelegate(call.execute(), null); @@ -79,18 +79,15 @@ public ServiceResponse> listResources(String resourceG */ public Call listResourcesAsync(String resourceGroupName, GenericResourceFilter filter, Integer top, final ServiceCallback> serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listResources(resourceGroupName, this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -118,21 +115,20 @@ private ServiceResponse> listResourcesDelegate(Respons * Checks whether resource group exists. * * @param resourceGroupName The name of the resource group to check. The name is case insensitive. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Boolean object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse checkExistence(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse checkExistence(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.checkExistence(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return checkExistenceDelegate(call.execute(), null); @@ -146,18 +142,15 @@ public ServiceResponse checkExistence(String resourceGroupName) throws */ public Call checkExistenceAsync(String resourceGroupName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.checkExistence(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -187,25 +180,23 @@ private ServiceResponse checkExistenceDelegate(Response response, * * @param resourceGroupName The name of the resource group to be created or updated. * @param parameters Parameters supplied to the create or update resource group service operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdate(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdate(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdate(resourceGroupName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -221,23 +212,19 @@ public ServiceResponse createOrUpdate(String resourceGroupName, R */ public Call createOrUpdateAsync(String resourceGroupName, ResourceGroup parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -269,10 +256,11 @@ private ServiceResponse createOrUpdateDelegate(Response delete(String resourceGroupName) throws ServiceException, IOException, InterruptedException { + public ServiceResponse delete(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.delete(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -312,21 +300,20 @@ public void onResponse(Response response, Retrofit retrofit) { * Get a resource group. * * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse get(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -340,18 +327,15 @@ public ServiceResponse get(String resourceGroupName) throws Servi */ public Call getAsync(String resourceGroupName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -380,25 +364,23 @@ private ServiceResponse getDelegate(Response respon * * @param resourceGroupName The name of the resource group to be created or updated. The name is case insensitive. * @param parameters Parameters supplied to the update state resource group service operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceGroup object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse patch(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException { + public ServiceResponse patch(String resourceGroupName, ResourceGroup parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.patch(resourceGroupName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -414,23 +396,19 @@ public ServiceResponse patch(String resourceGroupName, ResourceGr */ public Call patchAsync(String resourceGroupName, ResourceGroup parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -460,17 +438,17 @@ private ServiceResponse patchDelegate(Response resp * * @param filter The filter to apply on the operation. * @param top Query parameters. If null is passed returns all resource groups. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ResourceGroup> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(ResourceGroupFilter filter, Integer top) throws ServiceException, IOException { + public ServiceResponse> list(ResourceGroupFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -485,13 +463,11 @@ public ServiceResponse> list(ResourceGroupFilter filter, */ public Call listAsync(ResourceGroupFilter filter, Integer top, final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -519,13 +495,14 @@ private ServiceResponse> listDelegate(Response> listResourcesNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listResourcesNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listResourcesNext(nextPageLink, this.client.getAcceptLanguage()); return listResourcesNextDelegate(call.execute(), null); @@ -539,8 +516,7 @@ public ServiceResponse> listResourcesNext(String nextP */ public Call listResourcesNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listResourcesNext(nextPageLink, this.client.getAcceptLanguage()); @@ -568,13 +544,14 @@ private ServiceResponse> listResourcesNextDelegate(Res * Gets a collection of resource groups. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<ResourceGroup> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -588,8 +565,7 @@ public ServiceResponse> listNext(String nextPageLink) th */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java index db4dbf7c3c4e6..05907eeb0361a 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -47,9 +48,10 @@ interface ResourceProviderOperationDetailsService { * @param apiVersion the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceProviderOperationDetailListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list(String resourceProviderNamespace, String apiVersion) throws ServiceException, IOException; + ServiceResponse list(String resourceProviderNamespace, String apiVersion) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. @@ -67,9 +69,10 @@ interface ResourceProviderOperationDetailsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceProviderOperationDetailListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of resource providers. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java index bab9b76e2cc02..8ae5d3ab42c9c 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourceProviderOperationDetailsOperationsImpl.java @@ -21,6 +21,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -39,21 +40,20 @@ public ResourceProviderOperationDetailsOperationsImpl(Retrofit retrofit, Resourc * * @param resourceProviderNamespace Resource identity. * @param apiVersion the String value + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceProviderOperationDetailListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list(String resourceProviderNamespace, String apiVersion) throws ServiceException, IOException { + public ServiceResponse list(String resourceProviderNamespace, String apiVersion) throws ServiceException, IOException, IllegalArgumentException { if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (apiVersion == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } Call call = service.list(resourceProviderNamespace, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -68,18 +68,15 @@ public ServiceResponse list(String re */ public Call listAsync(String resourceProviderNamespace, String apiVersion, final ServiceCallback serviceCallback) { if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (apiVersion == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); return null; } Call call = service.list(resourceProviderNamespace, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); @@ -108,13 +105,14 @@ private ServiceResponse listDelegate( * Gets a list of resource providers. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ResourceProviderOperationDetailListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -128,8 +126,7 @@ public ServiceResponse listNext(Strin */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java index 35d78073d4976..37da9e09b901d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperations.java @@ -19,6 +19,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -71,10 +72,11 @@ interface ResourcesService { * @param parameters move resources' parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - ServiceResponse moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Begin moving resources.To determine whether the operation has finished processing the request, call GetLongRunningOperationStatus. @@ -93,9 +95,10 @@ interface ResourcesService { * @param top Query parameters. If null is passed returns all resource groups. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list(GenericResourceFilter filter, Integer top) throws ServiceException, IOException; + ServiceResponse> list(GenericResourceFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. @@ -118,9 +121,10 @@ interface ResourcesService { * @param apiVersion the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Boolean object wrapped in ServiceResponse if successful. */ - ServiceResponse checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException; + ServiceResponse checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException; /** * Checks whether resource exists. @@ -147,9 +151,10 @@ interface ResourcesService { * @param apiVersion the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException; + ServiceResponse delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException; /** * Delete resource and all of its resources. @@ -177,9 +182,10 @@ interface ResourcesService { * @param parameters Create or update resource parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the GenericResource object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResource parameters) throws ServiceException, IOException; + ServiceResponse createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResource parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Create a resource. @@ -207,9 +213,10 @@ interface ResourcesService { * @param apiVersion the String value * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the GenericResource object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException; + ServiceResponse get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException; /** * Returns a resource belonging to a resource group. @@ -231,9 +238,10 @@ interface ResourcesService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get all of the resources under a subscription. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java index 713d30dd56d5d..4754f4f5761a6 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/ResourcesOperationsImpl.java @@ -27,6 +27,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -49,10 +50,11 @@ public ResourcesOperationsImpl(Retrofit retrofit, ResourceManagementClient clien * @param parameters move resources' parameters. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponse object if successful. */ - public ServiceResponse moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.moveResources(sourceResourceGroupName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResult(result, new TypeToken() {}.getType()); } @@ -99,17 +101,17 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param filter The filter to apply on the operation. * @param top Query parameters. If null is passed returns all resource groups. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list(GenericResourceFilter filter, Integer top) throws ServiceException, IOException { + public ServiceResponse> list(GenericResourceFilter filter, Integer top) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -124,13 +126,11 @@ public ServiceResponse> list(GenericResourceFilter fil */ public Call listAsync(GenericResourceFilter filter, Integer top, final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), JacksonUtils.serializeRaw(filter), top, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -163,37 +163,32 @@ private ServiceResponse> listDelegate(Response checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException { + public ServiceResponse checkExistence(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (apiVersion == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } Call call = service.checkExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); return checkExistenceDelegate(call.execute(), null); @@ -212,38 +207,31 @@ public ServiceResponse checkExistence(String resourceGroupName, String */ public Call checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (apiVersion == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); return null; } Call call = service.checkExistence(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); @@ -277,36 +265,31 @@ private ServiceResponse checkExistenceDelegate(Response response, * @param resourceType Resource identity. * @param resourceName Resource identity. * @param apiVersion the String value - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException { + public ServiceResponse delete(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (apiVersion == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } Call call = service.delete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -325,38 +308,31 @@ public ServiceResponse delete(String resourceGroupName, String resourcePro */ public Call deleteAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (apiVersion == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); return null; } Call call = service.delete(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); @@ -391,41 +367,35 @@ private ServiceResponse deleteDelegate(Response response, Re * @param resourceName Resource identity. * @param apiVersion the String value * @param parameters Create or update resource parameters. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the GenericResource object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResource parameters) throws ServiceException, IOException { + public ServiceResponse createOrUpdate(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResource parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (apiVersion == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); Call call = service.createOrUpdate(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, parameters, this.client.getAcceptLanguage()); @@ -446,43 +416,35 @@ public ServiceResponse createOrUpdate(String resourceGroupName, */ public Call createOrUpdateAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, GenericResource parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (apiVersion == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -517,37 +479,32 @@ private ServiceResponse createOrUpdateDelegate(Response get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException { + public ServiceResponse get(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (resourceProviderNamespace == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); } if (parentResourcePath == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); } if (resourceType == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); } if (resourceName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (apiVersion == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); + throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null."); } Call call = service.get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -566,38 +523,31 @@ public ServiceResponse get(String resourceGroupName, String res */ public Call getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (resourceProviderNamespace == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.")); return null; } if (parentResourcePath == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.")); return null; } if (resourceType == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceType is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); return null; } if (resourceName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (apiVersion == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter apiVersion is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter apiVersion is required and cannot be null.")); return null; } Call call = service.get(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.getSubscriptionId(), apiVersion, this.client.getAcceptLanguage()); @@ -626,13 +576,14 @@ private ServiceResponse getDelegate(Response resp * Get all of the resources under a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<GenericResource> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -646,8 +597,7 @@ public ServiceResponse> listNext(String nextPageLink) */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java index 6267eba9d03d3..c03130403c352 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperations.java @@ -18,6 +18,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -57,9 +58,10 @@ interface SubscriptionsService { * @param subscriptionId Id of the subscription * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LocationListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listLocations(String subscriptionId) throws ServiceException, IOException; + ServiceResponse listLocations(String subscriptionId) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the subscription locations. @@ -76,9 +78,10 @@ interface SubscriptionsService { * @param subscriptionId Id of the subscription. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the Subscription object wrapped in ServiceResponse if successful. */ - ServiceResponse get(String subscriptionId) throws ServiceException, IOException; + ServiceResponse get(String subscriptionId) throws ServiceException, IOException, IllegalArgumentException; /** * Gets details about particular subscription. @@ -94,9 +97,10 @@ interface SubscriptionsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subscription> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list() throws ServiceException, IOException; + ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the subscriptionIds. @@ -112,9 +116,10 @@ interface SubscriptionsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LocationListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listLocationsNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listLocationsNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the subscription locations. @@ -131,9 +136,10 @@ interface SubscriptionsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subscription> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the subscriptionIds. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java index dc8c383a3ff87..308f51c1a6c57 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/SubscriptionsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -40,17 +41,17 @@ public SubscriptionsOperationsImpl(Retrofit retrofit, SubscriptionClient client) * Gets a list of the subscription locations. * * @param subscriptionId Id of the subscription + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the LocationListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listLocations(String subscriptionId) throws ServiceException, IOException { + public ServiceResponse listLocations(String subscriptionId) throws ServiceException, IOException, IllegalArgumentException { if (subscriptionId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listLocations(subscriptionId, this.client.getApiVersion(), this.client.getAcceptLanguage()); return listLocationsDelegate(call.execute(), null); @@ -64,13 +65,11 @@ public ServiceResponse listLocations(String subscriptionId) */ public Call listLocationsAsync(String subscriptionId, final ServiceCallback serviceCallback) { if (subscriptionId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listLocations(subscriptionId, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -98,17 +97,17 @@ private ServiceResponse listLocationsDelegate(Response get(String subscriptionId) throws ServiceException, IOException { + public ServiceResponse get(String subscriptionId) throws ServiceException, IOException, IllegalArgumentException { if (subscriptionId == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.get(subscriptionId, this.client.getApiVersion(), this.client.getAcceptLanguage()); return getDelegate(call.execute(), null); @@ -122,13 +121,11 @@ public ServiceResponse get(String subscriptionId) throws ServiceEx */ public Call getAsync(String subscriptionId, final ServiceCallback serviceCallback) { if (subscriptionId == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.get(subscriptionId, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -155,17 +152,17 @@ private ServiceResponse getDelegate(Response respons /** * Gets a list of the subscriptionIds. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<Subscription> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list() throws ServiceException, IOException { + public ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -178,13 +175,11 @@ public ServiceResponse> list() throws ServiceException, I */ public Call listAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -212,13 +207,14 @@ private ServiceResponse> listDelegate(Response listLocationsNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listLocationsNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listLocationsNext(nextPageLink, this.client.getAcceptLanguage()); return listLocationsNextDelegate(call.execute(), null); @@ -232,8 +228,7 @@ public ServiceResponse listLocationsNext(String nextPageLink */ public Call listLocationsNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listLocationsNext(nextPageLink, this.client.getAcceptLanguage()); @@ -261,13 +256,14 @@ private ServiceResponse listLocationsNextDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -281,8 +277,7 @@ public ServiceResponse> listNext(String nextPageLink) thr */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java index af20dd20f67c4..44c8e0c94a308 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperations.java @@ -18,6 +18,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -63,9 +64,10 @@ interface TagsService { * @param tagValue The value of the tag. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse deleteValue(String tagName, String tagValue) throws ServiceException, IOException; + ServiceResponse deleteValue(String tagName, String tagValue) throws ServiceException, IOException, IllegalArgumentException; /** * Delete a subscription resource tag value. @@ -84,9 +86,10 @@ interface TagsService { * @param tagValue The value of the tag. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the TagValue object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdateValue(String tagName, String tagValue) throws ServiceException, IOException; + ServiceResponse createOrUpdateValue(String tagName, String tagValue) throws ServiceException, IOException, IllegalArgumentException; /** * Create a subscription resource tag value. @@ -104,9 +107,10 @@ interface TagsService { * @param tagName The name of the tag. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the TagDetails object wrapped in ServiceResponse if successful. */ - ServiceResponse createOrUpdate(String tagName) throws ServiceException, IOException; + ServiceResponse createOrUpdate(String tagName) throws ServiceException, IOException, IllegalArgumentException; /** * Create a subscription resource tag. @@ -123,9 +127,10 @@ interface TagsService { * @param tagName The name of the tag. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String tagName) throws ServiceException, IOException; + ServiceResponse delete(String tagName) throws ServiceException, IOException, IllegalArgumentException; /** * Delete a subscription resource tag. @@ -141,9 +146,10 @@ interface TagsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TagDetails> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list() throws ServiceException, IOException; + ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of subscription resource tags. @@ -159,9 +165,10 @@ interface TagsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TagDetails> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Get a list of subscription resource tags. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java index d02f62104a6ab..88bdc8429689d 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TagsOperationsImpl.java @@ -23,6 +23,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -41,24 +42,22 @@ public TagsOperationsImpl(Retrofit retrofit, ResourceManagementClient client) { * * @param tagName The name of the tag. * @param tagValue The value of the tag. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse deleteValue(String tagName, String tagValue) throws ServiceException, IOException { + public ServiceResponse deleteValue(String tagName, String tagValue) throws ServiceException, IOException, IllegalArgumentException { if (tagName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); } if (tagValue == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagValue is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagValue is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.deleteValue(tagName, tagValue, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteValueDelegate(call.execute(), null); @@ -73,23 +72,19 @@ public ServiceResponse deleteValue(String tagName, String tagValue) throws */ public Call deleteValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { if (tagName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); return null; } if (tagValue == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagValue is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagValue is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.deleteValue(tagName, tagValue, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -118,25 +113,23 @@ private ServiceResponse deleteValueDelegate(Response respons * * @param tagName The name of the tag. * @param tagValue The value of the tag. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the TagValue object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse createOrUpdateValue(String tagName, String tagValue) throws ServiceException, IOException { + public ServiceResponse createOrUpdateValue(String tagName, String tagValue) throws ServiceException, IOException, IllegalArgumentException { if (tagName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); } if (tagValue == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagValue is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagValue is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.createOrUpdateValue(tagName, tagValue, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return createOrUpdateValueDelegate(call.execute(), null); @@ -151,23 +144,19 @@ public ServiceResponse createOrUpdateValue(String tagName, String tagV */ public Call createOrUpdateValueAsync(String tagName, String tagValue, final ServiceCallback serviceCallback) { if (tagName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); return null; } if (tagValue == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagValue is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagValue is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.createOrUpdateValue(tagName, tagValue, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -196,21 +185,20 @@ private ServiceResponse createOrUpdateValueDelegate(Response createOrUpdate(String tagName) throws ServiceException, IOException { + public ServiceResponse createOrUpdate(String tagName) throws ServiceException, IOException, IllegalArgumentException { if (tagName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.createOrUpdate(tagName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return createOrUpdateDelegate(call.execute(), null); @@ -224,18 +212,15 @@ public ServiceResponse createOrUpdate(String tagName) throws Service */ public Call createOrUpdateAsync(String tagName, final ServiceCallback serviceCallback) { if (tagName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.createOrUpdate(tagName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -264,20 +249,19 @@ private ServiceResponse createOrUpdateDelegate(Response delete(String tagName) throws ServiceException, IOException { + public ServiceResponse delete(String tagName) throws ServiceException, IOException, IllegalArgumentException { if (tagName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter tagName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.delete(tagName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -291,18 +275,15 @@ public ServiceResponse delete(String tagName) throws ServiceException, IOE */ public Call deleteAsync(String tagName, final ServiceCallback serviceCallback) { if (tagName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter tagName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter tagName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.delete(tagName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -329,17 +310,17 @@ private ServiceResponse deleteDelegate(Response response, Re /** * Get a list of subscription resource tags. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TagDetails> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list() throws ServiceException, IOException { + public ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -352,13 +333,11 @@ public ServiceResponse> list() throws ServiceException, IOE */ public Call listAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -386,13 +365,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -406,8 +386,7 @@ public ServiceResponse> listNext(String nextPageLink) throw */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java index d144fb22f590b..9c03dbc1301e9 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperations.java @@ -17,6 +17,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -46,9 +47,10 @@ interface TenantsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TenantIdDescription> object wrapped in ServiceResponse if successful. */ - ServiceResponse> list() throws ServiceException, IOException; + ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the tenantIds. @@ -64,9 +66,10 @@ interface TenantsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TenantIdDescription> object wrapped in ServiceResponse if successful. */ - ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets a list of the tenantIds. diff --git a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java index 689d8292ee469..18905df5cc129 100644 --- a/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java +++ b/azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/TenantsOperationsImpl.java @@ -22,6 +22,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -38,17 +39,17 @@ public TenantsOperationsImpl(Retrofit retrofit, SubscriptionClient client) { /** * Gets a list of the tenantIds. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the PageImpl<TenantIdDescription> object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse> list() throws ServiceException, IOException { + public ServiceResponse> list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -61,13 +62,11 @@ public ServiceResponse> list() throws ServiceExcep */ public Call listAsync(final ServiceCallback> serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -95,13 +94,14 @@ private ServiceResponse> listDelegate(Response> listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse> listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -115,8 +115,7 @@ public ServiceResponse> listNext(String nextPageLi */ public Call listNextAsync(String nextPageLink, final ServiceCallback> serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperations.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperations.java index a2b295d519560..c855b3d20e520 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperations.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperations.java @@ -23,6 +23,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.http.Body; @@ -86,9 +87,10 @@ interface StorageAccountsService { * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the CheckNameAvailabilityResult object wrapped in ServiceResponse if successful. */ - ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws ServiceException, IOException; + ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws ServiceException, IOException, IllegalArgumentException; /** * Checks that account name is valid and is not in use. @@ -107,10 +109,11 @@ interface StorageAccountsService { * @param parameters The parameters to provide for the created account. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the StorageAccount object wrapped in ServiceResponse if successful. */ - ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws ServiceException, IOException, InterruptedException; + ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException; /** * Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of properties, then HTTP 200 would be returned. @@ -130,9 +133,10 @@ interface StorageAccountsService { * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the ServiceResponse object if successful. */ - ServiceResponse delete(String resourceGroupName, String accountName) throws ServiceException, IOException; + ServiceResponse delete(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException; /** * Deletes a storage account in Microsoft Azure. @@ -151,9 +155,10 @@ interface StorageAccountsService { * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccount object wrapped in ServiceResponse if successful. */ - ServiceResponse getProperties(String resourceGroupName, String accountName) throws ServiceException, IOException; + ServiceResponse getProperties(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException; /** * Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -173,9 +178,10 @@ interface StorageAccountsService { * @param parameters The parameters to update on the account. Note that only one property can be changed at a time using this API. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccount object wrapped in ServiceResponse if successful. */ - ServiceResponse update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws ServiceException, IOException; + ServiceResponse update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws ServiceException, IOException, IllegalArgumentException; /** * Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. In order to replace a custom domain, the old value must be cleared before a new value may be set. To clear a custom domain, simply update the custom domain with empty string. Then call update again with the new cutsom domain name. The update API can only be used to update one of tags, accountType, or customDomain per call. To update multiple of these properties, call the API multiple times with one change per call. This call does not change the storage keys for the account. If you want to change storage account keys, use the RegenerateKey operation. The location and name of the storage account cannot be changed after creation. @@ -195,9 +201,10 @@ interface StorageAccountsService { * @param accountName The name of the storage account. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountKeys object wrapped in ServiceResponse if successful. */ - ServiceResponse listKeys(String resourceGroupName, String accountName) throws ServiceException, IOException; + ServiceResponse listKeys(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException; /** * Lists the access keys for the specified storage account. @@ -214,9 +221,10 @@ interface StorageAccountsService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list() throws ServiceException, IOException; + ServiceResponse list() throws ServiceException, IOException, IllegalArgumentException; /** * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -232,9 +240,10 @@ interface StorageAccountsService { * @param resourceGroupName The name of the resource group within the user's subscription. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listByResourceGroup(String resourceGroupName) throws ServiceException, IOException; + ServiceResponse listByResourceGroup(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException; /** * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -253,9 +262,10 @@ interface StorageAccountsService { * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountKeys object wrapped in ServiceResponse if successful. */ - ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws ServiceException, IOException; + ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws ServiceException, IOException, IllegalArgumentException; /** * Regenerates the access keys for the specified storage account. @@ -274,9 +284,10 @@ interface StorageAccountsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -293,9 +304,10 @@ interface StorageAccountsService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listByResourceGroupNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listByResourceGroupNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java index a76445ebb6120..12ad06f78ea3f 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/StorageAccountsOperationsImpl.java @@ -29,6 +29,7 @@ import com.microsoft.rest.Validator; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.lang.InterruptedException; import retrofit.Call; import retrofit.Callback; @@ -48,21 +49,20 @@ public StorageAccountsOperationsImpl(Retrofit retrofit, StorageManagementClient * Checks that account name is valid and is not in use. * * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the CheckNameAvailabilityResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws ServiceException, IOException { + public ServiceResponse checkNameAvailability(StorageAccountCheckNameAvailabilityParameters accountName) throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(accountName); Call call = service.checkNameAvailability(this.client.getSubscriptionId(), accountName, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -77,18 +77,15 @@ public ServiceResponse checkNameAvailability(Storag */ public Call checkNameAvailabilityAsync(StorageAccountCheckNameAvailabilityParameters accountName, final ServiceCallback serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(accountName, serviceCallback); @@ -121,10 +118,11 @@ private ServiceResponse checkNameAvailabilityDelega * @param parameters The parameters to provide for the created account. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @throws InterruptedException exception thrown when long running operation is interrupted * @return the StorageAccount object wrapped in ServiceResponse if successful. */ - public ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws ServiceException, IOException, InterruptedException { + public ServiceResponse create(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) throws ServiceException, IOException, IllegalArgumentException, InterruptedException { Response result = service.create(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPutOrPatchResult(result, new TypeToken() {}.getType()); } @@ -176,24 +174,22 @@ public void onResponse(Response response, Retrofit retrofit) { * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - * @throws ServiceException the exception wrapped in ServiceException if failed. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters */ - public ServiceResponse delete(String resourceGroupName, String accountName) throws ServiceException, IOException { + public ServiceResponse delete(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.delete(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return deleteDelegate(call.execute(), null); @@ -208,23 +204,19 @@ public ServiceResponse delete(String resourceGroupName, String accountName */ public Call deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.delete(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -253,25 +245,23 @@ private ServiceResponse deleteDelegate(Response response, Re * * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccount object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse getProperties(String resourceGroupName, String accountName) throws ServiceException, IOException { + public ServiceResponse getProperties(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.getProperties(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return getPropertiesDelegate(call.execute(), null); @@ -286,23 +276,19 @@ public ServiceResponse getProperties(String resourceGroupName, S */ public Call getPropertiesAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.getProperties(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -332,29 +318,26 @@ private ServiceResponse getPropertiesDelegate(Response update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws ServiceException, IOException { + public ServiceResponse update(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (parameters == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(parameters); Call call = service.update(resourceGroupName, accountName, this.client.getSubscriptionId(), parameters, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -371,28 +354,23 @@ public ServiceResponse update(String resourceGroupName, String a */ public Call updateAsync(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (parameters == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter parameters is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(parameters, serviceCallback); @@ -422,25 +400,23 @@ private ServiceResponse updateDelegate(Response re * * @param resourceGroupName The name of the resource group. * @param accountName The name of the storage account. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountKeys object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listKeys(String resourceGroupName, String accountName) throws ServiceException, IOException { + public ServiceResponse listKeys(String resourceGroupName, String accountName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listKeys(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listKeysDelegate(call.execute(), null); @@ -455,23 +431,19 @@ public ServiceResponse listKeys(String resourceGroupName, St */ public Call listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listKeys(resourceGroupName, accountName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -498,17 +470,17 @@ private ServiceResponse listKeysDelegate(Response list() throws ServiceException, IOException { + public ServiceResponse list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -521,13 +493,11 @@ public ServiceResponse list() throws ServiceException, */ public Call listAsync(final ServiceCallback serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -555,21 +525,20 @@ private ServiceResponse listDelegate(Response listByResourceGroup(String resourceGroupName) throws ServiceException, IOException { + public ServiceResponse listByResourceGroup(String resourceGroupName) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.listByResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listByResourceGroupDelegate(call.execute(), null); @@ -583,18 +552,15 @@ public ServiceResponse listByResourceGroup(String reso */ public Call listByResourceGroupAsync(String resourceGroupName, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.listByResourceGroup(resourceGroupName, this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -624,29 +590,26 @@ private ServiceResponse listByResourceGroupDelegate(Re * @param resourceGroupName The name of the resource group within the user's subscription. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param regenerateKey Specifies name of the key which should be regenerated. key1 or key2 for the default keys + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the StorageAccountKeys object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws ServiceException, IOException { + public ServiceResponse regenerateKey(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey) throws ServiceException, IOException, IllegalArgumentException { if (resourceGroupName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (regenerateKey == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter regenerateKey is required and cannot be null.")); + throw new IllegalArgumentException("Parameter regenerateKey is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Validator.validate(regenerateKey); Call call = service.regenerateKey(resourceGroupName, accountName, this.client.getSubscriptionId(), regenerateKey, this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -663,28 +626,23 @@ public ServiceResponse regenerateKey(String resourceGroupNam */ public Call regenerateKeyAsync(String resourceGroupName, String accountName, StorageAccountRegenerateKeyParameters regenerateKey, final ServiceCallback serviceCallback) { if (resourceGroupName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); return null; } if (accountName == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter accountName is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); return null; } if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (regenerateKey == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter regenerateKey is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter regenerateKey is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Validator.validate(regenerateKey, serviceCallback); @@ -713,13 +671,14 @@ private ServiceResponse regenerateKeyDelegate(Response listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -733,8 +692,7 @@ public ServiceResponse listNext(String nextPageLink) t */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); @@ -762,13 +720,14 @@ private ServiceResponse listNextDelegate(Response listByResourceGroupNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listByResourceGroupNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listByResourceGroupNext(nextPageLink, this.client.getAcceptLanguage()); return listByResourceGroupNextDelegate(call.execute(), null); @@ -782,8 +741,7 @@ public ServiceResponse listByResourceGroupNext(String */ public Call listByResourceGroupNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listByResourceGroupNext(nextPageLink, this.client.getAcceptLanguage()); diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperations.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperations.java index 510798653f3b8..37bde10fd7ef2 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperations.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperations.java @@ -16,6 +16,7 @@ import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.http.GET; import retrofit.http.Header; @@ -45,9 +46,10 @@ interface UsageService { * * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsageListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse list() throws ServiceException, IOException; + ServiceResponse list() throws ServiceException, IOException, IllegalArgumentException; /** * Gets the current usage count and the limit for the resources under the subscription. @@ -63,9 +65,10 @@ interface UsageService { * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws ServiceException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsageListResult object wrapped in ServiceResponse if successful. */ - ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException; + ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException; /** * Gets the current usage count and the limit for the resources under the subscription. diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperationsImpl.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperationsImpl.java index 5b7df84e2a73c..4fb23435ac466 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperationsImpl.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UsageOperationsImpl.java @@ -21,6 +21,7 @@ import com.microsoft.rest.ServiceResponseCallback; import com.squareup.okhttp.ResponseBody; import java.io.IOException; +import java.lang.IllegalArgumentException; import retrofit.Call; import retrofit.Response; import retrofit.Retrofit; @@ -37,17 +38,17 @@ public UsageOperationsImpl(Retrofit retrofit, StorageManagementClient client) { /** * Gets the current usage count and the limit for the resources under the subscription. * + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsageListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse list() throws ServiceException, IOException { + public ServiceResponse list() throws ServiceException, IOException, IllegalArgumentException { if (this.client.getSubscriptionId() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."); } if (this.client.getApiVersion() == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); + throw new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."); } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); return listDelegate(call.execute(), null); @@ -60,13 +61,11 @@ public ServiceResponse list() throws ServiceException, IOExcept */ public Call listAsync(final ServiceCallback serviceCallback) { if (this.client.getSubscriptionId() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); return null; } if (this.client.getApiVersion() == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter this.client.getApiVersion() is required and cannot be null.")); return null; } Call call = service.list(this.client.getSubscriptionId(), this.client.getApiVersion(), this.client.getAcceptLanguage()); @@ -94,13 +93,14 @@ private ServiceResponse listDelegate(Response res * Gets the current usage count and the limit for the resources under the subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws ServiceException exception thrown from REST call + * @throws IOException exception thrown from serialization/deserialization + * @throws IllegalArgumentException exception thrown from invalid parameters * @return the UsageListResult object if successful. - * @throws ServiceException the exception wrapped in ServiceException if failed. */ - public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException { + public ServiceResponse listNext(String nextPageLink) throws ServiceException, IOException, IllegalArgumentException { if (nextPageLink == null) { - throw new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage()); return listNextDelegate(call.execute(), null); @@ -114,8 +114,7 @@ public ServiceResponse listNext(String nextPageLink) throws Ser */ public Call listNextAsync(String nextPageLink, final ServiceCallback serviceCallback) { if (nextPageLink == null) { - serviceCallback.failure(new ServiceException( - new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."))); + serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.")); return null; } Call call = service.listNext(nextPageLink, this.client.getAcceptLanguage());