diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java index fca31e4619c91..ee3ec99c8b898 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java @@ -23,7 +23,7 @@ public interface Departments extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountAsync(String billingAccountName); + Observable listByBillingAccountNameAsync(String billingAccountName); /** * Get the department by id. diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java index fd18081164f1d..223746844310e 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java @@ -23,7 +23,7 @@ public interface EnrollmentAccounts extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountAsync(String billingAccountName); + Observable listByBillingAccountNameAsync(String billingAccountName); /** * Get the enrollment account by id. diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java index fa53ce2e0008b..ee71b2f440ccc 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java @@ -25,6 +25,15 @@ public interface RecipientTransfers extends HasInner { */ Observable acceptAsync(String transferName); + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(String transferName); + /** * Declines the transfer with given transfer Id. * diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java index be5024abca751..e4f534ea3c37c 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java @@ -33,9 +33,9 @@ private DepartmentImpl wrapModel(DepartmentInner inner) { } @Override - public Observable listByBillingAccountAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(String billingAccountName) { DepartmentsInner client = this.inner(); - return client.listByBillingAccountAsync(billingAccountName) + return client.listByBillingAccountNameAsync(billingAccountName) .map(new Func1() { @Override public DepartmentListResult call(DepartmentListResultInner inner) { diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java index 662ab394fff20..ecc73c61fd1a9 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java @@ -51,9 +51,9 @@ public DepartmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface DepartmentsService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Departments listByBillingAccount" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Departments listByBillingAccountName" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") - Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Departments get" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}") @@ -70,8 +70,8 @@ interface DepartmentsService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the DepartmentListResultInner object if successful. */ - public DepartmentListResultInner listByBillingAccount(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public DepartmentListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); } /** @@ -82,8 +82,8 @@ public DepartmentListResultInner listByBillingAccount(String billingAccountName) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); } /** @@ -93,8 +93,8 @@ public ServiceFuture listByBillingAccountAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentListResultInner object */ - public Observable listByBillingAccountAsync(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, DepartmentListResultInner>() { + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, DepartmentListResultInner>() { @Override public DepartmentListResultInner call(ServiceResponse response) { return response.body(); @@ -109,7 +109,7 @@ public DepartmentListResultInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentListResultInner object */ - public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -118,12 +118,12 @@ public Observable> listByBillingAccou } final String expand = null; final String filter = null; - return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -143,8 +143,8 @@ public Observable> call(Response listByBillingAccountAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); } /** @@ -170,8 +170,8 @@ public ServiceFuture listByBillingAccountAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentListResultInner object */ - public Observable listByBillingAccountAsync(String billingAccountName, String expand, String filter) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, DepartmentListResultInner>() { + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, DepartmentListResultInner>() { @Override public DepartmentListResultInner call(ServiceResponse response) { return response.body(); @@ -188,19 +188,19 @@ public DepartmentListResultInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentListResultInner object */ - public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -209,7 +209,7 @@ public Observable> call(Response listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorResponseException.class) diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java index 20d8743915a58..937bbde483b6e 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java @@ -33,9 +33,9 @@ private EnrollmentAccountImpl wrapModel(EnrollmentAccountInner inner) { } @Override - public Observable listByBillingAccountAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(String billingAccountName) { EnrollmentAccountsInner client = this.inner(); - return client.listByBillingAccountAsync(billingAccountName) + return client.listByBillingAccountNameAsync(billingAccountName) .map(new Func1() { @Override public EnrollmentAccountListResult call(EnrollmentAccountListResultInner inner) { diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java index 536f275a2d580..37e09e04fe11a 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java @@ -51,9 +51,9 @@ public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl cl * used by Retrofit to perform actually REST calls. */ interface EnrollmentAccountsService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts listByBillingAccount" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts listByBillingAccountName" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") - Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts getByEnrollmentAccountId" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") @@ -70,8 +70,8 @@ interface EnrollmentAccountsService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the EnrollmentAccountListResultInner object if successful. */ - public EnrollmentAccountListResultInner listByBillingAccount(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); } /** @@ -82,8 +82,8 @@ public EnrollmentAccountListResultInner listByBillingAccount(String billingAccou * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); } /** @@ -93,8 +93,8 @@ public ServiceFuture listByBillingAccountAsync * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountListResultInner object */ - public Observable listByBillingAccountAsync(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, EnrollmentAccountListResultInner>() { + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, EnrollmentAccountListResultInner>() { @Override public EnrollmentAccountListResultInner call(ServiceResponse response) { return response.body(); @@ -109,7 +109,7 @@ public EnrollmentAccountListResultInner call(ServiceResponse> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -118,12 +118,12 @@ public Observable> listByBilli } final String expand = null; final String filter = null; - return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -143,8 +143,8 @@ public Observable> call(Respon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the EnrollmentAccountListResultInner object if successful. */ - public EnrollmentAccountListResultInner listByBillingAccount(String billingAccountName, String expand, String filter) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); } /** @@ -157,8 +157,8 @@ public EnrollmentAccountListResultInner listByBillingAccount(String billingAccou * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); } /** @@ -170,8 +170,8 @@ public ServiceFuture listByBillingAccountAsync * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountListResultInner object */ - public Observable listByBillingAccountAsync(String billingAccountName, String expand, String filter) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, EnrollmentAccountListResultInner>() { + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, EnrollmentAccountListResultInner>() { @Override public EnrollmentAccountListResultInner call(ServiceResponse response) { return response.body(); @@ -188,19 +188,19 @@ public EnrollmentAccountListResultInner call(ServiceResponse> listByBillingAccountWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -209,7 +209,7 @@ public Observable> call(Respon }); } - private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorResponseException.class) diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java index fe51097b546ac..c189864fb1a6b 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java @@ -15,6 +15,7 @@ import rx.Observable; import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransferDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateTransferListResponse; class RecipientTransfersImpl extends WrapperImpl implements RecipientTransfers { private final BillingManager manager; @@ -40,6 +41,18 @@ public RecipientTransferDetails call(RecipientTransferDetailsInner inner) { }); } + @Override + public Observable validateAsync(String transferName) { + RecipientTransfersInner client = this.inner(); + return client.validateAsync(transferName) + .map(new Func1() { + @Override + public ValidateTransferListResponse call(ValidateTransferListResponseInner inner) { + return new ValidateTransferListResponseImpl(inner, manager()); + } + }); + } + @Override public Observable declineAsync(String transferName) { RecipientTransfersInner client = this.inner(); diff --git a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java index 1669ea16f254d..d09881ea19db8 100644 --- a/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java +++ b/billing/resource-manager/v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java @@ -65,6 +65,10 @@ interface RecipientTransfersService { @POST("providers/Microsoft.Billing/transfers/{transferName}/acceptTransfer") Observable> accept(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Body AcceptTransferRequest parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransfers validate" }) + @POST("providers/Microsoft.Billing/transfers/{transferName}/validateTransfer") + Observable> validate(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Body AcceptTransferRequest parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransfers decline" }) @POST("providers/Microsoft.Billing/transfers/{transferName}/declineTransfer") Observable> decline(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -232,6 +236,155 @@ private ServiceResponse acceptDelegate(Response validateAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable validateAsync(String transferName) { + return validateWithServiceResponseAsync(transferName).map(new Func1, ValidateTransferListResponseInner>() { + @Override + public ValidateTransferListResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable> validateWithServiceResponseAsync(String transferName) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + final List productDetails = null; + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(null); + return service.validate(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ValidateTransferListResponseInner object if successful. + */ + public ValidateTransferListResponseInner validate(String transferName, List productDetails) { + return validateWithServiceResponseAsync(transferName, productDetails).toBlocking().single().body(); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @param productDetails Request parameters to accept transfer. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture validateAsync(String transferName, List productDetails, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(transferName, productDetails), serviceCallback); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable validateAsync(String transferName, List productDetails) { + return validateWithServiceResponseAsync(transferName, productDetails).map(new Func1, ValidateTransferListResponseInner>() { + @Override + public ValidateTransferListResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if the products can be transferred in the context of the given transfer name. + * + * @param transferName Transfer Name. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable> validateWithServiceResponseAsync(String transferName, List productDetails) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + Validator.validate(productDetails); + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(productDetails); + return service.validate(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Declines the transfer with given transfer Id. *