diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java new file mode 100644 index 000000000000..5ec5db3113d8 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AgreementInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing Agreement. + */ +public interface Agreement extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the agreementLink value. + */ + String agreementLink(); + + /** + * @return the effectiveDate value. + */ + DateTime effectiveDate(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the participants value. + */ + List participants(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AgreementListResult.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AgreementListResult.java new file mode 100644 index 000000000000..266d7e7dae4c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AgreementListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AgreementListResultInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AgreementInner; +import java.util.List; + +/** + * Type representing AgreementListResult. + */ +public interface AgreementListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java new file mode 100644 index 000000000000..a3c9fca402c2 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AgreementsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Agreements. + */ +public interface Agreements extends HasInner { + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String agreementName); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java new file mode 100644 index 000000000000..091e2b073c62 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about the participant or signer. + */ +public class Participants { + /** + * The signing status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The date when status got changed. + */ + @JsonProperty(value = "statusDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime statusDate; + + /** + * The email address of the participant or signer. + */ + @JsonProperty(value = "email", access = JsonProperty.Access.WRITE_ONLY) + private String email; + + /** + * Get the signing status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the date when status got changed. + * + * @return the statusDate value + */ + public DateTime statusDate() { + return this.statusDate; + } + + /** + * Get the email address of the participant or signer. + * + * @return the email value + */ + public String email() { + return this.email; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java new file mode 100644 index 000000000000..63d9ad0a3f6f --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreement; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Participants; + +class AgreementImpl extends IndexableRefreshableWrapperImpl implements Agreement { + private final BillingManager manager; + private String billingAccountName; + private String agreementName; + + AgreementImpl(AgreementInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.agreementName = IdParsingUtils.getValueFromIdByName(inner.id(), "agreements"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + AgreementsInner client = this.manager().inner().agreements(); + return client.getAsync(this.billingAccountName, this.agreementName); + } + + + + @Override + public String agreementLink() { + return this.inner().agreementLink(); + } + + @Override + public DateTime effectiveDate() { + return this.inner().effectiveDate(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List participants() { + return this.inner().participants(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java new file mode 100644 index 000000000000..68c01ae1bf2c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Participants; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An agreement resource. + */ +@JsonFlatten +public class AgreementInner extends ProxyResource { + /** + * The link to the agreement. + */ + @JsonProperty(value = "properties.agreementLink", access = JsonProperty.Access.WRITE_ONLY) + private String agreementLink; + + /** + * Effective date. + */ + @JsonProperty(value = "properties.effectiveDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime effectiveDate; + + /** + * Expiration date. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationDate; + + /** + * Participants or signer of the agreement. + */ + @JsonProperty(value = "properties.participants") + private List participants; + + /** + * The agreement status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the link to the agreement. + * + * @return the agreementLink value + */ + public String agreementLink() { + return this.agreementLink; + } + + /** + * Get effective date. + * + * @return the effectiveDate value + */ + public DateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Get expiration date. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get participants or signer of the agreement. + * + * @return the participants value + */ + public List participants() { + return this.participants; + } + + /** + * Set participants or signer of the agreement. + * + * @param participants the participants value to set + * @return the AgreementInner object itself. + */ + public AgreementInner withParticipants(List participants) { + this.participants = participants; + return this; + } + + /** + * Get the agreement status. + * + * @return the status value + */ + public String status() { + return this.status; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultImpl.java new file mode 100644 index 000000000000..048959944aa1 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.AgreementListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class AgreementListResultImpl extends WrapperImpl implements AgreementListResult { + private final BillingManager manager; + AgreementListResultImpl(AgreementListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultInner.java new file mode 100644 index 000000000000..b5d34dc6692c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of listing agreements. + */ +public class AgreementListResultInner { + /** + * The list of agreements. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of agreements. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java new file mode 100644 index 000000000000..0de89dfb4396 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AgreementListResult; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreement; + +class AgreementsImpl extends WrapperImpl implements Agreements { + private final BillingManager manager; + + AgreementsImpl(BillingManager manager) { + super(manager.inner().agreements()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private AgreementImpl wrapModel(AgreementInner inner) { + return new AgreementImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + AgreementsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public AgreementListResult call(AgreementListResultInner inner) { + return new AgreementListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String agreementName) { + AgreementsInner client = this.inner(); + return client.getAsync(billingAccountName, agreementName) + .map(new Func1() { + @Override + public Agreement call(AgreementInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java new file mode 100644 index 000000000000..ac3b2842360b --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java @@ -0,0 +1,378 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Agreements. + */ +public class AgreementsInner { + /** The Retrofit service to perform REST calls. */ + private AgreementsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AgreementsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AgreementsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AgreementsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Agreements to be + * used by Retrofit to perform actually REST calls. + */ + interface AgreementsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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.v2018_11_01_preview.Agreements get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("agreementName") String agreementName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @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 AgreementListResultInner object if successful. + */ + public AgreementListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @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 listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, AgreementListResultInner>() { + @Override + public AgreementListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + 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."); + } + final String expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @param expand May be used to expand the participants. + * @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 AgreementListResultInner object if successful. + */ + public AgreementListResultInner listByBillingAccountName(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @param expand May be used to expand the participants. + * @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 listByBillingAccountNameAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, AgreementListResultInner>() { + @Override + public AgreementListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName billing Account Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + 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.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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) + .build(response); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @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 AgreementInner object if successful. + */ + public AgreementInner get(String billingAccountName, String agreementName) { + return getWithServiceResponseAsync(billingAccountName, agreementName).toBlocking().single().body(); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @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 getAsync(String billingAccountName, String agreementName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, agreementName), serviceCallback); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable getAsync(String billingAccountName, String agreementName) { + return getWithServiceResponseAsync(billingAccountName, agreementName).map(new Func1, AgreementInner>() { + @Override + public AgreementInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String agreementName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (agreementName == null) { + throw new IllegalArgumentException("Parameter agreementName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, agreementName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @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 AgreementInner object if successful. + */ + public AgreementInner get(String billingAccountName, String agreementName, String expand) { + return getWithServiceResponseAsync(billingAccountName, agreementName, expand).toBlocking().single().body(); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @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 getAsync(String billingAccountName, String agreementName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, agreementName, expand), serviceCallback); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable getAsync(String billingAccountName, String agreementName, String expand) { + return getWithServiceResponseAsync(billingAccountName, agreementName, expand).map(new Func1, AgreementInner>() { + @Override + public AgreementInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String agreementName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (agreementName == null) { + throw new IllegalArgumentException("Parameter agreementName 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.get(billingAccountName, agreementName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java index 216bc200172d..872cb94df459 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java @@ -685,6 +685,19 @@ public BillingProfileBillingRoleAssignmentsInner billingProfileBillingRoleAssign return this.billingProfileBillingRoleAssignments; } + /** + * The AgreementsInner object to access its operations. + */ + private AgreementsInner agreements; + + /** + * Gets the AgreementsInner object to access its operations. + * @return the AgreementsInner object. + */ + public AgreementsInner agreements() { + return this.agreements; + } + /** * Initializes an instance of BillingManagementClient client. * @@ -761,6 +774,7 @@ protected void initialize() { this.billingAccountBillingRoleAssignments = new BillingAccountBillingRoleAssignmentsInner(restClient().retrofit(), this); this.invoiceSectionBillingRoleAssignments = new InvoiceSectionBillingRoleAssignmentsInner(restClient().retrofit(), this); this.billingProfileBillingRoleAssignments = new BillingProfileBillingRoleAssignmentsInner(restClient().retrofit(), this); + this.agreements = new AgreementsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); initializeService(); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java index 112d3db6208c..aa1878e9d794 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java @@ -57,6 +57,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountBillingRoleAssignments; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionBillingRoleAssignments; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileBillingRoleAssignments; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -105,6 +106,7 @@ public final class BillingManager extends ManagerCore