diff --git a/sdk/billing/mgmt-v2020_05_01/pom.xml b/sdk/billing/mgmt-v2020_05_01/pom.xml new file mode 100644 index 0000000000000..85335405e8fa1 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.billing.v2020_05_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-billing + 1.0.0-beta + jar + Microsoft Azure SDK for Billing Management + This package contains Microsoft Billing Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AcceptanceMode.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AcceptanceMode.java new file mode 100644 index 0000000000000..1e4eabd0616b9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AcceptanceMode.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AcceptanceMode. + */ +public final class AcceptanceMode extends ExpandableStringEnum { + /** Static value ClickToAccept for AcceptanceMode. */ + public static final AcceptanceMode CLICK_TO_ACCEPT = fromString("ClickToAccept"); + + /** Static value ESignEmbedded for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_EMBEDDED = fromString("ESignEmbedded"); + + /** Static value ESignOffline for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_OFFLINE = fromString("ESignOffline"); + + /** + * Creates or finds a AcceptanceMode from its string representation. + * @param name a name to look for + * @return the corresponding AcceptanceMode + */ + @JsonCreator + public static AcceptanceMode fromString(String name) { + return fromString(name, AcceptanceMode.class); + } + + /** + * @return known AcceptanceMode values + */ + public static Collection values() { + return values(AcceptanceMode.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountStatus.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountStatus.java new file mode 100644 index 0000000000000..cd91778fc7689 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountStatus.java @@ -0,0 +1,56 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccountStatus. + */ +public final class AccountStatus extends ExpandableStringEnum { + /** Static value Active for AccountStatus. */ + public static final AccountStatus ACTIVE = fromString("Active"); + + /** Static value Deleted for AccountStatus. */ + public static final AccountStatus DELETED = fromString("Deleted"); + + /** Static value Disabled for AccountStatus. */ + public static final AccountStatus DISABLED = fromString("Disabled"); + + /** Static value Expired for AccountStatus. */ + public static final AccountStatus EXPIRED = fromString("Expired"); + + /** Static value Transferred for AccountStatus. */ + public static final AccountStatus TRANSFERRED = fromString("Transferred"); + + /** Static value Extended for AccountStatus. */ + public static final AccountStatus EXTENDED = fromString("Extended"); + + /** Static value Terminated for AccountStatus. */ + public static final AccountStatus TERMINATED = fromString("Terminated"); + + /** + * Creates or finds a AccountStatus from its string representation. + * @param name a name to look for + * @return the corresponding AccountStatus + */ + @JsonCreator + public static AccountStatus fromString(String name) { + return fromString(name, AccountStatus.class); + } + + /** + * @return known AccountStatus values + */ + public static Collection values() { + return values(AccountStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountType.java new file mode 100644 index 0000000000000..fae5673fcd3fd --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AccountType.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccountType. + */ +public final class AccountType extends ExpandableStringEnum { + /** Static value Enterprise for AccountType. */ + public static final AccountType ENTERPRISE = fromString("Enterprise"); + + /** Static value Individual for AccountType. */ + public static final AccountType INDIVIDUAL = fromString("Individual"); + + /** Static value Partner for AccountType. */ + public static final AccountType PARTNER = fromString("Partner"); + + /** + * Creates or finds a AccountType from its string representation. + * @param name a name to look for + * @return the corresponding AccountType + */ + @JsonCreator + public static AccountType fromString(String name) { + return fromString(name, AccountType.class); + } + + /** + * @return known AccountType values + */ + public static Collection values() { + return values(AccountType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Address.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Address.java new file mode 100644 index 0000000000000..f27cdc6015697 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Address.java @@ -0,0 +1,28 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.AddressInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Address. + */ +public interface Address extends HasInner { + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(AddressDetails address); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressDetails.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressDetails.java new file mode 100644 index 0000000000000..ae0f22a34d2ef --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressDetails.java @@ -0,0 +1,355 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Address details. + */ +public class AddressDetails { + /** + * First name. + */ + @JsonProperty(value = "firstName") + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "lastName") + private String lastName; + + /** + * Company name. + */ + @JsonProperty(value = "companyName") + private String companyName; + + /** + * Address line 1. + */ + @JsonProperty(value = "addressLine1", required = true) + private String addressLine1; + + /** + * Address line 2. + */ + @JsonProperty(value = "addressLine2") + private String addressLine2; + + /** + * Address line 3. + */ + @JsonProperty(value = "addressLine3") + private String addressLine3; + + /** + * Address city. + */ + @JsonProperty(value = "city") + private String city; + + /** + * Address district. + */ + @JsonProperty(value = "district") + private String district; + + /** + * Address region. + */ + @JsonProperty(value = "region") + private String region; + + /** + * Country code uses ISO2, 2-digit format. + */ + @JsonProperty(value = "country", required = true) + private String country; + + /** + * Postal code. + */ + @JsonProperty(value = "postalCode") + private String postalCode; + + /** + * Email address. + */ + @JsonProperty(value = "email") + private String email; + + /** + * Phone number. + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Get first name. + * + * @return the firstName value + */ + public String firstName() { + return this.firstName; + } + + /** + * Set first name. + * + * @param firstName the firstName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get last name. + * + * @return the lastName value + */ + public String lastName() { + return this.lastName; + } + + /** + * Set last name. + * + * @param lastName the lastName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get company name. + * + * @return the companyName value + */ + public String companyName() { + return this.companyName; + } + + /** + * Set company name. + * + * @param companyName the companyName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get address line 1. + * + * @return the addressLine1 value + */ + public String addressLine1() { + return this.addressLine1; + } + + /** + * Set address line 1. + * + * @param addressLine1 the addressLine1 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + /** + * Get address line 2. + * + * @return the addressLine2 value + */ + public String addressLine2() { + return this.addressLine2; + } + + /** + * Set address line 2. + * + * @param addressLine2 the addressLine2 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + /** + * Get address line 3. + * + * @return the addressLine3 value + */ + public String addressLine3() { + return this.addressLine3; + } + + /** + * Set address line 3. + * + * @param addressLine3 the addressLine3 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine3(String addressLine3) { + this.addressLine3 = addressLine3; + return this; + } + + /** + * Get address city. + * + * @return the city value + */ + public String city() { + return this.city; + } + + /** + * Set address city. + * + * @param city the city value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCity(String city) { + this.city = city; + return this; + } + + /** + * Get address district. + * + * @return the district value + */ + public String district() { + return this.district; + } + + /** + * Set address district. + * + * @param district the district value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withDistrict(String district) { + this.district = district; + return this; + } + + /** + * Get address region. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set address region. + * + * @param region the region value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get country code uses ISO2, 2-digit format. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Set country code uses ISO2, 2-digit format. + * + * @param country the country value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get postal code. + * + * @return the postalCode value + */ + public String postalCode() { + return this.postalCode; + } + + /** + * Set postal code. + * + * @param postalCode the postalCode value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get email address. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set email address. + * + * @param email the email value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get phone number. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set phone number. + * + * @param phoneNumber the phoneNumber value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressValidationStatus.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressValidationStatus.java new file mode 100644 index 0000000000000..5061430e150ef --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AddressValidationStatus.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AddressValidationStatus. + */ +public final class AddressValidationStatus extends ExpandableStringEnum { + /** Static value Valid for AddressValidationStatus. */ + public static final AddressValidationStatus VALID = fromString("Valid"); + + /** Static value Invalid for AddressValidationStatus. */ + public static final AddressValidationStatus INVALID = fromString("Invalid"); + + /** + * Creates or finds a AddressValidationStatus from its string representation. + * @param name a name to look for + * @return the corresponding AddressValidationStatus + */ + @JsonCreator + public static AddressValidationStatus fromString(String name) { + return fromString(name, AddressValidationStatus.class); + } + + /** + * @return known AddressValidationStatus values + */ + public static Collection values() { + return values(AddressValidationStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Agreement.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Agreement.java new file mode 100644 index 0000000000000..b3b3bebdc0d07 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Agreement.java @@ -0,0 +1,74 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.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.v2020_05_01.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing Agreement. + */ +public interface Agreement extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the acceptanceMode value. + */ + AcceptanceMode acceptanceMode(); + + /** + * @return the agreementLink value. + */ + String agreementLink(); + + /** + * @return the category value. + */ + Category category(); + + /** + * @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/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AgreementType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AgreementType.java new file mode 100644 index 0000000000000..8923115825a81 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AgreementType.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AgreementType. + */ +public final class AgreementType extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value EnterpriseAgreement for AgreementType. */ + public static final AgreementType ENTERPRISE_AGREEMENT = fromString("EnterpriseAgreement"); + + /** Static value MicrosoftOnlineServicesProgram for AgreementType. */ + public static final AgreementType MICROSOFT_ONLINE_SERVICES_PROGRAM = fromString("MicrosoftOnlineServicesProgram"); + + /** Static value MicrosoftPartnerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_PARTNER_AGREEMENT = fromString("MicrosoftPartnerAgreement"); + + /** + * Creates or finds a AgreementType from its string representation. + * @param name a name to look for + * @return the corresponding AgreementType + */ + @JsonCreator + public static AgreementType fromString(String name) { + return fromString(name, AgreementType.class); + } + + /** + * @return known AgreementType values + */ + public static Collection values() { + return values(AgreementType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Agreements.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Agreements.java new file mode 100644 index 0000000000000..73c19aa88690d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.AgreementsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Agreements. + */ +public interface Agreements extends HasInner { + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String agreementName); + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Amount.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Amount.java new file mode 100644 index 0000000000000..93b494d7349db --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Amount.java @@ -0,0 +1,58 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The amount. + */ +public class Amount { + /** + * The currency for the amount value. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Amount value. + */ + @JsonProperty(value = "value") + private Double value; + + /** + * Get the currency for the amount value. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get amount value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Set amount value. + * + * @param value the value value to set + * @return the Amount object itself. + */ + public Amount withValue(Double value) { + this.value = value; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AutoRenew.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AutoRenew.java new file mode 100644 index 0000000000000..27ae4e1b01329 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AutoRenew.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AutoRenew. + */ +public final class AutoRenew extends ExpandableStringEnum { + /** Static value Off for AutoRenew. */ + public static final AutoRenew OFF = fromString("Off"); + + /** Static value On for AutoRenew. */ + public static final AutoRenew ON = fromString("On"); + + /** + * Creates or finds a AutoRenew from its string representation. + * @param name a name to look for + * @return the corresponding AutoRenew + */ + @JsonCreator + public static AutoRenew fromString(String name) { + return fromString(name, AutoRenew.class); + } + + /** + * @return known AutoRenew values + */ + public static Collection values() { + return values(AutoRenew.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalance.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalance.java new file mode 100644 index 0000000000000..103d55a610589 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalance.java @@ -0,0 +1,40 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.AvailableBalanceInner; + +/** + * Type representing AvailableBalance. + */ +public interface AvailableBalance extends HasInner, HasManager { + /** + * @return the amount value. + */ + Amount amount(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalances.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalances.java new file mode 100644 index 0000000000000..4ad701e4b0375 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AvailableBalances.java @@ -0,0 +1,29 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.AvailableBalancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AvailableBalances. + */ +public interface AvailableBalances extends HasInner { + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AzurePlan.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AzurePlan.java new file mode 100644 index 0000000000000..9181aec081aee --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/AzurePlan.java @@ -0,0 +1,58 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Azure plan. + */ +public class AzurePlan { + /** + * The sku id. + */ + @JsonProperty(value = "skuId") + private String skuId; + + /** + * The sku description. + */ + @JsonProperty(value = "skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the sku id. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the sku id. + * + * @param skuId the skuId value to set + * @return the AzurePlan object itself. + */ + public AzurePlan withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the sku description. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccount.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccount.java new file mode 100644 index 0000000000000..8950dc419162b --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccount.java @@ -0,0 +1,162 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingAccountInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.EnrollmentAccountInner; + +/** + * Type representing BillingAccount. + */ +public interface BillingAccount extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the accountStatus value. + */ + AccountStatus accountStatus(); + + /** + * @return the accountType value. + */ + AccountType accountType(); + + /** + * @return the agreementType value. + */ + AgreementType agreementType(); + + /** + * @return the billingProfiles value. + */ + BillingProfilesOnExpand billingProfiles(); + + /** + * @return the departments value. + */ + List departments(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enrollmentAccounts value. + */ + List enrollmentAccounts(); + + /** + * @return the enrollmentDetails value. + */ + Enrollment enrollmentDetails(); + + /** + * @return the hasReadAccess value. + */ + Boolean hasReadAccess(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the soldTo value. + */ + AddressDetails soldTo(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a BillingAccount update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBillingProfiles, UpdateStages.WithDepartments, UpdateStages.WithDisplayName, UpdateStages.WithEnrollmentAccounts, UpdateStages.WithSoldTo { + } + + /** + * Grouping of BillingAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the billingaccount update allowing to specify BillingProfiles. + */ + interface WithBillingProfiles { + /** + * Specifies billingProfiles. + * @param billingProfiles The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand + * @return the next update stage + */ + Update withBillingProfiles(BillingProfilesOnExpand billingProfiles); + } + + /** + * The stage of the billingaccount update allowing to specify Departments. + */ + interface WithDepartments { + /** + * Specifies departments. + * @param departments The departments associated to the enrollment + * @return the next update stage + */ + Update withDepartments(List departments); + } + + /** + * The stage of the billingaccount update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The billing account name + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the billingaccount update allowing to specify EnrollmentAccounts. + */ + interface WithEnrollmentAccounts { + /** + * Specifies enrollmentAccounts. + * @param enrollmentAccounts The accounts associated to the enrollment + * @return the next update stage + */ + Update withEnrollmentAccounts(List enrollmentAccounts); + } + + /** + * The stage of the billingaccount update allowing to specify SoldTo. + */ + interface WithSoldTo { + /** + * Specifies soldTo. + * @param soldTo The address of the individual or organization that is responsible for the billing account + * @return the next update stage + */ + Update withSoldTo(AddressDetails soldTo); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccountUpdateRequest.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccountUpdateRequest.java new file mode 100644 index 0000000000000..2b1b2a02eaaca --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccountUpdateRequest.java @@ -0,0 +1,234 @@ +/** + * 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.v2020_05_01; + +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.EnrollmentAccountInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The request properties of the billing account that can be updated. + */ +@JsonFlatten +public class BillingAccountUpdateRequest { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The address of the individual or organization that is responsible for + * the billing account. + */ + @JsonProperty(value = "properties.soldTo") + private AddressDetails soldTo; + + /** + * The type of agreement. Possible values include: + * 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + * 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /** + * The current status of the billing account. Possible values include: + * 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', + * 'Terminated'. + */ + @JsonProperty(value = "properties.accountStatus", access = JsonProperty.Access.WRITE_ONLY) + private AccountStatus accountStatus; + + /** + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private BillingProfilesOnExpand billingProfiles; + + /** + * The details about the associated legacy enrollment. By default this is + * not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private Enrollment enrollmentDetails; + + /** + * The departments associated to the enrollment. + */ + @JsonProperty(value = "properties.departments") + private List departments; + + /** + * The accounts associated to the enrollment. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Indicates whether user has read access to the billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the billing account name. + * + * @param displayName the displayName value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the address of the individual or organization that is responsible for the billing account. + * + * @return the soldTo value + */ + public AddressDetails soldTo() { + return this.soldTo; + } + + /** + * Set the address of the individual or organization that is responsible for the billing account. + * + * @param soldTo the soldTo value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withSoldTo(AddressDetails soldTo) { + this.soldTo = soldTo; + return this; + } + + /** + * Get the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + * + * @return the agreementType value + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the accountType value + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated'. + * + * @return the accountStatus value + */ + public AccountStatus accountStatus() { + return this.accountStatus; + } + + /** + * Get the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the billingProfiles value + */ + public BillingProfilesOnExpand billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withBillingProfiles(BillingProfilesOnExpand billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentDetails value + */ + public Enrollment enrollmentDetails() { + return this.enrollmentDetails; + } + + /** + * Get the departments associated to the enrollment. + * + * @return the departments value + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments associated to the enrollment. + * + * @param departments the departments value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withDepartments(List departments) { + this.departments = departments; + return this; + } + + /** + * Get the accounts associated to the enrollment. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the accounts associated to the enrollment. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get indicates whether user has read access to the billing account. + * + * @return the hasReadAccess value + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccounts.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccounts.java new file mode 100644 index 0000000000000..75e541c0dcd0a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingAccounts.java @@ -0,0 +1,45 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingAccounts. + */ +public interface BillingAccounts extends HasInner { + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName); + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingFrequency.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingFrequency.java new file mode 100644 index 0000000000000..f6d7b1908431d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingFrequency.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingFrequency. + */ +public final class BillingFrequency extends ExpandableStringEnum { + /** Static value OneTime for BillingFrequency. */ + public static final BillingFrequency ONE_TIME = fromString("OneTime"); + + /** Static value Monthly for BillingFrequency. */ + public static final BillingFrequency MONTHLY = fromString("Monthly"); + + /** Static value UsageBased for BillingFrequency. */ + public static final BillingFrequency USAGE_BASED = fromString("UsageBased"); + + /** + * Creates or finds a BillingFrequency from its string representation. + * @param name a name to look for + * @return the corresponding BillingFrequency + */ + @JsonCreator + public static BillingFrequency fromString(String name) { + return fromString(name, BillingFrequency.class); + } + + /** + * @return known BillingFrequency values + */ + public static Collection values() { + return values(BillingFrequency.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriod.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriod.java new file mode 100644 index 0000000000000..85291702ff1df --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriod.java @@ -0,0 +1,54 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPeriodInner; +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.v2020_05_01.implementation.BillingManager; +import org.joda.time.LocalDate; +import java.util.List; + +/** + * Type representing BillingPeriod. + */ +public interface BillingPeriod extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the billingPeriodEndDate value. + */ + LocalDate billingPeriodEndDate(); + + /** + * @return the billingPeriodStartDate value. + */ + LocalDate billingPeriodStartDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceIds value. + */ + List invoiceIds(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriods.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriods.java new file mode 100644 index 0000000000000..23fb172ea4909 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPeriods.java @@ -0,0 +1,29 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPeriodsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPeriods. + */ +public interface BillingPeriods extends SupportsListing, HasInner { + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingPeriodName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissions.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissions.java new file mode 100644 index 0000000000000..bbe520dc4843f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissions.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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPermissionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPermissions. + */ +public interface BillingPermissions extends HasInner { + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionsAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(final String billingAccountName, final String customerName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissionsProperties.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissionsProperties.java new file mode 100644 index 0000000000000..04fa5204363ba --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPermissionsProperties.java @@ -0,0 +1,31 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPermissionsPropertiesInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.List; + +/** + * Type representing BillingPermissionsProperties. + */ +public interface BillingPermissionsProperties extends HasInner, HasManager { + /** + * @return the actions value. + */ + List actions(); + + /** + * @return the notActions value. + */ + List notActions(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfile.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfile.java new file mode 100644 index 0000000000000..f311f36e9904e --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfile.java @@ -0,0 +1,312 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingProfileInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.List; + +/** + * Type representing BillingProfile. + */ +public interface BillingProfile extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the billingRelationshipType value. + */ + BillingRelationshipType billingRelationshipType(); + + /** + * @return the billTo value. + */ + AddressDetails billTo(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the hasReadAccess value. + */ + Boolean hasReadAccess(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the indirectRelationshipInfo value. + */ + IndirectRelationshipInfo indirectRelationshipInfo(); + + /** + * @return the invoiceDay value. + */ + Integer invoiceDay(); + + /** + * @return the invoiceEmailOptIn value. + */ + Boolean invoiceEmailOptIn(); + + /** + * @return the invoiceSections value. + */ + InvoiceSectionsOnExpand invoiceSections(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the poNumber value. + */ + String poNumber(); + + /** + * @return the spendingLimit value. + */ + SpendingLimit spendingLimit(); + + /** + * @return the status value. + */ + BillingProfileStatus status(); + + /** + * @return the statusReasonCode value. + */ + StatusReasonCode statusReasonCode(); + + /** + * @return the systemId value. + */ + String systemId(); + + /** + * @return the targetClouds value. + */ + List targetClouds(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BillingProfile definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of BillingProfile definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BillingProfile definition. + */ + interface Blank extends WithBillingAccount { + } + + /** + * The stage of the billingprofile definition allowing to specify BillingAccount. + */ + interface WithBillingAccount { + /** + * Specifies billingAccountName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @return the next definition stage + */ + WithCreate withExistingBillingAccount(String billingAccountName); + } + + /** + * The stage of the billingprofile definition allowing to specify BillTo. + */ + interface WithBillTo { + /** + * Specifies billTo. + * @param billTo Billing address + * @return the next definition stage + */ + WithCreate withBillTo(AddressDetails billTo); + } + + /** + * The stage of the billingprofile definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the billing profile + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the billingprofile definition allowing to specify EnabledAzurePlans. + */ + interface WithEnabledAzurePlans { + /** + * Specifies enabledAzurePlans. + * @param enabledAzurePlans Information about the enabled azure plans + * @return the next definition stage + */ + WithCreate withEnabledAzurePlans(List enabledAzurePlans); + } + + /** + * The stage of the billingprofile definition allowing to specify InvoiceEmailOptIn. + */ + interface WithInvoiceEmailOptIn { + /** + * Specifies invoiceEmailOptIn. + * @param invoiceEmailOptIn Flag controlling whether the invoices for the billing profile are sent through email + * @return the next definition stage + */ + WithCreate withInvoiceEmailOptIn(Boolean invoiceEmailOptIn); + } + + /** + * The stage of the billingprofile definition allowing to specify InvoiceSections. + */ + interface WithInvoiceSections { + /** + * Specifies invoiceSections. + * @param invoiceSections The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand + * @return the next definition stage + */ + WithCreate withInvoiceSections(InvoiceSectionsOnExpand invoiceSections); + } + + /** + * The stage of the billingprofile definition allowing to specify PoNumber. + */ + interface WithPoNumber { + /** + * Specifies poNumber. + * @param poNumber The purchase order name that will appear on the invoices generated for the billing profile + * @return the next definition stage + */ + WithCreate withPoNumber(String poNumber); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithBillTo, DefinitionStages.WithDisplayName, DefinitionStages.WithEnabledAzurePlans, DefinitionStages.WithInvoiceEmailOptIn, DefinitionStages.WithInvoiceSections, DefinitionStages.WithPoNumber { + } + } + /** + * The template for a BillingProfile update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBillTo, UpdateStages.WithDisplayName, UpdateStages.WithEnabledAzurePlans, UpdateStages.WithInvoiceEmailOptIn, UpdateStages.WithInvoiceSections, UpdateStages.WithPoNumber { + } + + /** + * Grouping of BillingProfile update stages. + */ + interface UpdateStages { + /** + * The stage of the billingprofile update allowing to specify BillTo. + */ + interface WithBillTo { + /** + * Specifies billTo. + * @param billTo Billing address + * @return the next update stage + */ + Update withBillTo(AddressDetails billTo); + } + + /** + * The stage of the billingprofile update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the billing profile + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the billingprofile update allowing to specify EnabledAzurePlans. + */ + interface WithEnabledAzurePlans { + /** + * Specifies enabledAzurePlans. + * @param enabledAzurePlans Information about the enabled azure plans + * @return the next update stage + */ + Update withEnabledAzurePlans(List enabledAzurePlans); + } + + /** + * The stage of the billingprofile update allowing to specify InvoiceEmailOptIn. + */ + interface WithInvoiceEmailOptIn { + /** + * Specifies invoiceEmailOptIn. + * @param invoiceEmailOptIn Flag controlling whether the invoices for the billing profile are sent through email + * @return the next update stage + */ + Update withInvoiceEmailOptIn(Boolean invoiceEmailOptIn); + } + + /** + * The stage of the billingprofile update allowing to specify InvoiceSections. + */ + interface WithInvoiceSections { + /** + * Specifies invoiceSections. + * @param invoiceSections The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand + * @return the next update stage + */ + Update withInvoiceSections(InvoiceSectionsOnExpand invoiceSections); + } + + /** + * The stage of the billingprofile update allowing to specify PoNumber. + */ + interface WithPoNumber { + /** + * Specifies poNumber. + * @param poNumber The purchase order name that will appear on the invoices generated for the billing profile + * @return the next update stage + */ + Update withPoNumber(String poNumber); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileCreationRequest.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileCreationRequest.java new file mode 100644 index 0000000000000..04c6493dac026 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileCreationRequest.java @@ -0,0 +1,151 @@ +/** + * 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.v2020_05_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The request parameters for creating a new billing profile. + */ +public class BillingProfileCreationRequest { + /** + * The name of the billing profile. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The purchase order name that will appear on the invoices generated for + * the billing profile. + */ + @JsonProperty(value = "poNumber") + private String poNumber; + + /** + * The address of the individual or organization that is responsible for + * the billing profile. + */ + @JsonProperty(value = "billTo") + private AddressDetails billTo; + + /** + * Flag controlling whether the invoices for the billing profile are sent + * through email. + */ + @JsonProperty(value = "invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /** + * Enabled azure plans for the billing profile. + */ + @JsonProperty(value = "enabledAzurePlans") + private List enabledAzurePlans; + + /** + * Get the name of the billing profile. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the billing profile. + * + * @param displayName the displayName value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the purchase order name that will appear on the invoices generated for the billing profile. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set the purchase order name that will appear on the invoices generated for the billing profile. + * + * @param poNumber the poNumber value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get the address of the individual or organization that is responsible for the billing profile. + * + * @return the billTo value + */ + public AddressDetails billTo() { + return this.billTo; + } + + /** + * Set the address of the individual or organization that is responsible for the billing profile. + * + * @param billTo the billTo value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withBillTo(AddressDetails billTo) { + this.billTo = billTo; + return this; + } + + /** + * Get flag controlling whether the invoices for the billing profile are sent through email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set flag controlling whether the invoices for the billing profile are sent through email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get enabled azure plans for the billing profile. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set enabled azure plans for the billing profile. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileSpendingLimit.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileSpendingLimit.java new file mode 100644 index 0000000000000..b2d711dc8ee49 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileSpendingLimit.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileSpendingLimit. + */ +public final class BillingProfileSpendingLimit extends ExpandableStringEnum { + /** Static value Off for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit OFF = fromString("Off"); + + /** Static value On for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit ON = fromString("On"); + + /** + * Creates or finds a BillingProfileSpendingLimit from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileSpendingLimit + */ + @JsonCreator + public static BillingProfileSpendingLimit fromString(String name) { + return fromString(name, BillingProfileSpendingLimit.class); + } + + /** + * @return known BillingProfileSpendingLimit values + */ + public static Collection values() { + return values(BillingProfileSpendingLimit.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatus.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatus.java new file mode 100644 index 0000000000000..dca2cc4529284 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatus.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileStatus. + */ +public final class BillingProfileStatus extends ExpandableStringEnum { + /** Static value Active for BillingProfileStatus. */ + public static final BillingProfileStatus ACTIVE = fromString("Active"); + + /** Static value Disabled for BillingProfileStatus. */ + public static final BillingProfileStatus DISABLED = fromString("Disabled"); + + /** Static value Warned for BillingProfileStatus. */ + public static final BillingProfileStatus WARNED = fromString("Warned"); + + /** + * Creates or finds a BillingProfileStatus from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileStatus + */ + @JsonCreator + public static BillingProfileStatus fromString(String name) { + return fromString(name, BillingProfileStatus.class); + } + + /** + * @return known BillingProfileStatus values + */ + public static Collection values() { + return values(BillingProfileStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatusReasonCode.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatusReasonCode.java new file mode 100644 index 0000000000000..d133939c74d90 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfileStatusReasonCode.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileStatusReasonCode. + */ +public final class BillingProfileStatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a BillingProfileStatusReasonCode from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileStatusReasonCode + */ + @JsonCreator + public static BillingProfileStatusReasonCode fromString(String name) { + return fromString(name, BillingProfileStatusReasonCode.class); + } + + /** + * @return known BillingProfileStatusReasonCode values + */ + public static Collection values() { + return values(BillingProfileStatusReasonCode.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfiles.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfiles.java new file mode 100644 index 0000000000000..164b143e22a59 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfiles.java @@ -0,0 +1,39 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingProfilesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingProfiles. + */ +public interface BillingProfiles extends SupportsCreating, HasInner { + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName); + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesCreateOrUpdateHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..bfa6db5e4ea20 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesCreateOrUpdateHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class BillingProfilesCreateOrUpdateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingProfilesCreateOrUpdateHeaders object itself. + */ + public BillingProfilesCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BillingProfilesCreateOrUpdateHeaders object itself. + */ + public BillingProfilesCreateOrUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesOnExpand.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesOnExpand.java new file mode 100644 index 0000000000000..0442856dcbe58 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProfilesOnExpand.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.v2020_05_01; + +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingProfileInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + */ +public class BillingProfilesOnExpand { + /** + * Indicates whether there are more billing profiles than the ones listed + * in this collection. The collection lists a maximum of 50 billing + * profiles. To get all billing profiles, use the list billing profiles + * API. + */ + @JsonProperty(value = "hasMoreResults", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasMoreResults; + + /** + * The billing profiles associated with the billing account. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get indicates whether there are more billing profiles than the ones listed in this collection. The collection lists a maximum of 50 billing profiles. To get all billing profiles, use the list billing profiles API. + * + * @return the hasMoreResults value + */ + public Boolean hasMoreResults() { + return this.hasMoreResults; + } + + /** + * Get the billing profiles associated with the billing account. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the billing profiles associated with the billing account. + * + * @param value the value value to set + * @return the BillingProfilesOnExpand object itself. + */ + public BillingProfilesOnExpand withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProperty.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProperty.java new file mode 100644 index 0000000000000..26511433bb79b --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingProperty.java @@ -0,0 +1,120 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPropertyInner; + +/** + * Type representing BillingProperty. + */ +public interface BillingProperty extends HasInner, HasManager { + /** + * @return the accountAdminNotificationEmailAddress value. + */ + String accountAdminNotificationEmailAddress(); + + /** + * @return the billingAccountDisplayName value. + */ + String billingAccountDisplayName(); + + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileSpendingLimit value. + */ + BillingProfileSpendingLimit billingProfileSpendingLimit(); + + /** + * @return the billingProfileStatus value. + */ + BillingProfileStatus billingProfileStatus(); + + /** + * @return the billingProfileStatusReasonCode value. + */ + BillingProfileStatusReasonCode billingProfileStatusReasonCode(); + + /** + * @return the billingTenantId value. + */ + String billingTenantId(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the isAccountAdmin value. + */ + Boolean isAccountAdmin(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the productId value. + */ + String productId(); + + /** + * @return the productName value. + */ + String productName(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPropertys.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPropertys.java new file mode 100644 index 0000000000000..58cad34ccd847 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingPropertys.java @@ -0,0 +1,35 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingPropertysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPropertys. + */ +public interface BillingPropertys extends HasInner { + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRelationshipType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRelationshipType.java new file mode 100644 index 0000000000000..71e5640bfbade --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRelationshipType.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingRelationshipType. + */ +public final class BillingRelationshipType extends ExpandableStringEnum { + /** Static value Direct for BillingRelationshipType. */ + public static final BillingRelationshipType DIRECT = fromString("Direct"); + + /** Static value IndirectCustomer for BillingRelationshipType. */ + public static final BillingRelationshipType INDIRECT_CUSTOMER = fromString("IndirectCustomer"); + + /** Static value IndirectPartner for BillingRelationshipType. */ + public static final BillingRelationshipType INDIRECT_PARTNER = fromString("IndirectPartner"); + + /** Static value CSPPartner for BillingRelationshipType. */ + public static final BillingRelationshipType CSPPARTNER = fromString("CSPPartner"); + + /** + * Creates or finds a BillingRelationshipType from its string representation. + * @param name a name to look for + * @return the corresponding BillingRelationshipType + */ + @JsonCreator + public static BillingRelationshipType fromString(String name) { + return fromString(name, BillingRelationshipType.class); + } + + /** + * @return known BillingRelationshipType values + */ + public static Collection values() { + return values(BillingRelationshipType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignment.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignment.java new file mode 100644 index 0000000000000..159d9abefbffa --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignment.java @@ -0,0 +1,87 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingRoleAssignmentInner; +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.v2020_05_01.implementation.BillingManager; + +/** + * Type representing BillingRoleAssignment. + */ +public interface BillingRoleAssignment extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the createdByPrincipalId value. + */ + String createdByPrincipalId(); + + /** + * @return the createdByPrincipalTenantId value. + */ + String createdByPrincipalTenantId(); + + /** + * @return the createdByUserEmailAddress value. + */ + String createdByUserEmailAddress(); + + /** + * @return the createdOn value. + */ + String createdOn(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the principalId value. + */ + String principalId(); + + /** + * @return the principalTenantId value. + */ + String principalTenantId(); + + /** + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userAuthenticationType value. + */ + String userAuthenticationType(); + + /** + * @return the userEmailAddress value. + */ + String userEmailAddress(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignments.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignments.java new file mode 100644 index 0000000000000..69945abe00206 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleAssignments.java @@ -0,0 +1,116 @@ +/** + * 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.v2020_05_01; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingRoleAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleAssignments. + */ +public interface BillingRoleAssignments extends HasInner { + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinition.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinition.java new file mode 100644 index 0000000000000..8fc248cecc6d5 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinition.java @@ -0,0 +1,53 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingRoleDefinitionInner; +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.v2020_05_01.implementation.BillingManager; +import java.util.List; + +/** + * Type representing BillingRoleDefinition. + */ +public interface BillingRoleDefinition extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the permissions value. + */ + List permissions(); + + /** + * @return the roleName value. + */ + String roleName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinitions.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinitions.java new file mode 100644 index 0000000000000..e1537f2a895f6 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingRoleDefinitions.java @@ -0,0 +1,82 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingRoleDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleDefinitions. + */ +public interface BillingRoleDefinitions extends HasInner { + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName); + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName); + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscription.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscription.java new file mode 100644 index 0000000000000..51b4d62032f73 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscription.java @@ -0,0 +1,161 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingSubscriptionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.UUID; + +/** + * Type representing BillingSubscription. + */ +public interface BillingSubscription extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastMonthCharges value. + */ + Amount lastMonthCharges(); + + /** + * @return the monthToDateCharges value. + */ + Amount monthToDateCharges(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reseller value. + */ + Reseller reseller(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the subscriptionBillingStatus value. + */ + BillingSubscriptionStatusType subscriptionBillingStatus(); + + /** + * @return the subscriptionId value. + */ + UUID subscriptionId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a BillingSubscription update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCostCenter, UpdateStages.WithSkuId, UpdateStages.WithSubscriptionBillingStatus { + } + + /** + * Grouping of BillingSubscription update stages. + */ + interface UpdateStages { + /** + * The stage of the billingsubscription update allowing to specify CostCenter. + */ + interface WithCostCenter { + /** + * Specifies costCenter. + * @param costCenter The cost center applied to the subscription + * @return the next update stage + */ + Update withCostCenter(String costCenter); + } + + /** + * The stage of the billingsubscription update allowing to specify SkuId. + */ + interface WithSkuId { + /** + * Specifies skuId. + * @param skuId The sku ID of the Azure plan for the subscription + * @return the next update stage + */ + Update withSkuId(String skuId); + } + + /** + * The stage of the billingsubscription update allowing to specify SubscriptionBillingStatus. + */ + interface WithSubscriptionBillingStatus { + /** + * Specifies subscriptionBillingStatus. + * @param subscriptionBillingStatus The current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning' + * @return the next update stage + */ + Update withSubscriptionBillingStatus(BillingSubscriptionStatusType subscriptionBillingStatus); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionStatusType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionStatusType.java new file mode 100644 index 0000000000000..696d6a057a913 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionStatusType.java @@ -0,0 +1,50 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingSubscriptionStatusType. + */ +public final class BillingSubscriptionStatusType extends ExpandableStringEnum { + /** Static value Active for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType ACTIVE = fromString("Active"); + + /** Static value Inactive for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType INACTIVE = fromString("Inactive"); + + /** Static value Abandoned for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType ABANDONED = fromString("Abandoned"); + + /** Static value Deleted for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType DELETED = fromString("Deleted"); + + /** Static value Warning for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType WARNING = fromString("Warning"); + + /** + * Creates or finds a BillingSubscriptionStatusType from its string representation. + * @param name a name to look for + * @return the corresponding BillingSubscriptionStatusType + */ + @JsonCreator + public static BillingSubscriptionStatusType fromString(String name) { + return fromString(name, BillingSubscriptionStatusType.class); + } + + /** + * @return known BillingSubscriptionStatusType values + */ + public static Collection values() { + return values(BillingSubscriptionStatusType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptions.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptions.java new file mode 100644 index 0000000000000..8270ea74b0c02 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptions.java @@ -0,0 +1,88 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingSubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingSubscriptions. + */ +public interface BillingSubscriptions extends HasInner { + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable moveAsync(String billingAccountName, String destinationInvoiceSectionId); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateMoveAsync(String billingAccountName, String destinationInvoiceSectionId); + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(final String billingAccountName, final String customerName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionsMoveHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionsMoveHeaders.java new file mode 100644 index 0000000000000..e319e4b94433a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/BillingSubscriptionsMoveHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Move operation. + */ +public class BillingSubscriptionsMoveHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingSubscriptionsMoveHeaders object itself. + */ + public BillingSubscriptionsMoveHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BillingSubscriptionsMoveHeaders object itself. + */ + public BillingSubscriptionsMoveHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Category.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Category.java new file mode 100644 index 0000000000000..f84f97de3a8f7 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Category.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Category. + */ +public final class Category extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for Category. */ + public static final Category MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value AffiliatePurchaseTerms for Category. */ + public static final Category AFFILIATE_PURCHASE_TERMS = fromString("AffiliatePurchaseTerms"); + + /** Static value Other for Category. */ + public static final Category OTHER = fromString("Other"); + + /** + * Creates or finds a Category from its string representation. + * @param name a name to look for + * @return the corresponding Category + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * @return known Category values + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customer.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customer.java new file mode 100644 index 0000000000000..d8122c02230d3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customer.java @@ -0,0 +1,61 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.CustomerInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.List; + +/** + * Type representing Customer. + */ +public interface Customer extends HasInner, HasManager { + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resellers value. + */ + List resellers(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/CustomerPolicy.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/CustomerPolicy.java new file mode 100644 index 0000000000000..e41a0a709802c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/CustomerPolicy.java @@ -0,0 +1,40 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.CustomerPolicyInner; + +/** + * Type representing CustomerPolicy. + */ +public interface CustomerPolicy extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the viewCharges value. + */ + ViewCharges viewCharges(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customers.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customers.java new file mode 100644 index 0000000000000..f54dd331183d3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Customers.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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.CustomersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Customers. + */ +public interface Customers extends HasInner { + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String customerName); + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Department.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Department.java new file mode 100644 index 0000000000000..2cf7ac82159d0 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Department.java @@ -0,0 +1,127 @@ +/** + * 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.v2020_05_01; + +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.EnrollmentAccountInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A department. + */ +@JsonFlatten +public class Department extends ProxyResource { + /** + * The name of the department. + */ + @JsonProperty(value = "properties.departmentName") + private String departmentName; + + /** + * The cost center associated with the department. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The status of the department. + */ + @JsonProperty(value = "properties.status") + private String status; + + /** + * Associated enrollment accounts. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Get the name of the department. + * + * @return the departmentName value + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Set the name of the department. + * + * @param departmentName the departmentName value to set + * @return the Department object itself. + */ + public Department withDepartmentName(String departmentName) { + this.departmentName = departmentName; + return this; + } + + /** + * Get the cost center associated with the department. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the department. + * + * @param costCenter the costCenter value to set + * @return the Department object itself. + */ + public Department withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the status of the department. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the department. + * + * @param status the status value to set + * @return the Department object itself. + */ + public Department withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get associated enrollment accounts. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set associated enrollment accounts. By default this is not populated, unless it's specified in $expand. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the Department object itself. + */ + public Department withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Document.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Document.java new file mode 100644 index 0000000000000..f2246aa074982 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Document.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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a document. + */ +public class Document { + /** + * The type of the document. Possible values include: 'Invoice', + * 'VoidNote', 'TaxReceipt', 'CreditNote'. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private DocumentType kind; + + /** + * Document URL. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * The source of the document. ENF for Brazil and DRS for rest of the + * world. Possible values include: 'DRS', 'ENF'. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private DocumentSource source; + + /** + * Get the type of the document. Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote'. + * + * @return the kind value + */ + public DocumentType kind() { + return this.kind; + } + + /** + * Get document URL. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Get the source of the document. ENF for Brazil and DRS for rest of the world. Possible values include: 'DRS', 'ENF'. + * + * @return the source value + */ + public DocumentSource source() { + return this.source; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentSource.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentSource.java new file mode 100644 index 0000000000000..59ebd30ba4a65 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentSource.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DocumentSource. + */ +public final class DocumentSource extends ExpandableStringEnum { + /** Static value DRS for DocumentSource. */ + public static final DocumentSource DRS = fromString("DRS"); + + /** Static value ENF for DocumentSource. */ + public static final DocumentSource ENF = fromString("ENF"); + + /** + * Creates or finds a DocumentSource from its string representation. + * @param name a name to look for + * @return the corresponding DocumentSource + */ + @JsonCreator + public static DocumentSource fromString(String name) { + return fromString(name, DocumentSource.class); + } + + /** + * @return known DocumentSource values + */ + public static Collection values() { + return values(DocumentSource.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentType.java new file mode 100644 index 0000000000000..9a3a1c58c8733 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DocumentType.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DocumentType. + */ +public final class DocumentType extends ExpandableStringEnum { + /** Static value Invoice for DocumentType. */ + public static final DocumentType INVOICE = fromString("Invoice"); + + /** Static value VoidNote for DocumentType. */ + public static final DocumentType VOID_NOTE = fromString("VoidNote"); + + /** Static value TaxReceipt for DocumentType. */ + public static final DocumentType TAX_RECEIPT = fromString("TaxReceipt"); + + /** Static value CreditNote for DocumentType. */ + public static final DocumentType CREDIT_NOTE = fromString("CreditNote"); + + /** + * Creates or finds a DocumentType from its string representation. + * @param name a name to look for + * @return the corresponding DocumentType + */ + @JsonCreator + public static DocumentType fromString(String name) { + return fromString(name, DocumentType.class); + } + + /** + * @return known DocumentType values + */ + public static Collection values() { + return values(DocumentType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DownloadUrl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DownloadUrl.java new file mode 100644 index 0000000000000..bf1263200e0e8 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/DownloadUrl.java @@ -0,0 +1,31 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.DownloadUrlInner; +import org.joda.time.DateTime; + +/** + * Type representing DownloadUrl. + */ +public interface DownloadUrl extends HasInner, HasManager { + /** + * @return the expiryTime value. + */ + DateTime expiryTime(); + + /** + * @return the url value. + */ + String url(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Enrollment.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Enrollment.java new file mode 100644 index 0000000000000..d33b6620ed1fd --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Enrollment.java @@ -0,0 +1,175 @@ +/** + * 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.v2020_05_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an enrollment. + */ +public class Enrollment { + /** + * The start date of the enrollment. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * The end date of the enrollment. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The billing currency for the enrollment. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The channel type of the enrollment. + */ + @JsonProperty(value = "channel", access = JsonProperty.Access.WRITE_ONLY) + private String channel; + + /** + * The policies for Enterprise Agreement enrollments. + */ + @JsonProperty(value = "policies", access = JsonProperty.Access.WRITE_ONLY) + private EnrollmentPolicies policies; + + /** + * The language for the enrollment. + */ + @JsonProperty(value = "language", access = JsonProperty.Access.WRITE_ONLY) + private String language; + + /** + * The country code of the enrollment. + */ + @JsonProperty(value = "countryCode", access = JsonProperty.Access.WRITE_ONLY) + private String countryCode; + + /** + * The current status of the enrollment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The billing cycle for the enrollment. + */ + @JsonProperty(value = "billingCycle", access = JsonProperty.Access.WRITE_ONLY) + private String billingCycle; + + /** + * Get the start date of the enrollment. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment. + * + * @param startDate the startDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment. + * + * @param endDate the endDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the billing currency for the enrollment. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the channel type of the enrollment. + * + * @return the channel value + */ + public String channel() { + return this.channel; + } + + /** + * Get the policies for Enterprise Agreement enrollments. + * + * @return the policies value + */ + public EnrollmentPolicies policies() { + return this.policies; + } + + /** + * Get the language for the enrollment. + * + * @return the language value + */ + public String language() { + return this.language; + } + + /** + * Get the country code of the enrollment. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Get the current status of the enrollment. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the billing cycle for the enrollment. + * + * @return the billingCycle value + */ + public String billingCycle() { + return this.billingCycle; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountContext.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountContext.java new file mode 100644 index 0000000000000..082929b803fbf --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountContext.java @@ -0,0 +1,122 @@ +/** + * 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.v2020_05_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The enrollment account context. + */ +public class EnrollmentAccountContext { + /** + * The cost center associated with the enrollment account. + */ + @JsonProperty(value = "costCenter") + private String costCenter; + + /** + * The start date of the enrollment account. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * The end date of the enrollment account. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The ID of the enrollment account. + */ + @JsonProperty(value = "enrollmentAccountName") + private String enrollmentAccountName; + + /** + * Get the cost center associated with the enrollment account. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the enrollment account. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the start date of the enrollment account. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment account. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment account. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment account. + * + * @param endDate the endDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the ID of the enrollment account. + * + * @return the enrollmentAccountName value + */ + public String enrollmentAccountName() { + return this.enrollmentAccountName; + } + + /** + * Set the ID of the enrollment account. + * + * @param enrollmentAccountName the enrollmentAccountName value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withEnrollmentAccountName(String enrollmentAccountName) { + this.enrollmentAccountName = enrollmentAccountName; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountSummary.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountSummary.java new file mode 100644 index 0000000000000..532856118e06d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccountSummary.java @@ -0,0 +1,40 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.EnrollmentAccountSummaryInner; + +/** + * Type representing EnrollmentAccountSummary. + */ +public interface EnrollmentAccountSummary extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the principalName value. + */ + String principalName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccounts.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccounts.java new file mode 100644 index 0000000000000..077d26cbbbaf3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentAccounts.java @@ -0,0 +1,36 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.EnrollmentAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EnrollmentAccounts. + */ +public interface EnrollmentAccounts extends HasInner { + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String name); + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentPolicies.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentPolicies.java new file mode 100644 index 0000000000000..bf27fedaa8352 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/EnrollmentPolicies.java @@ -0,0 +1,80 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policies for Enterprise Agreement enrollments. + */ +public class EnrollmentPolicies { + /** + * The policy that controls whether Account Owners can view charges. + */ + @JsonProperty(value = "accountOwnerViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean accountOwnerViewCharges; + + /** + * The policy that controls whether Department Administrators can view + * charges. + */ + @JsonProperty(value = "departmentAdminViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean departmentAdminViewCharges; + + /** + * The policy that controls whether Azure marketplace purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "marketplacesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean marketplacesEnabled; + + /** + * The policy that controls whether Azure reservation purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "reservedInstancesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean reservedInstancesEnabled; + + /** + * Get the policy that controls whether Account Owners can view charges. + * + * @return the accountOwnerViewCharges value + */ + public Boolean accountOwnerViewCharges() { + return this.accountOwnerViewCharges; + } + + /** + * Get the policy that controls whether Department Administrators can view charges. + * + * @return the departmentAdminViewCharges value + */ + public Boolean departmentAdminViewCharges() { + return this.departmentAdminViewCharges; + } + + /** + * Get the policy that controls whether Azure marketplace purchases are allowed in the enrollment. + * + * @return the marketplacesEnabled value + */ + public Boolean marketplacesEnabled() { + return this.marketplacesEnabled; + } + + /** + * Get the policy that controls whether Azure reservation purchases are allowed in the enrollment. + * + * @return the reservedInstancesEnabled value + */ + public Boolean reservedInstancesEnabled() { + return this.reservedInstancesEnabled; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorDetails.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorDetails.java new file mode 100644 index 0000000000000..4dc257cf83df7 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorDetails.java @@ -0,0 +1,78 @@ +/** + * 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.v2020_05_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * The sub details of the error. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get the sub details of the error. + * + * @return the details value + */ + public List details() { + return this.details; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponse.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponse.java new file mode 100644 index 0000000000000..25ece1e59ca40 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponseException.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponseException.java new file mode 100644 index 0000000000000..5d453171ed24e --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorSubDetailsItem.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorSubDetailsItem.java new file mode 100644 index 0000000000000..3944b32d98589 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ErrorSubDetailsItem.java @@ -0,0 +1,62 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ErrorSubDetailsItem model. + */ +public class ErrorSubDetailsItem { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/IndirectRelationshipInfo.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/IndirectRelationshipInfo.java new file mode 100644 index 0000000000000..897c6650bbed9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/IndirectRelationshipInfo.java @@ -0,0 +1,98 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The billing profile details of the partner of the customer for an indirect + * motion. + */ +public class IndirectRelationshipInfo { + /** + * The billing account name of the partner or the customer for an indirect + * motion. + */ + @JsonProperty(value = "billingAccountName") + private String billingAccountName; + + /** + * The billing profile name of the partner or the customer for an indirect + * motion. + */ + @JsonProperty(value = "billingProfileName") + private String billingProfileName; + + /** + * The display name of the partner or customer for an indirect motion. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the billing account name of the partner or the customer for an indirect motion. + * + * @return the billingAccountName value + */ + public String billingAccountName() { + return this.billingAccountName; + } + + /** + * Set the billing account name of the partner or the customer for an indirect motion. + * + * @param billingAccountName the billingAccountName value to set + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withBillingAccountName(String billingAccountName) { + this.billingAccountName = billingAccountName; + return this; + } + + /** + * Get the billing profile name of the partner or the customer for an indirect motion. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Set the billing profile name of the partner or the customer for an indirect motion. + * + * @param billingProfileName the billingProfileName value to set + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withBillingProfileName(String billingProfileName) { + this.billingProfileName = billingProfileName; + return this; + } + + /** + * Get the display name of the partner or customer for an indirect motion. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the partner or customer for an indirect motion. + * + * @param displayName the displayName value to set + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instruction.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instruction.java new file mode 100644 index 0000000000000..3eea06324ff01 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instruction.java @@ -0,0 +1,169 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InstructionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Instruction. + */ +public interface Instruction extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the amount value. + */ + double amount(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Instruction definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingProfile, DefinitionStages.WithAmount, DefinitionStages.WithEndDate, DefinitionStages.WithStartDate, DefinitionStages.WithCreate { + } + + /** + * Grouping of Instruction definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Instruction definition. + */ + interface Blank extends WithBillingProfile { + } + + /** + * The stage of the instruction definition allowing to specify BillingProfile. + */ + interface WithBillingProfile { + /** + * Specifies billingAccountName, billingProfileName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @param billingProfileName The ID that uniquely identifies a billing profile + * @return the next definition stage + */ + WithAmount withExistingBillingProfile(String billingAccountName, String billingProfileName); + } + + /** + * The stage of the instruction definition allowing to specify Amount. + */ + interface WithAmount { + /** + * Specifies amount. + * @param amount The amount budgeted for this billing instruction + * @return the next definition stage + */ + WithEndDate withAmount(double amount); + } + + /** + * The stage of the instruction definition allowing to specify EndDate. + */ + interface WithEndDate { + /** + * Specifies endDate. + * @param endDate The date this billing instruction is no longer in effect + * @return the next definition stage + */ + WithStartDate withEndDate(DateTime endDate); + } + + /** + * The stage of the instruction definition allowing to specify StartDate. + */ + interface WithStartDate { + /** + * Specifies startDate. + * @param startDate The date this billing instruction goes into effect + * @return the next definition stage + */ + WithCreate withStartDate(DateTime startDate); + } + + /** + * The stage of the instruction definition allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The date this billing instruction was created + * @return the next definition stage + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCreationDate { + } + } + /** + * The template for a Instruction update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCreationDate { + } + + /** + * Grouping of Instruction update stages. + */ + interface UpdateStages { + /** + * The stage of the instruction update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The date this billing instruction was created + * @return the next update stage + */ + Update withCreationDate(DateTime creationDate); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instructions.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instructions.java new file mode 100644 index 0000000000000..2f75e501c1dae --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Instructions.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InstructionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Instructions. + */ +public interface Instructions extends SupportsCreating, HasInner { + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String instructionName); + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoice.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoice.java new file mode 100644 index 0000000000000..b7c0f61c71f99 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoice.java @@ -0,0 +1,165 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoiceInner; +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.v2020_05_01.implementation.BillingManager; +import java.util.List; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Invoice. + */ +public interface Invoice extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the amountDue value. + */ + Amount amountDue(); + + /** + * @return the azurePrepaymentApplied value. + */ + Amount azurePrepaymentApplied(); + + /** + * @return the billedAmount value. + */ + Amount billedAmount(); + + /** + * @return the billedDocumentId value. + */ + String billedDocumentId(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the creditAmount value. + */ + Amount creditAmount(); + + /** + * @return the creditForDocumentId value. + */ + String creditForDocumentId(); + + /** + * @return the documents value. + */ + List documents(); + + /** + * @return the documentType value. + */ + InvoiceDocumentType documentType(); + + /** + * @return the dueDate value. + */ + DateTime dueDate(); + + /** + * @return the freeAzureCreditApplied value. + */ + Amount freeAzureCreditApplied(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceDate value. + */ + DateTime invoiceDate(); + + /** + * @return the invoicePeriodEndDate value. + */ + DateTime invoicePeriodEndDate(); + + /** + * @return the invoicePeriodStartDate value. + */ + DateTime invoicePeriodStartDate(); + + /** + * @return the invoiceType value. + */ + InvoiceType invoiceType(); + + /** + * @return the isMonthlyInvoice value. + */ + Boolean isMonthlyInvoice(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the payments value. + */ + List payments(); + + /** + * @return the purchaseOrderNumber value. + */ + String purchaseOrderNumber(); + + /** + * @return the rebillDetails value. + */ + Map rebillDetails(); + + /** + * @return the status value. + */ + InvoiceStatus status(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * @return the taxAmount value. + */ + Amount taxAmount(); + + /** + * @return the totalAmount value. + */ + Amount totalAmount(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceDocumentType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceDocumentType.java new file mode 100644 index 0000000000000..8be29474ea420 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceDocumentType.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceDocumentType. + */ +public final class InvoiceDocumentType extends ExpandableStringEnum { + /** Static value Invoice for InvoiceDocumentType. */ + public static final InvoiceDocumentType INVOICE = fromString("Invoice"); + + /** Static value CreditNote for InvoiceDocumentType. */ + public static final InvoiceDocumentType CREDIT_NOTE = fromString("CreditNote"); + + /** + * Creates or finds a InvoiceDocumentType from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceDocumentType + */ + @JsonCreator + public static InvoiceDocumentType fromString(String name) { + return fromString(name, InvoiceDocumentType.class); + } + + /** + * @return known InvoiceDocumentType values + */ + public static Collection values() { + return values(InvoiceDocumentType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSection.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSection.java new file mode 100644 index 0000000000000..a7db6b1116bc0 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSection.java @@ -0,0 +1,162 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoiceSectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import java.util.Map; + +/** + * Type representing InvoiceSection. + */ +public interface InvoiceSection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the labels value. + */ + Map labels(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the state value. + */ + InvoiceSectionState state(); + + /** + * @return the systemId value. + */ + String systemId(); + + /** + * @return the targetCloud value. + */ + TargetCloud targetCloud(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the InvoiceSection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingProfile, DefinitionStages.WithCreate { + } + + /** + * Grouping of InvoiceSection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InvoiceSection definition. + */ + interface Blank extends WithBillingProfile { + } + + /** + * The stage of the invoicesection definition allowing to specify BillingProfile. + */ + interface WithBillingProfile { + /** + * Specifies billingAccountName, billingProfileName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @param billingProfileName The ID that uniquely identifies a billing profile + * @return the next definition stage + */ + WithCreate withExistingBillingProfile(String billingAccountName, String billingProfileName); + } + + /** + * The stage of the invoicesection definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the invoice section + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the invoicesection definition allowing to specify Labels. + */ + interface WithLabels { + /** + * Specifies labels. + * @param labels Dictionary of metadata associated with the invoice section + * @return the next definition stage + */ + WithCreate withLabels(Map labels); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDisplayName, DefinitionStages.WithLabels { + } + } + /** + * The template for a InvoiceSection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisplayName, UpdateStages.WithLabels { + } + + /** + * Grouping of InvoiceSection update stages. + */ + interface UpdateStages { + /** + * The stage of the invoicesection update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the invoice section + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the invoicesection update allowing to specify Labels. + */ + interface WithLabels { + /** + * Specifies labels. + * @param labels Dictionary of metadata associated with the invoice section + * @return the next update stage + */ + Update withLabels(Map labels); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionCreationRequest.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionCreationRequest.java new file mode 100644 index 0000000000000..417bb4efc9780 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionCreationRequest.java @@ -0,0 +1,43 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the invoice section. + */ +public class InvoiceSectionCreationRequest { + /** + * The name of the invoice section. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name of the invoice section. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the invoice section. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionCreationRequest object itself. + */ + public InvoiceSectionCreationRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionState.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionState.java new file mode 100644 index 0000000000000..6e8fbc9a50361 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionState.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceSectionState. + */ +public final class InvoiceSectionState extends ExpandableStringEnum { + /** Static value Active for InvoiceSectionState. */ + public static final InvoiceSectionState ACTIVE = fromString("Active"); + + /** Static value Restricted for InvoiceSectionState. */ + public static final InvoiceSectionState RESTRICTED = fromString("Restricted"); + + /** + * Creates or finds a InvoiceSectionState from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceSectionState + */ + @JsonCreator + public static InvoiceSectionState fromString(String name) { + return fromString(name, InvoiceSectionState.class); + } + + /** + * @return known InvoiceSectionState values + */ + public static Collection values() { + return values(InvoiceSectionState.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionWithCreateSubPermission.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionWithCreateSubPermission.java new file mode 100644 index 0000000000000..2427daee503c9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionWithCreateSubPermission.java @@ -0,0 +1,71 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoiceSectionWithCreateSubPermissionInner; +import java.util.List; + +/** + * Type representing InvoiceSectionWithCreateSubPermission. + */ +public interface InvoiceSectionWithCreateSubPermission extends HasInner, HasManager { + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileSpendingLimit value. + */ + SpendingLimitForBillingProfile billingProfileSpendingLimit(); + + /** + * @return the billingProfileStatus value. + */ + BillingProfileStatus billingProfileStatus(); + + /** + * @return the billingProfileStatusReasonCode value. + */ + StatusReasonCodeForBillingProfile billingProfileStatusReasonCode(); + + /** + * @return the billingProfileSystemId value. + */ + String billingProfileSystemId(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionSystemId value. + */ + String invoiceSectionSystemId(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSections.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSections.java new file mode 100644 index 0000000000000..2b710b0a86f9c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSections.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoiceSectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InvoiceSections. + */ +public interface InvoiceSections extends SupportsCreating, HasInner { + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsCreateOrUpdateHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..b014b0136ee86 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsCreateOrUpdateHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdate operation. + */ +public class InvoiceSectionsCreateOrUpdateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the InvoiceSectionsCreateOrUpdateHeaders object itself. + */ + public InvoiceSectionsCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoiceSectionsCreateOrUpdateHeaders object itself. + */ + public InvoiceSectionsCreateOrUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsOnExpand.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsOnExpand.java new file mode 100644 index 0000000000000..8a8c400187f38 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceSectionsOnExpand.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.v2020_05_01; + +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoiceSectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The invoice sections associated to the billing profile. By default this is + * not populated, unless it's specified in $expand. + */ +public class InvoiceSectionsOnExpand { + /** + * Indicates whether there are more invoice sections than the ones listed + * in this collection. The collection lists a maximum of 50 invoice + * sections. To get all invoice sections, use the list invoice sections + * API. + */ + @JsonProperty(value = "hasMoreResults", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasMoreResults; + + /** + * The invoice sections associated to the billing profile. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get indicates whether there are more invoice sections than the ones listed in this collection. The collection lists a maximum of 50 invoice sections. To get all invoice sections, use the list invoice sections API. + * + * @return the hasMoreResults value + */ + public Boolean hasMoreResults() { + return this.hasMoreResults; + } + + /** + * Get the invoice sections associated to the billing profile. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the invoice sections associated to the billing profile. + * + * @param value the value value to set + * @return the InvoiceSectionsOnExpand object itself. + */ + public InvoiceSectionsOnExpand withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceStatus.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceStatus.java new file mode 100644 index 0000000000000..034e478556f89 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceStatus.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceStatus. + */ +public final class InvoiceStatus extends ExpandableStringEnum { + /** Static value Due for InvoiceStatus. */ + public static final InvoiceStatus DUE = fromString("Due"); + + /** Static value OverDue for InvoiceStatus. */ + public static final InvoiceStatus OVER_DUE = fromString("OverDue"); + + /** Static value Paid for InvoiceStatus. */ + public static final InvoiceStatus PAID = fromString("Paid"); + + /** Static value Void for InvoiceStatus. */ + public static final InvoiceStatus VOID = fromString("Void"); + + /** + * Creates or finds a InvoiceStatus from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceStatus + */ + @JsonCreator + public static InvoiceStatus fromString(String name) { + return fromString(name, InvoiceStatus.class); + } + + /** + * @return known InvoiceStatus values + */ + public static Collection values() { + return values(InvoiceStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceType.java new file mode 100644 index 0000000000000..7f33827dcdbf9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoiceType.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceType. + */ +public final class InvoiceType extends ExpandableStringEnum { + /** Static value AzureService for InvoiceType. */ + public static final InvoiceType AZURE_SERVICE = fromString("AzureService"); + + /** Static value AzureMarketplace for InvoiceType. */ + public static final InvoiceType AZURE_MARKETPLACE = fromString("AzureMarketplace"); + + /** Static value AzureSupport for InvoiceType. */ + public static final InvoiceType AZURE_SUPPORT = fromString("AzureSupport"); + + /** + * Creates or finds a InvoiceType from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceType + */ + @JsonCreator + public static InvoiceType fromString(String name) { + return fromString(name, InvoiceType.class); + } + + /** + * @return known InvoiceType values + */ + public static Collection values() { + return values(InvoiceType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoices.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoices.java new file mode 100644 index 0000000000000..4855788305256 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Invoices.java @@ -0,0 +1,121 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.InvoicesInner; +import com.microsoft.azure.arm.model.HasInner; +import java.util.List; + +/** + * Type representing Invoices. + */ +public interface Invoices extends HasInner { + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String invoiceName); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken); + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingSubscriptionAsync(final String periodStartDate, final String periodEndDate); + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBySubscriptionAndInvoiceIdAsync(String invoiceName); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken); + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String invoiceName); + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java new file mode 100644 index 0000000000000..a5cc84683e276 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DownloadBillingSubscriptionInvoice operation. + */ +public class InvoicesDownloadBillingSubscriptionInvoiceHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the InvoicesDownloadBillingSubscriptionInvoiceHeaders object itself. + */ + public InvoicesDownloadBillingSubscriptionInvoiceHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoicesDownloadBillingSubscriptionInvoiceHeaders object itself. + */ + public InvoicesDownloadBillingSubscriptionInvoiceHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadInvoiceHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadInvoiceHeaders.java new file mode 100644 index 0000000000000..f03cb618475ec --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadInvoiceHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DownloadInvoice operation. + */ +public class InvoicesDownloadInvoiceHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the InvoicesDownloadInvoiceHeaders object itself. + */ + public InvoicesDownloadInvoiceHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoicesDownloadInvoiceHeaders object itself. + */ + public InvoicesDownloadInvoiceHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java new file mode 100644 index 0000000000000..c4c8fab966b6d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DownloadMultipleBillingProfileInvoices operation. + */ +public class InvoicesDownloadMultipleBillingProfileInvoicesHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the InvoicesDownloadMultipleBillingProfileInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingProfileInvoicesHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoicesDownloadMultipleBillingProfileInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingProfileInvoicesHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java new file mode 100644 index 0000000000000..c8df397c30140 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DownloadMultipleBillingSubscriptionInvoices operation. + */ +public class InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/MarketplacePurchasesPolicy.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/MarketplacePurchasesPolicy.java new file mode 100644 index 0000000000000..fe2a105e68d2a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/MarketplacePurchasesPolicy.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MarketplacePurchasesPolicy. + */ +public final class MarketplacePurchasesPolicy extends ExpandableStringEnum { + /** Static value AllAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ALL_ALLOWED = fromString("AllAllowed"); + + /** Static value OnlyFreeAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ONLY_FREE_ALLOWED = fromString("OnlyFreeAllowed"); + + /** Static value NotAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a MarketplacePurchasesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding MarketplacePurchasesPolicy + */ + @JsonCreator + public static MarketplacePurchasesPolicy fromString(String name) { + return fromString(name, MarketplacePurchasesPolicy.class); + } + + /** + * @return known MarketplacePurchasesPolicy values + */ + public static Collection values() { + return values(MarketplacePurchasesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operation.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operation.java new file mode 100644 index 0000000000000..8932e809c8589 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/OperationDisplay.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/OperationDisplay.java new file mode 100644 index 0000000000000..839a3210076de --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/OperationDisplay.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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Billing. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed such as invoice and billing + * subscription. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type such as read, write and delete. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Billing. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed such as invoice and billing subscription. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type such as read, write and delete. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operations.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operations.java new file mode 100644 index 0000000000000..bb5f4844c5520 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Participants.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Participants.java new file mode 100644 index 0000000000000..096ebcbc48e4e --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/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.v2020_05_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details about a participant. + */ +public class Participants { + /** + * The acceptance status of the participant. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The date when the status got changed. + */ + @JsonProperty(value = "statusDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime statusDate; + + /** + * The email address of the participant. + */ + @JsonProperty(value = "email", access = JsonProperty.Access.WRITE_ONLY) + private String email; + + /** + * Get the acceptance status of the participant. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the date when the status got changed. + * + * @return the statusDate value + */ + public DateTime statusDate() { + return this.statusDate; + } + + /** + * Get the email address of the participant. + * + * @return the email value + */ + public String email() { + return this.email; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentMethodFamily.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentMethodFamily.java new file mode 100644 index 0000000000000..ba3b4a345bf78 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentMethodFamily.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PaymentMethodFamily. + */ +public final class PaymentMethodFamily extends ExpandableStringEnum { + /** Static value Credits for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDITS = fromString("Credits"); + + /** Static value CheckWire for PaymentMethodFamily. */ + public static final PaymentMethodFamily CHECK_WIRE = fromString("CheckWire"); + + /** Static value CreditCard for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDIT_CARD = fromString("CreditCard"); + + /** Static value None for PaymentMethodFamily. */ + public static final PaymentMethodFamily NONE = fromString("None"); + + /** + * Creates or finds a PaymentMethodFamily from its string representation. + * @param name a name to look for + * @return the corresponding PaymentMethodFamily + */ + @JsonCreator + public static PaymentMethodFamily fromString(String name) { + return fromString(name, PaymentMethodFamily.class); + } + + /** + * @return known PaymentMethodFamily values + */ + public static Collection values() { + return values(PaymentMethodFamily.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentProperties.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentProperties.java new file mode 100644 index 0000000000000..4c4f5afeb6d96 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/PaymentProperties.java @@ -0,0 +1,105 @@ +/** + * 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.v2020_05_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a payment. + */ +public class PaymentProperties { + /** + * The type of payment. + */ + @JsonProperty(value = "paymentType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentType; + + /** + * The paid amount. + */ + @JsonProperty(value = "amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /** + * The date when the payment was made. + */ + @JsonProperty(value = "date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * The family of payment method. Possible values include: 'Credits', + * 'CheckWire', 'CreditCard', 'None'. + */ + @JsonProperty(value = "paymentMethodFamily") + private PaymentMethodFamily paymentMethodFamily; + + /** + * The type of payment method. + */ + @JsonProperty(value = "paymentMethodType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentMethodType; + + /** + * Get the type of payment. + * + * @return the paymentType value + */ + public String paymentType() { + return this.paymentType; + } + + /** + * Get the paid amount. + * + * @return the amount value + */ + public Amount amount() { + return this.amount; + } + + /** + * Get the date when the payment was made. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Get the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None'. + * + * @return the paymentMethodFamily value + */ + public PaymentMethodFamily paymentMethodFamily() { + return this.paymentMethodFamily; + } + + /** + * Set the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None'. + * + * @param paymentMethodFamily the paymentMethodFamily value to set + * @return the PaymentProperties object itself. + */ + public PaymentProperties withPaymentMethodFamily(PaymentMethodFamily paymentMethodFamily) { + this.paymentMethodFamily = paymentMethodFamily; + return this; + } + + /** + * Get the type of payment method. + * + * @return the paymentMethodType value + */ + public String paymentMethodType() { + return this.paymentMethodType; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policies.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policies.java new file mode 100644 index 0000000000000..7cc90b82a6ac8 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policies.java @@ -0,0 +1,61 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.PolicyInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.PoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policies. + */ +public interface Policies extends HasInner { + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName); + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerAsync(String billingAccountName, String customerName); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateCustomerAsync(String billingAccountName, String customerName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policy.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policy.java new file mode 100644 index 0000000000000..e6770015f1e21 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Policy.java @@ -0,0 +1,50 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.PolicyInner; + +/** + * Type representing Policy. + */ +public interface Policy extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the marketplacePurchases value. + */ + MarketplacePurchasesPolicy marketplacePurchases(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationPurchases value. + */ + ReservationPurchasesPolicy reservationPurchases(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the viewCharges value. + */ + ViewChargesPolicy viewCharges(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Product.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Product.java new file mode 100644 index 0000000000000..ecbf956163aa8 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Product.java @@ -0,0 +1,196 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.ProductInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Product. + */ +public interface Product extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the autoRenew value. + */ + AutoRenew autoRenew(); + + /** + * @return the availabilityId value. + */ + String availabilityId(); + + /** + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastCharge value. + */ + Amount lastCharge(); + + /** + * @return the lastChargeDate value. + */ + DateTime lastChargeDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the purchaseDate value. + */ + DateTime purchaseDate(); + + /** + * @return the quantity value. + */ + Double quantity(); + + /** + * @return the reseller value. + */ + Reseller reseller(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the status value. + */ + ProductStatusType status(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a Product update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoRenew, UpdateStages.WithBillingFrequency, UpdateStages.WithStatus { + } + + /** + * Grouping of Product update stages. + */ + interface UpdateStages { + /** + * The stage of the product update allowing to specify AutoRenew. + */ + interface WithAutoRenew { + /** + * Specifies autoRenew. + * @param autoRenew Indicates whether auto renewal is turned on or off for a product. Possible values include: 'Off', 'On' + * @return the next update stage + */ + Update withAutoRenew(AutoRenew autoRenew); + } + + /** + * The stage of the product update allowing to specify BillingFrequency. + */ + interface WithBillingFrequency { + /** + * Specifies billingFrequency. + * @param billingFrequency The frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + * @return the next update stage + */ + Update withBillingFrequency(BillingFrequency billingFrequency); + } + + /** + * The stage of the product update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + * @return the next update stage + */ + Update withStatus(ProductStatusType status); + } + + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductStatusType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductStatusType.java new file mode 100644 index 0000000000000..81eac2f9ba1af --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductStatusType.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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductStatusType. + */ +public final class ProductStatusType extends ExpandableStringEnum { + /** Static value Active for ProductStatusType. */ + public static final ProductStatusType ACTIVE = fromString("Active"); + + /** Static value Inactive for ProductStatusType. */ + public static final ProductStatusType INACTIVE = fromString("Inactive"); + + /** Static value PastDue for ProductStatusType. */ + public static final ProductStatusType PAST_DUE = fromString("PastDue"); + + /** Static value Expiring for ProductStatusType. */ + public static final ProductStatusType EXPIRING = fromString("Expiring"); + + /** Static value Expired for ProductStatusType. */ + public static final ProductStatusType EXPIRED = fromString("Expired"); + + /** Static value Disabled for ProductStatusType. */ + public static final ProductStatusType DISABLED = fromString("Disabled"); + + /** Static value Cancelled for ProductStatusType. */ + public static final ProductStatusType CANCELLED = fromString("Cancelled"); + + /** Static value AutoRenew for ProductStatusType. */ + public static final ProductStatusType AUTO_RENEW = fromString("AutoRenew"); + + /** + * Creates or finds a ProductStatusType from its string representation. + * @param name a name to look for + * @return the corresponding ProductStatusType + */ + @JsonCreator + public static ProductStatusType fromString(String name) { + return fromString(name, ProductStatusType.class); + } + + /** + * @return known ProductStatusType values + */ + public static Collection values() { + return values(ProductStatusType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductTransferValidationErrorCode.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductTransferValidationErrorCode.java new file mode 100644 index 0000000000000..ffc08d0791001 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductTransferValidationErrorCode.java @@ -0,0 +1,62 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductTransferValidationErrorCode. + */ +public final class ProductTransferValidationErrorCode extends ExpandableStringEnum { + /** Static value InvalidSource for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INVALID_SOURCE = fromString("InvalidSource"); + + /** Static value ProductNotActive for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode PRODUCT_NOT_ACTIVE = fromString("ProductNotActive"); + + /** Static value InsufficientPermissionOnSource for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_SOURCE = fromString("InsufficientPermissionOnSource"); + + /** Static value InsufficientPermissionOnDestination for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_DESTINATION = fromString("InsufficientPermissionOnDestination"); + + /** Static value DestinationBillingProfilePastDue for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode DESTINATION_BILLING_PROFILE_PAST_DUE = fromString("DestinationBillingProfilePastDue"); + + /** Static value ProductTypeNotSupported for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode PRODUCT_TYPE_NOT_SUPPORTED = fromString("ProductTypeNotSupported"); + + /** Static value CrossBillingAccountNotAllowed for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode CROSS_BILLING_ACCOUNT_NOT_ALLOWED = fromString("CrossBillingAccountNotAllowed"); + + /** Static value NotAvailableForDestinationMarket for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode NOT_AVAILABLE_FOR_DESTINATION_MARKET = fromString("NotAvailableForDestinationMarket"); + + /** Static value OneTimePurchaseProductTransferNotAllowed for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode ONE_TIME_PURCHASE_PRODUCT_TRANSFER_NOT_ALLOWED = fromString("OneTimePurchaseProductTransferNotAllowed"); + + /** + * Creates or finds a ProductTransferValidationErrorCode from its string representation. + * @param name a name to look for + * @return the corresponding ProductTransferValidationErrorCode + */ + @JsonCreator + public static ProductTransferValidationErrorCode fromString(String name) { + return fromString(name, ProductTransferValidationErrorCode.class); + } + + /** + * @return known ProductTransferValidationErrorCode values + */ + public static Collection values() { + return values(ProductTransferValidationErrorCode.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Products.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Products.java new file mode 100644 index 0000000000000..5f352f6226f1c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Products.java @@ -0,0 +1,89 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.ProductsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Products. + */ +public interface Products extends HasInner { + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String productName); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable moveAsync(String billingAccountName, String productName); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateMoveAsync(String billingAccountName, String productName); + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(final String billingAccountName, final String customerName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductsMoveHeaders.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductsMoveHeaders.java new file mode 100644 index 0000000000000..68036691a7a1d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ProductsMoveHeaders.java @@ -0,0 +1,70 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Move operation. + */ +public class ProductsMoveHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the ProductsMoveHeaders object itself. + */ + public ProductsMoveHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the ProductsMoveHeaders object itself. + */ + public ProductsMoveHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/RebillDetails.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/RebillDetails.java new file mode 100644 index 0000000000000..d92b73e970463 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/RebillDetails.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.v2020_05_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The rebill details of an invoice. + */ +public class RebillDetails { + /** + * The ID of credit note. + */ + @JsonProperty(value = "creditNoteDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String creditNoteDocumentId; + + /** + * The ID of invoice. + */ + @JsonProperty(value = "invoiceDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceDocumentId; + + /** + * Rebill details for an invoice. + */ + @JsonProperty(value = "rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + private Map rebillDetails; + + /** + * Get the ID of credit note. + * + * @return the creditNoteDocumentId value + */ + public String creditNoteDocumentId() { + return this.creditNoteDocumentId; + } + + /** + * Get the ID of invoice. + * + * @return the invoiceDocumentId value + */ + public String invoiceDocumentId() { + return this.invoiceDocumentId; + } + + /** + * Get rebill details for an invoice. + * + * @return the rebillDetails value + */ + public Map rebillDetails() { + return this.rebillDetails; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Reseller.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Reseller.java new file mode 100644 index 0000000000000..6580b97a56684 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Reseller.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the reseller. + */ +public class Reseller { + /** + * The MPN ID of the reseller. + */ + @JsonProperty(value = "resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * The name of the reseller. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the MPN ID of the reseller. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get the name of the reseller. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationPurchasesPolicy.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationPurchasesPolicy.java new file mode 100644 index 0000000000000..3548c95413ae9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationPurchasesPolicy.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReservationPurchasesPolicy. + */ +public final class ReservationPurchasesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ReservationPurchasesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReservationPurchasesPolicy + */ + @JsonCreator + public static ReservationPurchasesPolicy fromString(String name) { + return fromString(name, ReservationPurchasesPolicy.class); + } + + /** + * @return known ReservationPurchasesPolicy values + */ + public static Collection values() { + return values(ReservationPurchasesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationType.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationType.java new file mode 100644 index 0000000000000..7673d95f6ef79 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ReservationType.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReservationType. + */ +public final class ReservationType extends ExpandableStringEnum { + /** Static value Purchase for ReservationType. */ + public static final ReservationType PURCHASE = fromString("Purchase"); + + /** Static value Usage Charge for ReservationType. */ + public static final ReservationType USAGE_CHARGE = fromString("Usage Charge"); + + /** + * Creates or finds a ReservationType from its string representation. + * @param name a name to look for + * @return the corresponding ReservationType + */ + @JsonCreator + public static ReservationType fromString(String name) { + return fromString(name, ReservationType.class); + } + + /** + * @return known ReservationType values + */ + public static Collection values() { + return values(ReservationType.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimit.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimit.java new file mode 100644 index 0000000000000..a16a836a7e71e --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimit.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SpendingLimit. + */ +public final class SpendingLimit extends ExpandableStringEnum { + /** Static value Off for SpendingLimit. */ + public static final SpendingLimit OFF = fromString("Off"); + + /** Static value On for SpendingLimit. */ + public static final SpendingLimit ON = fromString("On"); + + /** + * Creates or finds a SpendingLimit from its string representation. + * @param name a name to look for + * @return the corresponding SpendingLimit + */ + @JsonCreator + public static SpendingLimit fromString(String name) { + return fromString(name, SpendingLimit.class); + } + + /** + * @return known SpendingLimit values + */ + public static Collection values() { + return values(SpendingLimit.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimitForBillingProfile.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimitForBillingProfile.java new file mode 100644 index 0000000000000..df8b9e1cdab2c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SpendingLimitForBillingProfile.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SpendingLimitForBillingProfile. + */ +public final class SpendingLimitForBillingProfile extends ExpandableStringEnum { + /** Static value Off for SpendingLimitForBillingProfile. */ + public static final SpendingLimitForBillingProfile OFF = fromString("Off"); + + /** Static value On for SpendingLimitForBillingProfile. */ + public static final SpendingLimitForBillingProfile ON = fromString("On"); + + /** + * Creates or finds a SpendingLimitForBillingProfile from its string representation. + * @param name a name to look for + * @return the corresponding SpendingLimitForBillingProfile + */ + @JsonCreator + public static SpendingLimitForBillingProfile fromString(String name) { + return fromString(name, SpendingLimitForBillingProfile.class); + } + + /** + * @return known SpendingLimitForBillingProfile values + */ + public static Collection values() { + return values(SpendingLimitForBillingProfile.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCode.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCode.java new file mode 100644 index 0000000000000..f237d0561b9ea --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCode.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StatusReasonCode. + */ +public final class StatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for StatusReasonCode. */ + public static final StatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a StatusReasonCode from its string representation. + * @param name a name to look for + * @return the corresponding StatusReasonCode + */ + @JsonCreator + public static StatusReasonCode fromString(String name) { + return fromString(name, StatusReasonCode.class); + } + + /** + * @return known StatusReasonCode values + */ + public static Collection values() { + return values(StatusReasonCode.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCodeForBillingProfile.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCodeForBillingProfile.java new file mode 100644 index 0000000000000..6e9754cc6fcd3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/StatusReasonCodeForBillingProfile.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StatusReasonCodeForBillingProfile. + */ +public final class StatusReasonCodeForBillingProfile extends ExpandableStringEnum { + /** Static value PastDue for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a StatusReasonCodeForBillingProfile from its string representation. + * @param name a name to look for + * @return the corresponding StatusReasonCodeForBillingProfile + */ + @JsonCreator + public static StatusReasonCodeForBillingProfile fromString(String name) { + return fromString(name, StatusReasonCodeForBillingProfile.class); + } + + /** + * @return known StatusReasonCodeForBillingProfile values + */ + public static Collection values() { + return values(StatusReasonCodeForBillingProfile.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SubscriptionTransferValidationErrorCode.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SubscriptionTransferValidationErrorCode.java new file mode 100644 index 0000000000000..2a1942cd17af4 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/SubscriptionTransferValidationErrorCode.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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SubscriptionTransferValidationErrorCode. + */ +public final class SubscriptionTransferValidationErrorCode extends ExpandableStringEnum { + /** Static value InvalidSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INVALID_SOURCE = fromString("InvalidSource"); + + /** Static value SubscriptionNotActive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_NOT_ACTIVE = fromString("SubscriptionNotActive"); + + /** Static value InsufficientPermissionOnSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_SOURCE = fromString("InsufficientPermissionOnSource"); + + /** Static value InsufficientPermissionOnDestination for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_DESTINATION = fromString("InsufficientPermissionOnDestination"); + + /** Static value DestinationBillingProfilePastDue for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_BILLING_PROFILE_PAST_DUE = fromString("DestinationBillingProfilePastDue"); + + /** Static value SubscriptionTypeNotSupported for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_TYPE_NOT_SUPPORTED = fromString("SubscriptionTypeNotSupported"); + + /** Static value CrossBillingAccountNotAllowed for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode CROSS_BILLING_ACCOUNT_NOT_ALLOWED = fromString("CrossBillingAccountNotAllowed"); + + /** Static value NotAvailableForDestinationMarket for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode NOT_AVAILABLE_FOR_DESTINATION_MARKET = fromString("NotAvailableForDestinationMarket"); + + /** + * Creates or finds a SubscriptionTransferValidationErrorCode from its string representation. + * @param name a name to look for + * @return the corresponding SubscriptionTransferValidationErrorCode + */ + @JsonCreator + public static SubscriptionTransferValidationErrorCode fromString(String name) { + return fromString(name, SubscriptionTransferValidationErrorCode.class); + } + + /** + * @return known SubscriptionTransferValidationErrorCode values + */ + public static Collection values() { + return values(SubscriptionTransferValidationErrorCode.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TargetCloud.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TargetCloud.java new file mode 100644 index 0000000000000..440ae31adb11c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TargetCloud.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TargetCloud. + */ +public final class TargetCloud extends ExpandableStringEnum { + /** Static value USGov for TargetCloud. */ + public static final TargetCloud USGOV = fromString("USGov"); + + /** Static value USNat for TargetCloud. */ + public static final TargetCloud USNAT = fromString("USNat"); + + /** Static value USSec for TargetCloud. */ + public static final TargetCloud USSEC = fromString("USSec"); + + /** + * Creates or finds a TargetCloud from its string representation. + * @param name a name to look for + * @return the corresponding TargetCloud + */ + @JsonCreator + public static TargetCloud fromString(String name) { + return fromString(name, TargetCloud.class); + } + + /** + * @return known TargetCloud values + */ + public static Collection values() { + return values(TargetCloud.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transaction.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transaction.java new file mode 100644 index 0000000000000..e989d9b919dec --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transaction.java @@ -0,0 +1,216 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.TransactionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Transaction. + */ +public interface Transaction extends HasInner, HasManager { + /** + * @return the azureCreditApplied value. + */ + Amount azureCreditApplied(); + + /** + * @return the azurePlan value. + */ + String azurePlan(); + + /** + * @return the billingCurrency value. + */ + String billingCurrency(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the dateProperty value. + */ + DateTime dateProperty(); + + /** + * @return the discount value. + */ + Double discount(); + + /** + * @return the effectivePrice value. + */ + Amount effectivePrice(); + + /** + * @return the exchangeRate value. + */ + Double exchangeRate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoice value. + */ + String invoice(); + + /** + * @return the invoiceId value. + */ + String invoiceId(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the kind value. + */ + TransactionTypeKind kind(); + + /** + * @return the marketPrice value. + */ + Amount marketPrice(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the orderId value. + */ + String orderId(); + + /** + * @return the orderName value. + */ + String orderName(); + + /** + * @return the pricingCurrency value. + */ + String pricingCurrency(); + + /** + * @return the productDescription value. + */ + String productDescription(); + + /** + * @return the productFamily value. + */ + String productFamily(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the quantity value. + */ + Integer quantity(); + + /** + * @return the servicePeriodEndDate value. + */ + DateTime servicePeriodEndDate(); + + /** + * @return the servicePeriodStartDate value. + */ + DateTime servicePeriodStartDate(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * @return the tax value. + */ + Amount tax(); + + /** + * @return the transactionAmount value. + */ + Amount transactionAmount(); + + /** + * @return the transactionType value. + */ + ReservationType transactionType(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unitOfMeasure value. + */ + String unitOfMeasure(); + + /** + * @return the units value. + */ + Double units(); + + /** + * @return the unitType value. + */ + String unitType(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransactionTypeKind.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransactionTypeKind.java new file mode 100644 index 0000000000000..0c5f5a3d77216 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransactionTypeKind.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransactionTypeKind. + */ +public final class TransactionTypeKind extends ExpandableStringEnum { + /** Static value all for TransactionTypeKind. */ + public static final TransactionTypeKind ALL = fromString("all"); + + /** Static value reservation for TransactionTypeKind. */ + public static final TransactionTypeKind RESERVATION = fromString("reservation"); + + /** + * Creates or finds a TransactionTypeKind from its string representation. + * @param name a name to look for + * @return the corresponding TransactionTypeKind + */ + @JsonCreator + public static TransactionTypeKind fromString(String name) { + return fromString(name, TransactionTypeKind.class); + } + + /** + * @return known TransactionTypeKind values + */ + public static Collection values() { + return values(TransactionTypeKind.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transactions.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transactions.java new file mode 100644 index 0000000000000..cdc755dd193a1 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/Transactions.java @@ -0,0 +1,29 @@ +/** + * 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.v2020_05_01; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.TransactionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transactions. + */ +public interface Transactions extends HasInner { + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceAsync(final String billingAccountName, final String invoiceName); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferBillingSubscriptionRequestProperties.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferBillingSubscriptionRequestProperties.java new file mode 100644 index 0000000000000..6ccc54a9262e9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferBillingSubscriptionRequestProperties.java @@ -0,0 +1,43 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters to transfer billing subscription. + */ +public class TransferBillingSubscriptionRequestProperties { + /** + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId", required = true) + private String destinationInvoiceSectionId; + + /** + * Get the destination invoice section id. + * + * @return the destinationInvoiceSectionId value + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destination invoice section id. + * + * @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set + * @return the TransferBillingSubscriptionRequestProperties object itself. + */ + public TransferBillingSubscriptionRequestProperties withDestinationInvoiceSectionId(String destinationInvoiceSectionId) { + this.destinationInvoiceSectionId = destinationInvoiceSectionId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferProductRequestProperties.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferProductRequestProperties.java new file mode 100644 index 0000000000000..c51ca32e7932a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/TransferProductRequestProperties.java @@ -0,0 +1,43 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the product to initiate a transfer. + */ +public class TransferProductRequestProperties { + /** + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId") + private String destinationInvoiceSectionId; + + /** + * Get the destination invoice section id. + * + * @return the destinationInvoiceSectionId value + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destination invoice section id. + * + * @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set + * @return the TransferProductRequestProperties object itself. + */ + public TransferProductRequestProperties withDestinationInvoiceSectionId(String destinationInvoiceSectionId) { + this.destinationInvoiceSectionId = destinationInvoiceSectionId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateAddressResponse.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateAddressResponse.java new file mode 100644 index 0000000000000..2b7b4c083d3ff --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateAddressResponse.java @@ -0,0 +1,36 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.ValidateAddressResponseInner; +import java.util.List; + +/** + * Type representing ValidateAddressResponse. + */ +public interface ValidateAddressResponse extends HasInner, HasManager { + /** + * @return the status value. + */ + AddressValidationStatus status(); + + /** + * @return the suggestedAddresses value. + */ + List suggestedAddresses(); + + /** + * @return the validationMessage value. + */ + String validationMessage(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityError.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityError.java new file mode 100644 index 0000000000000..3a00c1fcaab14 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityError.java @@ -0,0 +1,100 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details of the product transfer eligibility validation. + */ +public class ValidateProductTransferEligibilityError { + /** + * Error code for the product transfer validation. Possible values include: + * 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', + * 'InsufficientPermissionOnDestination', + * 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + * 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + * 'OneTimePurchaseProductTransferNotAllowed'. + */ + @JsonProperty(value = "code") + private ProductTransferValidationErrorCode code; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Detailed error message explaining the error. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed'. + * + * @return the code value + */ + public ProductTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed'. + * + * @param code the code value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withCode(ProductTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get detailed error message explaining the error. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set detailed error message explaining the error. + * + * @param details the details value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityResult.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityResult.java new file mode 100644 index 0000000000000..82a66d31e09a4 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateProductTransferEligibilityResult.java @@ -0,0 +1,30 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.ValidateProductTransferEligibilityResultInner; + +/** + * Type representing ValidateProductTransferEligibilityResult. + */ +public interface ValidateProductTransferEligibilityResult extends HasInner, HasManager { + /** + * @return the errorDetails value. + */ + ValidateProductTransferEligibilityError errorDetails(); + + /** + * @return the isMoveEligible value. + */ + Boolean isMoveEligible(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityError.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityError.java new file mode 100644 index 0000000000000..b29214d4232ed --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityError.java @@ -0,0 +1,99 @@ +/** + * 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.v2020_05_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details of the transfer eligibility validation. + */ +public class ValidateSubscriptionTransferEligibilityError { + /** + * Error code for the product transfer validation. Possible values include: + * 'InvalidSource', 'SubscriptionNotActive', + * 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + * 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + * 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + */ + @JsonProperty(value = "code") + private SubscriptionTransferValidationErrorCode code; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Detailed error message explaining the error. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + * + * @return the code value + */ + public SubscriptionTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + * + * @param code the code value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withCode(SubscriptionTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get detailed error message explaining the error. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set detailed error message explaining the error. + * + * @param details the details value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityResult.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityResult.java new file mode 100644 index 0000000000000..2a42ff738bb42 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ValidateSubscriptionTransferEligibilityResult.java @@ -0,0 +1,30 @@ +/** + * 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.v2020_05_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2020_05_01.implementation.ValidateSubscriptionTransferEligibilityResultInner; + +/** + * Type representing ValidateSubscriptionTransferEligibilityResult. + */ +public interface ValidateSubscriptionTransferEligibilityResult extends HasInner, HasManager { + /** + * @return the errorDetails value. + */ + ValidateSubscriptionTransferEligibilityError errorDetails(); + + /** + * @return the isMoveEligible value. + */ + Boolean isMoveEligible(); + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewCharges.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewCharges.java new file mode 100644 index 0000000000000..3c08b7e2b82d3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewCharges.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ViewCharges. + */ +public final class ViewCharges extends ExpandableStringEnum { + /** Static value Allowed for ViewCharges. */ + public static final ViewCharges ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewCharges. */ + public static final ViewCharges NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewCharges from its string representation. + * @param name a name to look for + * @return the corresponding ViewCharges + */ + @JsonCreator + public static ViewCharges fromString(String name) { + return fromString(name, ViewCharges.class); + } + + /** + * @return known ViewCharges values + */ + public static Collection values() { + return values(ViewCharges.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewChargesPolicy.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewChargesPolicy.java new file mode 100644 index 0000000000000..1ec52f72e7d70 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/ViewChargesPolicy.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ViewChargesPolicy. + */ +public final class ViewChargesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewChargesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ViewChargesPolicy + */ + @JsonCreator + public static ViewChargesPolicy fromString(String name) { + return fromString(name, ViewChargesPolicy.class); + } + + /** + * @return known ViewChargesPolicy values + */ + public static Collection values() { + return values(ViewChargesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressImpl.java new file mode 100644 index 0000000000000..77e51cfd508c0 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressImpl.java @@ -0,0 +1,43 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Address; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.ValidateAddressResponse; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; + +class AddressImpl extends WrapperImpl implements Address { + private final BillingManager manager; + + AddressImpl(BillingManager manager) { + super(manager.inner().address()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable validateAsync(AddressDetails address) { + AddressInner client = this.inner(); + return client.validateAsync(address) + .map(new Func1() { + @Override + public ValidateAddressResponse call(ValidateAddressResponseInner inner) { + return new ValidateAddressResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressInner.java new file mode 100644 index 0000000000000..38658cf9df32a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AddressInner.java @@ -0,0 +1,137 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +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 Address. + */ +public class AddressInner { + /** The Retrofit service to perform REST calls. */ + private AddressService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AddressInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AddressInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AddressService.class); + this.client = client; + } + + /** + * The interface defining all the services for Address to be + * used by Retrofit to perform actually REST calls. + */ + interface AddressService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Address validate" }) + @POST("providers/Microsoft.Billing/validateAddress") + Observable> validate(@Query("api-version") String apiVersion, @Body AddressDetails address, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address the AddressDetails value + * @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 ValidateAddressResponseInner object if successful. + */ + public ValidateAddressResponseInner validate(AddressDetails address) { + return validateWithServiceResponseAsync(address).toBlocking().single().body(); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address the AddressDetails value + * @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(AddressDetails address, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(address), serviceCallback); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable validateAsync(AddressDetails address) { + return validateWithServiceResponseAsync(address).map(new Func1, ValidateAddressResponseInner>() { + @Override + public ValidateAddressResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable> validateWithServiceResponseAsync(AddressDetails address) { + if (address == null) { + throw new IllegalArgumentException("Parameter address is required and cannot be null."); + } + Validator.validate(address); + final String apiVersion = "2020-05-01"; + return service.validate(apiVersion, address, this.client.acceptLanguage(), 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); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementImpl.java new file mode 100644 index 0000000000000..0d3104cadf9bb --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementImpl.java @@ -0,0 +1,96 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Agreement; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.AcceptanceMode; +import com.microsoft.azure.management.billing.v2020_05_01.Category; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.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 AcceptanceMode acceptanceMode() { + return this.inner().acceptanceMode(); + } + + @Override + public String agreementLink() { + return this.inner().agreementLink(); + } + + @Override + public Category category() { + return this.inner().category(); + } + + @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/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementInner.java new file mode 100644 index 0000000000000..0bb9f03c06513 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementInner.java @@ -0,0 +1,145 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Category; +import com.microsoft.azure.management.billing.v2020_05_01.AcceptanceMode; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.Participants; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An agreement. + */ +@JsonFlatten +public class AgreementInner extends ProxyResource { + /** + * The URL to download the agreement. + */ + @JsonProperty(value = "properties.agreementLink", access = JsonProperty.Access.WRITE_ONLY) + private String agreementLink; + + /** + * The category of the agreement signed by a customer. Possible values + * include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', + * 'Other'. + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private Category category; + + /** + * The mode of acceptance for an agreement. Possible values include: + * 'ClickToAccept', 'ESignEmbedded', 'ESignOffline'. + */ + @JsonProperty(value = "properties.acceptanceMode", access = JsonProperty.Access.WRITE_ONLY) + private AcceptanceMode acceptanceMode; + + /** + * The date from which the agreement is effective. + */ + @JsonProperty(value = "properties.effectiveDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime effectiveDate; + + /** + * The date when the agreement expires. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationDate; + + /** + * The list of participants that participates in acceptance of an + * agreement. + */ + @JsonProperty(value = "properties.participants") + private List participants; + + /** + * The current status of the agreement. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the URL to download the agreement. + * + * @return the agreementLink value + */ + public String agreementLink() { + return this.agreementLink; + } + + /** + * Get the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other'. + * + * @return the category value + */ + public Category category() { + return this.category; + } + + /** + * Get the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline'. + * + * @return the acceptanceMode value + */ + public AcceptanceMode acceptanceMode() { + return this.acceptanceMode; + } + + /** + * Get the date from which the agreement is effective. + * + * @return the effectiveDate value + */ + public DateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Get the date when the agreement expires. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get the list of participants that participates in acceptance of an agreement. + * + * @return the participants value + */ + public List participants() { + return this.participants; + } + + /** + * Set the list of participants that participates in acceptance of an 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 current status of the agreement. + * + * @return the status value + */ + public String status() { + return this.status; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsImpl.java new file mode 100644 index 0000000000000..14b93acf3958d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsImpl.java @@ -0,0 +1,69 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Agreements; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.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 listByBillingAccountAsync(final String billingAccountName) { + AgreementsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Agreement call(AgreementInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String agreementName) { + AgreementsInner client = this.inner(); + return client.getAsync(billingAccountName, agreementName) + .flatMap(new Func1>() { + @Override + public Observable call(AgreementInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Agreement)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsInner.java new file mode 100644 index 0000000000000..bf2094015bab8 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AgreementsInner.java @@ -0,0 +1,564 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +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.v2020_05_01.Agreements listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") + Observable> listByBillingAccount(@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.v2020_05_01.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Agreements listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.listByBillingAccount(billingAccountName, apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountSinglePageAsync(billingAccountName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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(); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.get(billingAccountName, agreementName, 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); + } + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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(); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, agreementName, 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); + } + + /** + * Lists the agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceImpl.java new file mode 100644 index 0000000000000..4dea5fb4a715f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceImpl.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.AvailableBalance; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; + +class AvailableBalanceImpl extends WrapperImpl implements AvailableBalance { + private final BillingManager manager; + AvailableBalanceImpl(AvailableBalanceInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Amount amount() { + return this.inner().amount(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceInner.java new file mode 100644 index 0000000000000..fc41e84f1dd40 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalanceInner.java @@ -0,0 +1,36 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The latest Azure credit balance. This is the balance available for pay now. + */ +@JsonFlatten +public class AvailableBalanceInner extends ProxyResource { + /** + * Balance amount. + */ + @JsonProperty(value = "properties.amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /** + * Get balance amount. + * + * @return the amount value + */ + public Amount amount() { + return this.amount; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesImpl.java new file mode 100644 index 0000000000000..7294a6d459342 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesImpl.java @@ -0,0 +1,42 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.AvailableBalances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.AvailableBalance; + +class AvailableBalancesImpl extends WrapperImpl implements AvailableBalances { + private final BillingManager manager; + + AvailableBalancesImpl(BillingManager manager) { + super(manager.inner().availableBalances()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName) { + AvailableBalancesInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public AvailableBalance call(AvailableBalanceInner inner) { + return new AvailableBalanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesInner.java new file mode 100644 index 0000000000000..04cc48cc0b091 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/AvailableBalancesInner.java @@ -0,0 +1,141 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2020_05_01.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 AvailableBalances. + */ +public class AvailableBalancesInner { + /** The Retrofit service to perform REST calls. */ + private AvailableBalancesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AvailableBalancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AvailableBalancesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AvailableBalancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AvailableBalances to be + * used by Retrofit to perform actually REST calls. + */ + interface AvailableBalancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.AvailableBalances get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 AvailableBalanceInner object if successful. + */ + public AvailableBalanceInner get(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailableBalanceInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, AvailableBalanceInner>() { + @Override + public AvailableBalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailableBalanceInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, billingProfileName, apiVersion, 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/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountImpl.java new file mode 100644 index 0000000000000..282cad290c853 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountImpl.java @@ -0,0 +1,187 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccount; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccountUpdateRequest; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AccountStatus; +import com.microsoft.azure.management.billing.v2020_05_01.AccountType; +import com.microsoft.azure.management.billing.v2020_05_01.AgreementType; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfilesOnExpand; +import com.microsoft.azure.management.billing.v2020_05_01.Department; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2020_05_01.Enrollment; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import rx.functions.Func1; + +class BillingAccountImpl extends CreatableUpdatableImpl implements BillingAccount, BillingAccount.Update { + private String billingAccountName; + private BillingAccountUpdateRequest updateParameter; + private final BillingManager manager; + + BillingAccountImpl(String name, BillingManager manager) { + super(name, new BillingAccountInner()); + this.manager = manager; + // Set resource name + this.billingAccountName = name; + // + this.updateParameter = new BillingAccountUpdateRequest(); + } + + BillingAccountImpl(BillingAccountInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingAccountName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + // set other parameters for create and update + this.updateParameter = new BillingAccountUpdateRequest(); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return client.updateAsync(this.billingAccountName, this.updateParameter) + .map(new Func1() { + @Override + public BillingAccountInner call(BillingAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return client.getAsync(this.billingAccountName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new BillingAccountUpdateRequest(); + } + + @Override + public AccountStatus accountStatus() { + return this.inner().accountStatus(); + } + + @Override + public AccountType accountType() { + return this.inner().accountType(); + } + + @Override + public AgreementType agreementType() { + return this.inner().agreementType(); + } + + @Override + public BillingProfilesOnExpand billingProfiles() { + return this.inner().billingProfiles(); + } + + @Override + public List departments() { + return this.inner().departments(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enrollmentAccounts() { + return this.inner().enrollmentAccounts(); + } + + @Override + public Enrollment enrollmentDetails() { + return this.inner().enrollmentDetails(); + } + + @Override + public Boolean hasReadAccess() { + return this.inner().hasReadAccess(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public AddressDetails soldTo() { + return this.inner().soldTo(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingAccountImpl withBillingProfiles(BillingProfilesOnExpand billingProfiles) { + this.updateParameter.withBillingProfiles(billingProfiles); + return this; + } + + @Override + public BillingAccountImpl withDepartments(List departments) { + this.updateParameter.withDepartments(departments); + return this; + } + + @Override + public BillingAccountImpl withDisplayName(String displayName) { + this.updateParameter.withDisplayName(displayName); + return this; + } + + @Override + public BillingAccountImpl withEnrollmentAccounts(List enrollmentAccounts) { + this.updateParameter.withEnrollmentAccounts(enrollmentAccounts); + return this; + } + + @Override + public BillingAccountImpl withSoldTo(AddressDetails soldTo) { + this.updateParameter.withSoldTo(soldTo); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountInner.java new file mode 100644 index 0000000000000..ba1a2fdec40ca --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountInner.java @@ -0,0 +1,241 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import com.microsoft.azure.management.billing.v2020_05_01.AgreementType; +import com.microsoft.azure.management.billing.v2020_05_01.AccountType; +import com.microsoft.azure.management.billing.v2020_05_01.AccountStatus; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfilesOnExpand; +import com.microsoft.azure.management.billing.v2020_05_01.Enrollment; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.Department; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing account. + */ +@JsonFlatten +public class BillingAccountInner extends ProxyResource { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The address of the individual or organization that is responsible for + * the billing account. + */ + @JsonProperty(value = "properties.soldTo") + private AddressDetails soldTo; + + /** + * The type of agreement. Possible values include: + * 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + * 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /** + * The current status of the billing account. Possible values include: + * 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', + * 'Terminated'. + */ + @JsonProperty(value = "properties.accountStatus", access = JsonProperty.Access.WRITE_ONLY) + private AccountStatus accountStatus; + + /** + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private BillingProfilesOnExpand billingProfiles; + + /** + * The details about the associated legacy enrollment. By default this is + * not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private Enrollment enrollmentDetails; + + /** + * The departments associated to the enrollment. + */ + @JsonProperty(value = "properties.departments") + private List departments; + + /** + * The accounts associated to the enrollment. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Indicates whether user has read access to the billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the billing account name. + * + * @param displayName the displayName value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the address of the individual or organization that is responsible for the billing account. + * + * @return the soldTo value + */ + public AddressDetails soldTo() { + return this.soldTo; + } + + /** + * Set the address of the individual or organization that is responsible for the billing account. + * + * @param soldTo the soldTo value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withSoldTo(AddressDetails soldTo) { + this.soldTo = soldTo; + return this; + } + + /** + * Get the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + * + * @return the agreementType value + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the accountType value + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated'. + * + * @return the accountStatus value + */ + public AccountStatus accountStatus() { + return this.accountStatus; + } + + /** + * Get the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the billingProfiles value + */ + public BillingProfilesOnExpand billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withBillingProfiles(BillingProfilesOnExpand billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentDetails value + */ + public Enrollment enrollmentDetails() { + return this.enrollmentDetails; + } + + /** + * Get the departments associated to the enrollment. + * + * @return the departments value + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments associated to the enrollment. + * + * @param departments the departments value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withDepartments(List departments) { + this.departments = departments; + return this; + } + + /** + * Get the accounts associated to the enrollment. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the accounts associated to the enrollment. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get indicates whether user has read access to the billing account. + * + * @return the hasReadAccess value + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsImpl.java new file mode 100644 index 0000000000000..be53ed5b9b0fb --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsImpl.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. + * jkl + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccounts; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccount; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionWithCreateSubPermission; + +class BillingAccountsImpl extends WrapperImpl implements BillingAccounts { + private final BillingManager manager; + + BillingAccountsImpl(BillingManager manager) { + super(manager.inner().billingAccounts()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingAccountImpl wrapModel(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + + @Override + public Observable getAsync(String billingAccountName) { + BillingAccountsInner client = this.inner(); + return client.getAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingAccount call(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + }); + } + + @Override + public Observable listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName) { + BillingAccountsInner client = this.inner(); + return client.listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSectionWithCreateSubPermission call(InvoiceSectionWithCreateSubPermissionInner inner) { + return new InvoiceSectionWithCreateSubPermissionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + BillingAccountsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccount call(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsInner.java new file mode 100644 index 0000000000000..a46b73a951fd4 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingAccountsInner.java @@ -0,0 +1,924 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccountUpdateRequest; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingAccounts. + */ +public class BillingAccountsInner { + /** The Retrofit service to perform REST calls. */ + private BillingAccountsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingAccounts list" }) + @GET("providers/Microsoft.Billing/billingAccounts") + Observable> list(@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.v2020_05_01.BillingAccounts get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> get(@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.v2020_05_01.BillingAccounts update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateRequest parameters, @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.v2020_05_01.BillingAccounts beginUpdate" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateRequest parameters, @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.v2020_05_01.BillingAccounts listInvoiceSectionsByCreateSubscriptionPermission" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") + Observable> listInvoiceSectionsByCreateSubscriptionPermission(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.v2020_05_01.BillingAccounts listInvoiceSectionsByCreateSubscriptionPermissionNext" }) + @GET + Observable> listInvoiceSectionsByCreateSubscriptionPermissionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billing accounts that a user has access to. + * + * @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 PagedList<BillingAccountInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing accounts that a user has access to. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.list(apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @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 PagedList<BillingAccountInner> object if successful. + */ + public PagedList list(final String expand) { + ServiceResponse> response = listSinglePageAsync(expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @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> listAsync(final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listAsync(final String expand) { + return listWithServiceResponseAsync(expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand) { + return listSinglePageAsync(expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + ServiceResponse> * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand) { + final String apiVersion = "2020-05-01"; + return service.list(apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner get(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable getAsync(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.get(billingAccountName, 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); + } + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner get(String billingAccountName, String expand) { + return getWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @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 expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable getAsync(String billingAccountName, String expand) { + return getWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, 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); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner update(String billingAccountName, BillingAccountUpdateRequest parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().last().body(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @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 updateAsync(String billingAccountName, BillingAccountUpdateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + Observable> observable = service.update(billingAccountName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner beginUpdate(String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @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 beginUpdateAsync(String billingAccountName, BillingAccountUpdateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable beginUpdateAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.beginUpdate(billingAccountName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<InvoiceSectionWithCreateSubPermissionInner> object if successful. + */ + public PagedList listInvoiceSectionsByCreateSubscriptionPermission(final String billingAccountName) { + ServiceResponse> response = listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable> listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName) { + return listInvoiceSectionsByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName) { + return listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionWithCreateSubPermissionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listInvoiceSectionsByCreateSubscriptionPermission(billingAccountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listInvoiceSectionsByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listInvoiceSectionsByCreateSubscriptionPermissionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingAccountInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InvoiceSectionWithCreateSubPermissionInner> object if successful. + */ + public PagedList listInvoiceSectionsByCreateSubscriptionPermissionNext(final String nextPageLink) { + ServiceResponse> response = listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listInvoiceSectionsByCreateSubscriptionPermissionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable> listInvoiceSectionsByCreateSubscriptionPermissionNextAsync(final String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(final String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionWithCreateSubPermissionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listInvoiceSectionsByCreateSubscriptionPermissionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listInvoiceSectionsByCreateSubscriptionPermissionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listInvoiceSectionsByCreateSubscriptionPermissionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManagementClientImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManagementClientImpl.java new file mode 100644 index 0000000000000..83f89275f7379 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManagementClientImpl.java @@ -0,0 +1,451 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the BillingManagementClientImpl class. + */ +public class BillingManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID that uniquely identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The ID that uniquely identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID that uniquely identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public BillingManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public BillingManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public BillingManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public BillingManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The BillingAccountsInner object to access its operations. + */ + private BillingAccountsInner billingAccounts; + + /** + * Gets the BillingAccountsInner object to access its operations. + * @return the BillingAccountsInner object. + */ + public BillingAccountsInner billingAccounts() { + return this.billingAccounts; + } + + /** + * The AddressInner object to access its operations. + */ + private AddressInner address; + + /** + * Gets the AddressInner object to access its operations. + * @return the AddressInner object. + */ + public AddressInner address() { + return this.address; + } + + /** + * The AvailableBalancesInner object to access its operations. + */ + private AvailableBalancesInner availableBalances; + + /** + * Gets the AvailableBalancesInner object to access its operations. + * @return the AvailableBalancesInner object. + */ + public AvailableBalancesInner availableBalances() { + return this.availableBalances; + } + + /** + * The InstructionsInner object to access its operations. + */ + private InstructionsInner instructions; + + /** + * Gets the InstructionsInner object to access its operations. + * @return the InstructionsInner object. + */ + public InstructionsInner instructions() { + return this.instructions; + } + + /** + * The BillingProfilesInner object to access its operations. + */ + private BillingProfilesInner billingProfiles; + + /** + * Gets the BillingProfilesInner object to access its operations. + * @return the BillingProfilesInner object. + */ + public BillingProfilesInner billingProfiles() { + return this.billingProfiles; + } + + /** + * The CustomersInner object to access its operations. + */ + private CustomersInner customers; + + /** + * Gets the CustomersInner object to access its operations. + * @return the CustomersInner object. + */ + public CustomersInner customers() { + return this.customers; + } + + /** + * The InvoiceSectionsInner object to access its operations. + */ + private InvoiceSectionsInner invoiceSections; + + /** + * Gets the InvoiceSectionsInner object to access its operations. + * @return the InvoiceSectionsInner object. + */ + public InvoiceSectionsInner invoiceSections() { + return this.invoiceSections; + } + + /** + * The BillingPermissionsInner object to access its operations. + */ + private BillingPermissionsInner billingPermissions; + + /** + * Gets the BillingPermissionsInner object to access its operations. + * @return the BillingPermissionsInner object. + */ + public BillingPermissionsInner billingPermissions() { + return this.billingPermissions; + } + + /** + * The BillingSubscriptionsInner object to access its operations. + */ + private BillingSubscriptionsInner billingSubscriptions; + + /** + * Gets the BillingSubscriptionsInner object to access its operations. + * @return the BillingSubscriptionsInner object. + */ + public BillingSubscriptionsInner billingSubscriptions() { + return this.billingSubscriptions; + } + + /** + * The ProductsInner object to access its operations. + */ + private ProductsInner products; + + /** + * Gets the ProductsInner object to access its operations. + * @return the ProductsInner object. + */ + public ProductsInner products() { + return this.products; + } + + /** + * The InvoicesInner object to access its operations. + */ + private InvoicesInner invoices; + + /** + * Gets the InvoicesInner object to access its operations. + * @return the InvoicesInner object. + */ + public InvoicesInner invoices() { + return this.invoices; + } + + /** + * The TransactionsInner object to access its operations. + */ + private TransactionsInner transactions; + + /** + * Gets the TransactionsInner object to access its operations. + * @return the TransactionsInner object. + */ + public TransactionsInner transactions() { + return this.transactions; + } + + /** + * The PoliciesInner object to access its operations. + */ + private PoliciesInner policies; + + /** + * Gets the PoliciesInner object to access its operations. + * @return the PoliciesInner object. + */ + public PoliciesInner policies() { + return this.policies; + } + + /** + * The BillingPropertysInner object to access its operations. + */ + private BillingPropertysInner billingPropertys; + + /** + * Gets the BillingPropertysInner object to access its operations. + * @return the BillingPropertysInner object. + */ + public BillingPropertysInner billingPropertys() { + return this.billingPropertys; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The BillingRoleDefinitionsInner object to access its operations. + */ + private BillingRoleDefinitionsInner billingRoleDefinitions; + + /** + * Gets the BillingRoleDefinitionsInner object to access its operations. + * @return the BillingRoleDefinitionsInner object. + */ + public BillingRoleDefinitionsInner billingRoleDefinitions() { + return this.billingRoleDefinitions; + } + + /** + * The BillingRoleAssignmentsInner object to access its operations. + */ + private BillingRoleAssignmentsInner billingRoleAssignments; + + /** + * Gets the BillingRoleAssignmentsInner object to access its operations. + * @return the BillingRoleAssignmentsInner object. + */ + public BillingRoleAssignmentsInner billingRoleAssignments() { + return this.billingRoleAssignments; + } + + /** + * 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; + } + + /** + * The EnrollmentAccountsInner object to access its operations. + */ + private EnrollmentAccountsInner enrollmentAccounts; + + /** + * Gets the EnrollmentAccountsInner object to access its operations. + * @return the EnrollmentAccountsInner object. + */ + public EnrollmentAccountsInner enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * The BillingPeriodsInner object to access its operations. + */ + private BillingPeriodsInner billingPeriods; + + /** + * Gets the BillingPeriodsInner object to access its operations. + * @return the BillingPeriodsInner object. + */ + public BillingPeriodsInner billingPeriods() { + return this.billingPeriods; + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BillingManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.billingAccounts = new BillingAccountsInner(restClient().retrofit(), this); + this.address = new AddressInner(restClient().retrofit(), this); + this.availableBalances = new AvailableBalancesInner(restClient().retrofit(), this); + this.instructions = new InstructionsInner(restClient().retrofit(), this); + this.billingProfiles = new BillingProfilesInner(restClient().retrofit(), this); + this.customers = new CustomersInner(restClient().retrofit(), this); + this.invoiceSections = new InvoiceSectionsInner(restClient().retrofit(), this); + this.billingPermissions = new BillingPermissionsInner(restClient().retrofit(), this); + this.billingSubscriptions = new BillingSubscriptionsInner(restClient().retrofit(), this); + this.products = new ProductsInner(restClient().retrofit(), this); + this.invoices = new InvoicesInner(restClient().retrofit(), this); + this.transactions = new TransactionsInner(restClient().retrofit(), this); + this.policies = new PoliciesInner(restClient().retrofit(), this); + this.billingPropertys = new BillingPropertysInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.billingRoleDefinitions = new BillingRoleDefinitionsInner(restClient().retrofit(), this); + this.billingRoleAssignments = new BillingRoleAssignmentsInner(restClient().retrofit(), this); + this.agreements = new AgreementsInner(restClient().retrofit(), this); + this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this); + this.billingPeriods = new BillingPeriodsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "BillingManagementClient", "2020-05-01"); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManager.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManager.java new file mode 100644 index 0000000000000..a4dc7adba8729 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingManager.java @@ -0,0 +1,327 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.billing.v2020_05_01.BillingAccounts; +import com.microsoft.azure.management.billing.v2020_05_01.Address; +import com.microsoft.azure.management.billing.v2020_05_01.AvailableBalances; +import com.microsoft.azure.management.billing.v2020_05_01.Instructions; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfiles; +import com.microsoft.azure.management.billing.v2020_05_01.Customers; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSections; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPermissions; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions; +import com.microsoft.azure.management.billing.v2020_05_01.Products; +import com.microsoft.azure.management.billing.v2020_05_01.Invoices; +import com.microsoft.azure.management.billing.v2020_05_01.Transactions; +import com.microsoft.azure.management.billing.v2020_05_01.Policies; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPropertys; +import com.microsoft.azure.management.billing.v2020_05_01.Operations; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleDefinitions; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleAssignments; +import com.microsoft.azure.management.billing.v2020_05_01.Agreements; +import com.microsoft.azure.management.billing.v2020_05_01.EnrollmentAccounts; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPeriods; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Billing resource management. + */ +public final class BillingManager extends ManagerCore { + private BillingAccounts billingAccounts; + private Address address; + private AvailableBalances availableBalances; + private Instructions instructions; + private BillingProfiles billingProfiles; + private Customers customers; + private InvoiceSections invoiceSections; + private BillingPermissions billingPermissions; + private BillingSubscriptions billingSubscriptions; + private Products products; + private Invoices invoices; + private Transactions transactions; + private Policies policies; + private BillingPropertys billingPropertys; + private Operations operations; + private BillingRoleDefinitions billingRoleDefinitions; + private BillingRoleAssignments billingRoleAssignments; + private Agreements agreements; + private EnrollmentAccounts enrollmentAccounts; + private BillingPeriods billingPeriods; + /** + * Get a Configurable instance that can be used to create BillingManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new BillingManager.ConfigurableImpl(); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new BillingManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(RestClient restClient, String subscriptionId) { + return new BillingManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of BillingManager that exposes Billing management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Billing management API entry points that work across subscriptions + */ + BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage BillingAccounts. + */ + public BillingAccounts billingAccounts() { + if (this.billingAccounts == null) { + this.billingAccounts = new BillingAccountsImpl(this); + } + return this.billingAccounts; + } + + /** + * @return Entry point to manage Address. + */ + public Address address() { + if (this.address == null) { + this.address = new AddressImpl(this); + } + return this.address; + } + + /** + * @return Entry point to manage AvailableBalances. + */ + public AvailableBalances availableBalances() { + if (this.availableBalances == null) { + this.availableBalances = new AvailableBalancesImpl(this); + } + return this.availableBalances; + } + + /** + * @return Entry point to manage Instructions. + */ + public Instructions instructions() { + if (this.instructions == null) { + this.instructions = new InstructionsImpl(this); + } + return this.instructions; + } + + /** + * @return Entry point to manage BillingProfiles. + */ + public BillingProfiles billingProfiles() { + if (this.billingProfiles == null) { + this.billingProfiles = new BillingProfilesImpl(this); + } + return this.billingProfiles; + } + + /** + * @return Entry point to manage Customers. + */ + public Customers customers() { + if (this.customers == null) { + this.customers = new CustomersImpl(this); + } + return this.customers; + } + + /** + * @return Entry point to manage InvoiceSections. + */ + public InvoiceSections invoiceSections() { + if (this.invoiceSections == null) { + this.invoiceSections = new InvoiceSectionsImpl(this); + } + return this.invoiceSections; + } + + /** + * @return Entry point to manage BillingPermissions. + */ + public BillingPermissions billingPermissions() { + if (this.billingPermissions == null) { + this.billingPermissions = new BillingPermissionsImpl(this); + } + return this.billingPermissions; + } + + /** + * @return Entry point to manage BillingSubscriptions. + */ + public BillingSubscriptions billingSubscriptions() { + if (this.billingSubscriptions == null) { + this.billingSubscriptions = new BillingSubscriptionsImpl(this); + } + return this.billingSubscriptions; + } + + /** + * @return Entry point to manage Products. + */ + public Products products() { + if (this.products == null) { + this.products = new ProductsImpl(this); + } + return this.products; + } + + /** + * @return Entry point to manage Invoices. + */ + public Invoices invoices() { + if (this.invoices == null) { + this.invoices = new InvoicesImpl(this); + } + return this.invoices; + } + + /** + * @return Entry point to manage Transactions. + */ + public Transactions transactions() { + if (this.transactions == null) { + this.transactions = new TransactionsImpl(this); + } + return this.transactions; + } + + /** + * @return Entry point to manage Policies. + */ + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(this); + } + return this.policies; + } + + /** + * @return Entry point to manage BillingPropertys. + */ + public BillingPropertys billingPropertys() { + if (this.billingPropertys == null) { + this.billingPropertys = new BillingPropertysImpl(this); + } + return this.billingPropertys; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage BillingRoleDefinitions. + */ + public BillingRoleDefinitions billingRoleDefinitions() { + if (this.billingRoleDefinitions == null) { + this.billingRoleDefinitions = new BillingRoleDefinitionsImpl(this); + } + return this.billingRoleDefinitions; + } + + /** + * @return Entry point to manage BillingRoleAssignments. + */ + public BillingRoleAssignments billingRoleAssignments() { + if (this.billingRoleAssignments == null) { + this.billingRoleAssignments = new BillingRoleAssignmentsImpl(this); + } + return this.billingRoleAssignments; + } + + /** + * @return Entry point to manage Agreements. + */ + public Agreements agreements() { + if (this.agreements == null) { + this.agreements = new AgreementsImpl(this); + } + return this.agreements; + } + + /** + * @return Entry point to manage EnrollmentAccounts. + */ + public EnrollmentAccounts enrollmentAccounts() { + if (this.enrollmentAccounts == null) { + this.enrollmentAccounts = new EnrollmentAccountsImpl(this); + } + return this.enrollmentAccounts; + } + + /** + * @return Entry point to manage BillingPeriods. + */ + public BillingPeriods billingPeriods() { + if (this.billingPeriods == null) { + this.billingPeriods = new BillingPeriodsImpl(this); + } + return this.billingPeriods; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return BillingManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private BillingManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new BillingManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodImpl.java new file mode 100644 index 0000000000000..7bcd7ae9103b5 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodImpl.java @@ -0,0 +1,72 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingPeriod; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.LocalDate; +import java.util.List; + +class BillingPeriodImpl extends IndexableRefreshableWrapperImpl implements BillingPeriod { + private String billingPeriodName; + private final BillingManager manager; + + BillingPeriodImpl(BillingPeriodInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingPeriodName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingPeriods"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingPeriodsInner client = this.manager().inner().billingPeriods(); + return client.getAsync(this.billingPeriodName); + } + + + + @Override + public LocalDate billingPeriodEndDate() { + return this.inner().billingPeriodEndDate(); + } + + @Override + public LocalDate billingPeriodStartDate() { + return this.inner().billingPeriodStartDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List invoiceIds() { + return this.inner().invoiceIds(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodInner.java new file mode 100644 index 0000000000000..d2a39d7fea066 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodInner.java @@ -0,0 +1,67 @@ +/** + * 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.v2020_05_01.implementation; + +import org.joda.time.LocalDate; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing period resource. + */ +@JsonFlatten +public class BillingPeriodInner extends ProxyResource { + /** + * The start of the date range covered by the billing period. + */ + @JsonProperty(value = "properties.billingPeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate billingPeriodStartDate; + + /** + * The end of the date range covered by the billing period. + */ + @JsonProperty(value = "properties.billingPeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate billingPeriodEndDate; + + /** + * Array of invoice ids that associated with. + */ + @JsonProperty(value = "properties.invoiceIds", access = JsonProperty.Access.WRITE_ONLY) + private List invoiceIds; + + /** + * Get the start of the date range covered by the billing period. + * + * @return the billingPeriodStartDate value + */ + public LocalDate billingPeriodStartDate() { + return this.billingPeriodStartDate; + } + + /** + * Get the end of the date range covered by the billing period. + * + * @return the billingPeriodEndDate value + */ + public LocalDate billingPeriodEndDate() { + return this.billingPeriodEndDate; + } + + /** + * Get array of invoice ids that associated with. + * + * @return the invoiceIds value + */ + public List invoiceIds() { + return this.invoiceIds; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsImpl.java new file mode 100644 index 0000000000000..fffb9ea84a136 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsImpl.java @@ -0,0 +1,80 @@ +/** + * 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. + * jkl + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPeriods; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPeriod; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class BillingPeriodsImpl extends WrapperImpl implements BillingPeriods { + private PagedListConverter converter; + private final BillingManager manager; + + BillingPeriodsImpl(BillingManager manager) { + super(manager.inner().billingPeriods()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(BillingPeriodInner inner) { + return Observable.just((BillingPeriod) wrapModel(inner)); + } + }; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingPeriodImpl wrapModel(BillingPeriodInner inner) { + return new BillingPeriodImpl(inner, manager()); + } + + @Override + public Observable getAsync(String billingPeriodName) { + BillingPeriodsInner client = this.inner(); + return client.getAsync(billingPeriodName) + .map(new Func1() { + @Override + public BillingPeriod call(BillingPeriodInner inner) { + return new BillingPeriodImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + BillingPeriodsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + BillingPeriodsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPeriod call(BillingPeriodInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsInner.java new file mode 100644 index 0000000000000..21838663d2d98 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPeriodsInner.java @@ -0,0 +1,483 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPeriods. + */ +public class BillingPeriodsInner { + /** The Retrofit service to perform REST calls. */ + private BillingPeriodsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPeriodsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPeriodsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPeriodsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPeriods to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPeriodsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingPeriods list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @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.v2020_05_01.BillingPeriods get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("billingPeriodName") String billingPeriodName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPeriods listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @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 PagedList<BillingPeriodInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-03-01-preview"; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), apiVersion, filter, skiptoken, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N billing periods. + * @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 PagedList<BillingPeriodInner> object if successful. + */ + public PagedList list(final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(filter, skiptoken, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N billing periods. + * @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> listAsync(final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N billing periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable> listAsync(final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(filter, skiptoken, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N billing periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(filter, skiptoken, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + ServiceResponse> * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N billing periods. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final String skiptoken, final Integer top) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-03-01-preview"; + return service.list(this.client.subscriptionId(), apiVersion, filter, skiptoken, top, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @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 BillingPeriodInner object if successful. + */ + public BillingPeriodInner get(String billingPeriodName) { + return getWithServiceResponseAsync(billingPeriodName).toBlocking().single().body(); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @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 billingPeriodName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingPeriodName), serviceCallback); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPeriodInner object + */ + public Observable getAsync(String billingPeriodName) { + return getWithServiceResponseAsync(billingPeriodName).map(new Func1, BillingPeriodInner>() { + @Override + public BillingPeriodInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPeriodInner object + */ + public Observable> getWithServiceResponseAsync(String billingPeriodName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null."); + } + final String apiVersion = "2018-03-01-preview"; + return service.get(this.client.subscriptionId(), billingPeriodName, apiVersion, 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); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingPeriodInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPeriodInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsImpl.java new file mode 100644 index 0000000000000..a2de99b877eed --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsImpl.java @@ -0,0 +1,107 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPermissions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPermissionsProperties; + +class BillingPermissionsImpl extends WrapperImpl implements BillingPermissions { + private final BillingManager manager; + + BillingPermissionsImpl(BillingManager manager) { + super(manager.inner().billingPermissions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingPermissionsPropertiesImpl wrapModel(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionsAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + BillingPermissionsInner client = this.inner(); + return client.listByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerAsync(final String billingAccountName, final String customerName) { + BillingPermissionsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsInner.java new file mode 100644 index 0000000000000..11bc48d564a27 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsInner.java @@ -0,0 +1,1009 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPermissions. + */ +public class BillingPermissionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingPermissionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPermissionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPermissionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPermissionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPermissions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPermissionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingPermissions listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPermissions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPermissions listByInvoiceSections" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions") + Observable> listByInvoiceSections(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPermissions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPermissions listByCustomerNext" }) + @GET + Observable> listByCustomerNext(@Url String nextUrl, @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.v2020_05_01.BillingPermissions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.BillingPermissions listByInvoiceSectionsNext" }) + @GET + Observable> listByInvoiceSectionsNext(@Url String nextUrl, @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.v2020_05_01.BillingPermissions listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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> listByCustomerAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerSinglePageAsync(billingAccountName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByInvoiceSections(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionsSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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> listByInvoiceSectionsAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionsSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByInvoiceSectionsAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByInvoiceSectionsWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionsSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionsSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoiceSections(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByCustomerNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByCustomerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByCustomerNextAsync(final String nextPageLink) { + return listByCustomerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByCustomerNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCustomerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByInvoiceSectionsNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceSectionsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByInvoiceSectionsNextAsync(final String nextPageLink) { + return listByInvoiceSectionsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByInvoiceSectionsNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesImpl.java new file mode 100644 index 0000000000000..5fe3b9a7e331d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesImpl.java @@ -0,0 +1,41 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingPermissionsProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; + +class BillingPermissionsPropertiesImpl extends WrapperImpl implements BillingPermissionsProperties { + private final BillingManager manager; + + BillingPermissionsPropertiesImpl(BillingPermissionsPropertiesInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public List notActions() { + return this.inner().notActions(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesInner.java new file mode 100644 index 0000000000000..9e467d4a58234 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPermissionsPropertiesInner.java @@ -0,0 +1,49 @@ +/** + * 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.v2020_05_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of allowed action and not allowed actions a caller has on a billing + * account. + */ +public class BillingPermissionsPropertiesInner { + /** + * The set of actions that the caller is allowed to perform. + */ + @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) + private List actions; + + /** + * The set of actions that the caller is not allowed to perform. + */ + @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) + private List notActions; + + /** + * Get the set of actions that the caller is allowed to perform. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Get the set of actions that the caller is not allowed to perform. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileImpl.java new file mode 100644 index 0000000000000..2624acc8f0104 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileImpl.java @@ -0,0 +1,217 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfile; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRelationshipType; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import com.microsoft.azure.management.billing.v2020_05_01.IndirectRelationshipInfo; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionsOnExpand; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.StatusReasonCode; +import com.microsoft.azure.management.billing.v2020_05_01.SpendingLimit; +import com.microsoft.azure.management.billing.v2020_05_01.TargetCloud; + +class BillingProfileImpl extends CreatableUpdatableImpl implements BillingProfile, BillingProfile.Definition, BillingProfile.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + + BillingProfileImpl(String name, BillingManager manager) { + super(name, new BillingProfileInner()); + this.manager = manager; + // Set resource name + this.billingProfileName = name; + // + } + + BillingProfileImpl(BillingProfileInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingProfileName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.createOrUpdateAsync(this.billingAccountName, this.billingProfileName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.createOrUpdateAsync(this.billingAccountName, this.billingProfileName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.getAsync(this.billingAccountName, this.billingProfileName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public BillingRelationshipType billingRelationshipType() { + return this.inner().billingRelationshipType(); + } + + @Override + public AddressDetails billTo() { + return this.inner().billTo(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public Boolean hasReadAccess() { + return this.inner().hasReadAccess(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public IndirectRelationshipInfo indirectRelationshipInfo() { + return this.inner().indirectRelationshipInfo(); + } + + @Override + public Integer invoiceDay() { + return this.inner().invoiceDay(); + } + + @Override + public Boolean invoiceEmailOptIn() { + return this.inner().invoiceEmailOptIn(); + } + + @Override + public InvoiceSectionsOnExpand invoiceSections() { + return this.inner().invoiceSections(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String poNumber() { + return this.inner().poNumber(); + } + + @Override + public SpendingLimit spendingLimit() { + return this.inner().spendingLimit(); + } + + @Override + public BillingProfileStatus status() { + return this.inner().status(); + } + + @Override + public StatusReasonCode statusReasonCode() { + return this.inner().statusReasonCode(); + } + + @Override + public String systemId() { + return this.inner().systemId(); + } + + @Override + public List targetClouds() { + return this.inner().targetClouds(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingProfileImpl withExistingBillingAccount(String billingAccountName) { + this.billingAccountName = billingAccountName; + return this; + } + + @Override + public BillingProfileImpl withBillTo(AddressDetails billTo) { + this.inner().withBillTo(billTo); + return this; + } + + @Override + public BillingProfileImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public BillingProfileImpl withEnabledAzurePlans(List enabledAzurePlans) { + this.inner().withEnabledAzurePlans(enabledAzurePlans); + return this; + } + + @Override + public BillingProfileImpl withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.inner().withInvoiceEmailOptIn(invoiceEmailOptIn); + return this; + } + + @Override + public BillingProfileImpl withInvoiceSections(InvoiceSectionsOnExpand invoiceSections) { + this.inner().withInvoiceSections(invoiceSections); + return this; + } + + @Override + public BillingProfileImpl withPoNumber(String poNumber) { + this.inner().withPoNumber(poNumber); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileInner.java new file mode 100644 index 0000000000000..053b7be88e821 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfileInner.java @@ -0,0 +1,348 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingRelationshipType; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import com.microsoft.azure.management.billing.v2020_05_01.IndirectRelationshipInfo; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionsOnExpand; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.StatusReasonCode; +import com.microsoft.azure.management.billing.v2020_05_01.SpendingLimit; +import com.microsoft.azure.management.billing.v2020_05_01.TargetCloud; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing profile. + */ +@JsonFlatten +public class BillingProfileInner extends ProxyResource { + /** + * The name of the billing profile. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The purchase order name that will appear on the invoices generated for + * the billing profile. + */ + @JsonProperty(value = "properties.poNumber") + private String poNumber; + + /** + * Identifies which services and purchases are paid by a billing profile. + * Possible values include: 'Direct', 'IndirectCustomer', + * 'IndirectPartner', 'CSPPartner'. + */ + @JsonProperty(value = "properties.billingRelationshipType", access = JsonProperty.Access.WRITE_ONLY) + private BillingRelationshipType billingRelationshipType; + + /** + * Billing address. + */ + @JsonProperty(value = "properties.billTo") + private AddressDetails billTo; + + /** + * Identifies the billing profile that is linked to another billing profile + * in indirect purchase motion. + */ + @JsonProperty(value = "properties.indirectRelationshipInfo", access = JsonProperty.Access.WRITE_ONLY) + private IndirectRelationshipInfo indirectRelationshipInfo; + + /** + * Flag controlling whether the invoices for the billing profile are sent + * through email. + */ + @JsonProperty(value = "properties.invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /** + * The day of the month when the invoice for the billing profile is + * generated. + */ + @JsonProperty(value = "properties.invoiceDay", access = JsonProperty.Access.WRITE_ONLY) + private Integer invoiceDay; + + /** + * The currency in which the charges for the billing profile are billed. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Information about the enabled azure plans. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /** + * The invoice sections associated to the billing profile. By default this + * is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.invoiceSections") + private InvoiceSectionsOnExpand invoiceSections; + + /** + * Indicates whether user has read access to the billing profile. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * The system generated unique identifier for a billing profile. + */ + @JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY) + private String systemId; + + /** + * The status of the billing profile. Possible values include: 'Active', + * 'Disabled', 'Warned'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus status; + + /** + * Reason for the specified billing profile status. Possible values + * include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + */ + @JsonProperty(value = "properties.statusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private StatusReasonCode statusReasonCode; + + /** + * The billing profile spending limit. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "properties.spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /** + * Identifies the cloud environments that are associated with a billing + * profile. This is a system managed optional field and gets updated as the + * billing profile gets associated with accounts in various clouds. + */ + @JsonProperty(value = "properties.targetClouds", access = JsonProperty.Access.WRITE_ONLY) + private List targetClouds; + + /** + * Get the name of the billing profile. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the billing profile. + * + * @param displayName the displayName value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the purchase order name that will appear on the invoices generated for the billing profile. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set the purchase order name that will appear on the invoices generated for the billing profile. + * + * @param poNumber the poNumber value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get identifies which services and purchases are paid by a billing profile. Possible values include: 'Direct', 'IndirectCustomer', 'IndirectPartner', 'CSPPartner'. + * + * @return the billingRelationshipType value + */ + public BillingRelationshipType billingRelationshipType() { + return this.billingRelationshipType; + } + + /** + * Get billing address. + * + * @return the billTo value + */ + public AddressDetails billTo() { + return this.billTo; + } + + /** + * Set billing address. + * + * @param billTo the billTo value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withBillTo(AddressDetails billTo) { + this.billTo = billTo; + return this; + } + + /** + * Get identifies the billing profile that is linked to another billing profile in indirect purchase motion. + * + * @return the indirectRelationshipInfo value + */ + public IndirectRelationshipInfo indirectRelationshipInfo() { + return this.indirectRelationshipInfo; + } + + /** + * Get flag controlling whether the invoices for the billing profile are sent through email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set flag controlling whether the invoices for the billing profile are sent through email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get the day of the month when the invoice for the billing profile is generated. + * + * @return the invoiceDay value + */ + public Integer invoiceDay() { + return this.invoiceDay; + } + + /** + * Get the currency in which the charges for the billing profile are billed. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get information about the enabled azure plans. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set information about the enabled azure plans. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. + * + * @return the invoiceSections value + */ + public InvoiceSectionsOnExpand invoiceSections() { + return this.invoiceSections; + } + + /** + * Set the invoice sections associated to the billing profile. By default this is not populated, unless it's specified in $expand. + * + * @param invoiceSections the invoiceSections value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceSections(InvoiceSectionsOnExpand invoiceSections) { + this.invoiceSections = invoiceSections; + return this; + } + + /** + * Get indicates whether user has read access to the billing profile. + * + * @return the hasReadAccess value + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + + /** + * Get the system generated unique identifier for a billing profile. + * + * @return the systemId value + */ + public String systemId() { + return this.systemId; + } + + /** + * Get the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned'. + * + * @return the status value + */ + public BillingProfileStatus status() { + return this.status; + } + + /** + * Get reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + * + * @return the statusReasonCode value + */ + public StatusReasonCode statusReasonCode() { + return this.statusReasonCode; + } + + /** + * Get the billing profile spending limit. Possible values include: 'Off', 'On'. + * + * @return the spendingLimit value + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + + /** + * Get identifies the cloud environments that are associated with a billing profile. This is a system managed optional field and gets updated as the billing profile gets associated with accounts in various clouds. + * + * @return the targetClouds value + */ + public List targetClouds() { + return this.targetClouds; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesImpl.java new file mode 100644 index 0000000000000..a72954212b01f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesImpl.java @@ -0,0 +1,78 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfiles; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfile; + +class BillingProfilesImpl extends WrapperImpl implements BillingProfiles { + private final BillingManager manager; + + BillingProfilesImpl(BillingManager manager) { + super(manager.inner().billingProfiles()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public BillingProfileImpl define(String name) { + return wrapModel(name); + } + + private BillingProfileImpl wrapModel(BillingProfileInner inner) { + return new BillingProfileImpl(inner, manager()); + } + + private BillingProfileImpl wrapModel(String name) { + return new BillingProfileImpl(name, this.manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingProfilesInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingProfile call(BillingProfileInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName) { + BillingProfilesInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingProfileInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingProfile)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesInner.java new file mode 100644 index 0000000000000..2a777a62bbe8e --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingProfilesInner.java @@ -0,0 +1,739 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfilesCreateOrUpdateHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingProfiles. + */ +public class BillingProfilesInner { + /** The Retrofit service to perform REST calls. */ + private BillingProfilesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingProfilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingProfilesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingProfilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingProfiles to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingProfilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingProfiles listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> listByBillingAccount(@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.v2020_05_01.BillingProfiles get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @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.v2020_05_01.BillingProfiles createOrUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> createOrUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @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.v2020_05_01.BillingProfiles beginCreateOrUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> beginCreateOrUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @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.v2020_05_01.BillingProfiles listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.listByBillingAccount(billingAccountName, apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @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 PagedList<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @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> listByBillingAccountAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountSinglePageAsync(billingAccountName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 BillingProfileInner object if successful. + */ + public BillingProfileInner get(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.get(billingAccountName, billingProfileName, 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); + } + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @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 BillingProfileInner object if successful. + */ + public BillingProfileInner get(String billingAccountName, String billingProfileName, String expand) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, expand).toBlocking().single().body(); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @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 billingProfileName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, expand), serviceCallback); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String expand) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, expand).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, billingProfileName, 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); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @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 BillingProfileInner object if successful. + */ + public BillingProfileInner createOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @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 createOrUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + Observable> observable = service.createOrUpdate(billingAccountName, billingProfileName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingProfilesCreateOrUpdateHeaders.class); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @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 BillingProfileInner object if successful. + */ + public BillingProfileInner beginCreateOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @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 beginCreateOrUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable beginCreateOrUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.beginCreateOrUpdate(billingAccountName, billingProfileName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BillingProfilesCreateOrUpdateHeaders.class); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyImpl.java new file mode 100644 index 0000000000000..51fabc53f4e52 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyImpl.java @@ -0,0 +1,129 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingProperty; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileSpendingLimit; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatusReasonCode; + +class BillingPropertyImpl extends WrapperImpl implements BillingProperty { + private final BillingManager manager; + BillingPropertyImpl(BillingPropertyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String accountAdminNotificationEmailAddress() { + return this.inner().accountAdminNotificationEmailAddress(); + } + + @Override + public String billingAccountDisplayName() { + return this.inner().billingAccountDisplayName(); + } + + @Override + public String billingAccountId() { + return this.inner().billingAccountId(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.inner().billingProfileSpendingLimit(); + } + + @Override + public BillingProfileStatus billingProfileStatus() { + return this.inner().billingProfileStatus(); + } + + @Override + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.inner().billingProfileStatusReasonCode(); + } + + @Override + public String billingTenantId() { + return this.inner().billingTenantId(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public Boolean isAccountAdmin() { + return this.inner().isAccountAdmin(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String productId() { + return this.inner().productId(); + } + + @Override + public String productName() { + return this.inner().productName(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyInner.java new file mode 100644 index 0000000000000..fd4f5c4b87794 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertyInner.java @@ -0,0 +1,293 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatusReasonCode; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileSpendingLimit; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing property. + */ +@JsonFlatten +public class BillingPropertyInner extends ProxyResource { + /** + * The email address on which the account admin gets all Azure + * notifications. + */ + @JsonProperty(value = "properties.accountAdminNotificationEmailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String accountAdminNotificationEmailAddress; + + /** + * The Azure AD tenant ID of the billing account for the subscription. + */ + @JsonProperty(value = "properties.billingTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String billingTenantId; + + /** + * The ID of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /** + * The name of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountDisplayName; + + /** + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The status of the billing profile. Possible values include: 'Active', + * 'Disabled', 'Warned'. + */ + @JsonProperty(value = "properties.billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus billingProfileStatus; + + /** + * Reason for the specified billing profile status. Possible values + * include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + */ + @JsonProperty(value = "properties.billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatusReasonCode billingProfileStatusReasonCode; + + /** + * The billing profile spending limit. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "properties.billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileSpendingLimit billingProfileSpendingLimit; + + /** + * The cost center applied to the subscription. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * Indicates whether user is the account admin. + */ + @JsonProperty(value = "properties.isAccountAdmin", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isAccountAdmin; + + /** + * The product ID of the Azure plan. + */ + @JsonProperty(value = "properties.productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * The product name of the Azure plan. + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /** + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the email address on which the account admin gets all Azure notifications. + * + * @return the accountAdminNotificationEmailAddress value + */ + public String accountAdminNotificationEmailAddress() { + return this.accountAdminNotificationEmailAddress; + } + + /** + * Get the Azure AD tenant ID of the billing account for the subscription. + * + * @return the billingTenantId value + */ + public String billingTenantId() { + return this.billingTenantId; + } + + /** + * Get the ID of the billing account to which the subscription is billed. + * + * @return the billingAccountId value + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the name of the billing account to which the subscription is billed. + * + * @return the billingAccountDisplayName value + */ + public String billingAccountDisplayName() { + return this.billingAccountDisplayName; + } + + /** + * Get the ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned'. + * + * @return the billingProfileStatus value + */ + public BillingProfileStatus billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + * + * @return the billingProfileStatusReasonCode value + */ + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billing profile spending limit. Possible values include: 'Off', 'On'. + * + * @return the billingProfileSpendingLimit value + */ + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get the cost center applied to the subscription. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center applied to the subscription. + * + * @param costCenter the costCenter value to set + * @return the BillingPropertyInner object itself. + */ + public BillingPropertyInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get indicates whether user is the account admin. + * + * @return the isAccountAdmin value + */ + public Boolean isAccountAdmin() { + return this.isAccountAdmin; + } + + /** + * Get the product ID of the Azure plan. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get the product name of the Azure plan. + * + * @return the productName value + */ + public String productName() { + return this.productName; + } + + /** + * Get the sku ID of the Azure plan for the subscription. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the sku description of the Azure plan for the subscription. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysImpl.java new file mode 100644 index 0000000000000..94b1b58fd3158 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysImpl.java @@ -0,0 +1,54 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPropertys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProperty; + +class BillingPropertysImpl extends WrapperImpl implements BillingPropertys { + private final BillingManager manager; + + BillingPropertysImpl(BillingManager manager) { + super(manager.inner().billingPropertys()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync() { + BillingPropertysInner client = this.inner(); + return client.getAsync() + .map(new Func1() { + @Override + public BillingProperty call(BillingPropertyInner inner) { + return new BillingPropertyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync() { + BillingPropertysInner client = this.inner(); + return client.updateAsync() + .map(new Func1() { + @Override + public BillingProperty call(BillingPropertyInner inner) { + return new BillingPropertyImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysInner.java new file mode 100644 index 0000000000000..08cffa67df8fe --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingPropertysInner.java @@ -0,0 +1,278 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2020_05_01.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.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 BillingPropertys. + */ +public class BillingPropertysInner { + /** The Retrofit service to perform REST calls. */ + private BillingPropertysService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPropertysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPropertysInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPropertysService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPropertys to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPropertysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingPropertys get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingPropertys update" }) + @PATCH("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + Observable> update(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BillingPropertyInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @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 BillingPropertyInner object if successful. + */ + public BillingPropertyInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @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(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, BillingPropertyInner>() { + @Override + public BillingPropertyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(this.client.subscriptionId(), apiVersion, 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); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @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 BillingPropertyInner object if successful. + */ + public BillingPropertyInner update() { + return updateWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @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 updateAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(), serviceCallback); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable updateAsync() { + return updateWithServiceResponseAsync().map(new Func1, BillingPropertyInner>() { + @Override + public BillingPropertyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable> updateWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String costCenter = null; + BillingPropertyInner parameters = new BillingPropertyInner(); + parameters.withCostCenter(null); + return service.update(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param costCenter The cost center applied to the subscription. + * @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 BillingPropertyInner object if successful. + */ + public BillingPropertyInner update(String costCenter) { + return updateWithServiceResponseAsync(costCenter).toBlocking().single().body(); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param costCenter The cost center applied to the subscription. + * @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 updateAsync(String costCenter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(costCenter), serviceCallback); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param costCenter The cost center applied to the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable updateAsync(String costCenter) { + return updateWithServiceResponseAsync(costCenter).map(new Func1, BillingPropertyInner>() { + @Override + public BillingPropertyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param costCenter The cost center applied to the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable> updateWithServiceResponseAsync(String costCenter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + BillingPropertyInner parameters = new BillingPropertyInner(); + parameters.withCostCenter(costCenter); + return service.update(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentImpl.java new file mode 100644 index 0000000000000..cb0729e2a25de --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentImpl.java @@ -0,0 +1,106 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleAssignment; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class BillingRoleAssignmentImpl extends IndexableRefreshableWrapperImpl implements BillingRoleAssignment { + private final BillingManager manager; + private String billingAccountName; + private String billingRoleAssignmentName; + + BillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingRoleAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingRoleAssignments"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingRoleAssignmentsInner client = this.manager().inner().billingRoleAssignments(); + return client.getByBillingAccountAsync(this.billingAccountName, this.billingRoleAssignmentName); + } + + + + @Override + public String createdByPrincipalId() { + return this.inner().createdByPrincipalId(); + } + + @Override + public String createdByPrincipalTenantId() { + return this.inner().createdByPrincipalTenantId(); + } + + @Override + public String createdByUserEmailAddress() { + return this.inner().createdByUserEmailAddress(); + } + + @Override + public String createdOn() { + return this.inner().createdOn(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String principalId() { + return this.inner().principalId(); + } + + @Override + public String principalTenantId() { + return this.inner().principalTenantId(); + } + + @Override + public String roleDefinitionId() { + return this.inner().roleDefinitionId(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userAuthenticationType() { + return this.inner().userAuthenticationType(); + } + + @Override + public String userEmailAddress() { + return this.inner().userEmailAddress(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentInner.java new file mode 100644 index 0000000000000..be0f4ecfafb22 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentInner.java @@ -0,0 +1,225 @@ +/** + * 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.v2020_05_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The role assignment. + */ +@JsonFlatten +public class BillingRoleAssignmentInner extends ProxyResource { + /** + * The date the role assignment was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private String createdOn; + + /** + * The tenant Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalTenantId; + + /** + * The principal Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalId; + + /** + * The email address of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByUserEmailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUserEmailAddress; + + /** + * The principal id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalId") + private String principalId; + + /** + * The principal tenant id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalTenantId") + private String principalTenantId; + + /** + * The ID of the role definition. + */ + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; + + /** + * The scope at which the role was assigned. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /** + * The authentication type. + */ + @JsonProperty(value = "properties.userAuthenticationType") + private String userAuthenticationType; + + /** + * The email address of the user. + */ + @JsonProperty(value = "properties.userEmailAddress") + private String userEmailAddress; + + /** + * Get the date the role assignment was created. + * + * @return the createdOn value + */ + public String createdOn() { + return this.createdOn; + } + + /** + * Get the tenant Id of the user who created the role assignment. + * + * @return the createdByPrincipalTenantId value + */ + public String createdByPrincipalTenantId() { + return this.createdByPrincipalTenantId; + } + + /** + * Get the principal Id of the user who created the role assignment. + * + * @return the createdByPrincipalId value + */ + public String createdByPrincipalId() { + return this.createdByPrincipalId; + } + + /** + * Get the email address of the user who created the role assignment. + * + * @return the createdByUserEmailAddress value + */ + public String createdByUserEmailAddress() { + return this.createdByUserEmailAddress; + } + + /** + * Get the principal id of the user to whom the role was assigned. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principal id of the user to whom the role was assigned. + * + * @param principalId the principalId value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principal tenant id of the user to whom the role was assigned. + * + * @return the principalTenantId value + */ + public String principalTenantId() { + return this.principalTenantId; + } + + /** + * Set the principal tenant id of the user to whom the role was assigned. + * + * @param principalTenantId the principalTenantId value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalTenantId(String principalTenantId) { + this.principalTenantId = principalTenantId; + return this; + } + + /** + * Get the ID of the role definition. + * + * @return the roleDefinitionId value + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the ID of the role definition. + * + * @param roleDefinitionId the roleDefinitionId value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the scope at which the role was assigned. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Get the authentication type. + * + * @return the userAuthenticationType value + */ + public String userAuthenticationType() { + return this.userAuthenticationType; + } + + /** + * Set the authentication type. + * + * @param userAuthenticationType the userAuthenticationType value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserAuthenticationType(String userAuthenticationType) { + this.userAuthenticationType = userAuthenticationType; + return this; + } + + /** + * Get the email address of the user. + * + * @return the userEmailAddress value + */ + public String userEmailAddress() { + return this.userEmailAddress; + } + + /** + * Set the email address of the user. + * + * @param userEmailAddress the userEmailAddress value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserEmailAddress(String userEmailAddress) { + this.userEmailAddress = userEmailAddress; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsImpl.java new file mode 100644 index 0000000000000..dde58330101d3 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleAssignments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleAssignment; + +class BillingRoleAssignmentsImpl extends WrapperImpl implements BillingRoleAssignments { + private final BillingManager manager; + + BillingRoleAssignmentsImpl(BillingManager manager) { + super(manager.inner().billingRoleAssignments()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingRoleAssignmentImpl wrapModel(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + + @Override + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingRoleAssignmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingRoleAssignment)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).toCompletable(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsInner.java new file mode 100644 index 0000000000000..e2ce066366f81 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleAssignmentsInner.java @@ -0,0 +1,1326 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleAssignments. + */ +public class BillingRoleAssignmentsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleAssignmentsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleAssignmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingRoleAssignments getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments deleteByBillingAccount" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments getByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments deleteByInvoiceSection" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments deleteByBillingProfile" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleAssignments listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.BillingRoleAssignments listByInvoiceSectionNext" }) + @GET + Observable> listByInvoiceSectionNext(@Url String nextUrl, @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.v2020_05_01.BillingRoleAssignments listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByBillingAccount(billingAccountName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(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); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.deleteByBillingAccount(billingAccountName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingAccountDelegate(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); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionDelegate(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); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.deleteByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByInvoiceSectionDelegate(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); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(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); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @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 deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.deleteByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingProfileDelegate(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); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByInvoiceSection(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByInvoiceSectionWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByInvoiceSectionNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceSectionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByInvoiceSectionNextAsync(final String nextPageLink) { + return listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByInvoiceSectionNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionImpl.java new file mode 100644 index 0000000000000..28c0828b3a911 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionImpl.java @@ -0,0 +1,80 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleDefinition; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2020_05_01.BillingPermissionsProperties; +import java.util.List; + +class BillingRoleDefinitionImpl extends IndexableRefreshableWrapperImpl implements BillingRoleDefinition { + private final BillingManager manager; + private String billingAccountName; + private String billingRoleDefinitionName; + + BillingRoleDefinitionImpl(BillingRoleDefinitionInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingRoleDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingRoleDefinitions"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingRoleDefinitionsInner client = this.manager().inner().billingRoleDefinitions(); + return client.getByBillingAccountAsync(this.billingAccountName, this.billingRoleDefinitionName); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List permissions() { + List lst = new ArrayList(); + if (this.inner().permissions() != null) { + for (BillingPermissionsPropertiesInner inner : this.inner().permissions()) { + lst.add( new BillingPermissionsPropertiesImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String roleName() { + return this.inner().roleName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionInner.java new file mode 100644 index 0000000000000..8a0be8b095f03 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionInner.java @@ -0,0 +1,77 @@ +/** + * 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.v2020_05_01.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The properties of a role definition. + */ +@JsonFlatten +public class BillingRoleDefinitionInner extends ProxyResource { + /** + * The role description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The billingPermissions the role has. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * The name of the role. + */ + @JsonProperty(value = "properties.roleName", access = JsonProperty.Access.WRITE_ONLY) + private String roleName; + + /** + * Get the role description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the billingPermissions the role has. + * + * @return the permissions value + */ + public List permissions() { + return this.permissions; + } + + /** + * Set the billingPermissions the role has. + * + * @param permissions the permissions value to set + * @return the BillingRoleDefinitionInner object itself. + */ + public BillingRoleDefinitionInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the name of the role. + * + * @return the roleName value + */ + public String roleName() { + return this.roleName; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsImpl.java new file mode 100644 index 0000000000000..d94904d5729ec --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsImpl.java @@ -0,0 +1,129 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingRoleDefinition; + +class BillingRoleDefinitionsImpl extends WrapperImpl implements BillingRoleDefinitions { + private final BillingManager manager; + + BillingRoleDefinitionsImpl(BillingManager manager) { + super(manager.inner().billingRoleDefinitions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingRoleDefinitionImpl wrapModel(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + + @Override + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleDefinitionName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingRoleDefinitionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingRoleDefinition)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsInner.java new file mode 100644 index 0000000000000..7e3dc7c817826 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingRoleDefinitionsInner.java @@ -0,0 +1,1049 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleDefinitions. + */ +public class BillingRoleDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleDefinitionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleDefinitionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingRoleDefinitions getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions getByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingRoleDefinitions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.BillingRoleDefinitions listByInvoiceSectionNext" }) + @GET + Observable> listByInvoiceSectionNext(@Url String nextUrl, @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.v2020_05_01.BillingRoleDefinitions listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingAccount(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByBillingAccount(billingAccountName, billingRoleDefinitionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(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); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionDelegate(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); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByBillingProfile(billingAccountName, billingProfileName, billingRoleDefinitionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(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); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByInvoiceSection(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByInvoiceSectionWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByInvoiceSectionNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceSectionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByInvoiceSectionNextAsync(final String nextPageLink) { + return listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByInvoiceSectionNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionImpl.java new file mode 100644 index 0000000000000..432e5b7b24802 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionImpl.java @@ -0,0 +1,179 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscription; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.UUID; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptionStatusType; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; + +class BillingSubscriptionImpl extends CreatableUpdatableImpl implements BillingSubscription, BillingSubscription.Update { + private final BillingManager manager; + private String billingAccountName; + + BillingSubscriptionImpl(String name, BillingManager manager) { + super(name, new BillingSubscriptionInner()); + this.manager = manager; + // Set resource name + this.billingAccountName = name; + // + } + + BillingSubscriptionImpl(BillingSubscriptionInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingAccountName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingSubscriptionsInner client = this.manager().inner().billingSubscriptions(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + BillingSubscriptionsInner client = this.manager().inner().billingSubscriptions(); + return client.updateAsync(this.billingAccountName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BillingSubscriptionsInner client = this.manager().inner().billingSubscriptions(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public Amount lastMonthCharges() { + return this.inner().lastMonthCharges(); + } + + @Override + public Amount monthToDateCharges() { + return this.inner().monthToDateCharges(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Reseller reseller() { + return this.inner().reseller(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.inner().subscriptionBillingStatus(); + } + + @Override + public UUID subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingSubscriptionImpl withCostCenter(String costCenter) { + this.inner().withCostCenter(costCenter); + return this; + } + + @Override + public BillingSubscriptionImpl withSkuId(String skuId) { + this.inner().withSkuId(skuId); + return this; + } + + @Override + public BillingSubscriptionImpl withSubscriptionBillingStatus(BillingSubscriptionStatusType subscriptionBillingStatus) { + this.inner().withSubscriptionBillingStatus(subscriptionBillingStatus); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionInner.java new file mode 100644 index 0000000000000..1713c15337b52 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionInner.java @@ -0,0 +1,286 @@ +/** + * 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.v2020_05_01.implementation; + +import java.util.UUID; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptionStatusType; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing subscription. + */ +@JsonFlatten +public class BillingSubscriptionInner extends ProxyResource { + /** + * The name of the subscription. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The ID of the subscription. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionId; + + /** + * The current billing status of the subscription. Possible values include: + * 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + */ + @JsonProperty(value = "properties.subscriptionBillingStatus") + private BillingSubscriptionStatusType subscriptionBillingStatus; + + /** + * The last month charges. + */ + @JsonProperty(value = "properties.lastMonthCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastMonthCharges; + + /** + * The current month to date charges. + */ + @JsonProperty(value = "properties.monthToDateCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount monthToDateCharges; + + /** + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The cost center applied to the subscription. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The ID of the customer for whom the subscription was created. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for whom the subscription was created. The + * field is applicable only for Microsoft Partner Agreement billing + * account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * Reseller for this subscription. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId") + private String skuId; + + /** + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the name of the subscription. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the ID of the subscription. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @return the subscriptionBillingStatus value + */ + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.subscriptionBillingStatus; + } + + /** + * Set the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @param subscriptionBillingStatus the subscriptionBillingStatus value to set + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSubscriptionBillingStatus(BillingSubscriptionStatusType subscriptionBillingStatus) { + this.subscriptionBillingStatus = subscriptionBillingStatus; + return this; + } + + /** + * Get the last month charges. + * + * @return the lastMonthCharges value + */ + public Amount lastMonthCharges() { + return this.lastMonthCharges; + } + + /** + * Get the current month to date charges. + * + * @return the monthToDateCharges value + */ + public Amount monthToDateCharges() { + return this.monthToDateCharges; + } + + /** + * Get the ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the cost center applied to the subscription. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center applied to the subscription. + * + * @param costCenter the costCenter value to set + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the ID of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get reseller for this subscription. + * + * @return the reseller value + */ + public Reseller reseller() { + return this.reseller; + } + + /** + * Get the sku ID of the Azure plan for the subscription. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the sku ID of the Azure plan for the subscription. + * + * @param skuId the skuId value to set + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the sku description of the Azure plan for the subscription. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsImpl.java new file mode 100644 index 0000000000000..dee4fc1a03845 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsImpl.java @@ -0,0 +1,144 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscription; +import com.microsoft.azure.management.billing.v2020_05_01.ValidateSubscriptionTransferEligibilityResult; + +class BillingSubscriptionsImpl extends WrapperImpl implements BillingSubscriptions { + private final BillingManager manager; + + BillingSubscriptionsImpl(BillingManager manager) { + super(manager.inner().billingSubscriptions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingSubscriptionImpl wrapModel(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName) { + BillingSubscriptionsInner client = this.inner(); + return client.getAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable moveAsync(String billingAccountName, String destinationInvoiceSectionId) { + BillingSubscriptionsInner client = this.inner(); + return client.moveAsync(billingAccountName, destinationInvoiceSectionId) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateMoveAsync(String billingAccountName, String destinationInvoiceSectionId) { + BillingSubscriptionsInner client = this.inner(); + return client.validateMoveAsync(billingAccountName, destinationInvoiceSectionId) + .map(new Func1() { + @Override + public ValidateSubscriptionTransferEligibilityResult call(ValidateSubscriptionTransferEligibilityResultInner inner) { + return new ValidateSubscriptionTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerAsync(final String billingAccountName, final String customerName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsInner.java new file mode 100644 index 0000000000000..215df4e864f53 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/BillingSubscriptionsInner.java @@ -0,0 +1,1441 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptionsMoveHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.management.billing.v2020_05_01.TransferBillingSubscriptionRequestProperties; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingSubscriptions. + */ +public class BillingSubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingSubscriptionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingSubscriptionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingSubscriptions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingSubscriptions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingSubscriptions listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingSubscriptions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @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.v2020_05_01.BillingSubscriptions update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body BillingSubscriptionInner parameters, @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.v2020_05_01.BillingSubscriptions move" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move") + Observable> move(@Path("billingAccountName") String billingAccountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferBillingSubscriptionRequestProperties parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions beginMove" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move") + Observable> beginMove(@Path("billingAccountName") String billingAccountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferBillingSubscriptionRequestProperties parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions validateMove" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility") + Observable> validateMove(@Path("billingAccountName") String billingAccountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferBillingSubscriptionRequestProperties parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.BillingSubscriptions listByCustomerNext" }) + @GET + Observable> listByCustomerNext(@Url String nextUrl, @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.v2020_05_01.BillingSubscriptions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.BillingSubscriptions listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @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.v2020_05_01.BillingSubscriptions listByInvoiceSectionNext" }) + @GET + Observable> listByInvoiceSectionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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> listByCustomerAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerSinglePageAsync(billingAccountName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByInvoiceSection(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByInvoiceSectionWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner get(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable getAsync(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, this.client.subscriptionId(), apiVersion, 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); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner update(String billingAccountName, BillingSubscriptionInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @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 updateAsync(String billingAccountName, BillingSubscriptionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable updateAsync(String billingAccountName, BillingSubscriptionInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, BillingSubscriptionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.update(billingAccountName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner move(String billingAccountName, String destinationInvoiceSectionId) { + return moveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).toBlocking().last().body(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 moveAsync(String billingAccountName, String destinationInvoiceSectionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(moveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId), serviceCallback); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable moveAsync(String billingAccountName, String destinationInvoiceSectionId) { + return moveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> moveWithServiceResponseAsync(String billingAccountName, String destinationInvoiceSectionId) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (destinationInvoiceSectionId == null) { + throw new IllegalArgumentException("Parameter destinationInvoiceSectionId is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); + parameters.withDestinationInvoiceSectionId(destinationInvoiceSectionId); + Observable> observable = service.move(billingAccountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsMoveHeaders.class); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner beginMove(String billingAccountName, String destinationInvoiceSectionId) { + return beginMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).toBlocking().single().body(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 beginMoveAsync(String billingAccountName, String destinationInvoiceSectionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId), serviceCallback); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable beginMoveAsync(String billingAccountName, String destinationInvoiceSectionId) { + return beginMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable> beginMoveWithServiceResponseAsync(String billingAccountName, String destinationInvoiceSectionId) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (destinationInvoiceSectionId == null) { + throw new IllegalArgumentException("Parameter destinationInvoiceSectionId is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); + parameters.withDestinationInvoiceSectionId(destinationInvoiceSectionId); + return service.beginMove(billingAccountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginMoveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginMoveDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BillingSubscriptionsMoveHeaders.class); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 ValidateSubscriptionTransferEligibilityResultInner object if successful. + */ + public ValidateSubscriptionTransferEligibilityResultInner validateMove(String billingAccountName, String destinationInvoiceSectionId) { + return validateMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).toBlocking().single().body(); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section 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 validateMoveAsync(String billingAccountName, String destinationInvoiceSectionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId), serviceCallback); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable validateMoveAsync(String billingAccountName, String destinationInvoiceSectionId) { + return validateMoveWithServiceResponseAsync(billingAccountName, destinationInvoiceSectionId).map(new Func1, ValidateSubscriptionTransferEligibilityResultInner>() { + @Override + public ValidateSubscriptionTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable> validateMoveWithServiceResponseAsync(String billingAccountName, String destinationInvoiceSectionId) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (destinationInvoiceSectionId == null) { + throw new IllegalArgumentException("Parameter destinationInvoiceSectionId is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); + parameters.withDestinationInvoiceSectionId(destinationInvoiceSectionId); + return service.validateMove(billingAccountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateMoveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateMoveDelegate(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); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByCustomerNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByCustomerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByCustomerNextAsync(final String nextPageLink) { + return listByCustomerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByCustomerNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCustomerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<BillingSubscriptionInner> object if successful. + */ + public PagedList listByInvoiceSectionNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceSectionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByInvoiceSectionNextAsync(final String nextPageLink) { + return listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByInvoiceSectionNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerImpl.java new file mode 100644 index 0000000000000..0f49fdda051c8 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerImpl.java @@ -0,0 +1,73 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Customer; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; + +class CustomerImpl extends WrapperImpl implements Customer { + private final BillingManager manager; + + CustomerImpl(CustomerInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List resellers() { + return this.inner().resellers(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerInner.java new file mode 100644 index 0000000000000..64f556086bb78 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerInner.java @@ -0,0 +1,132 @@ +/** + * 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.v2020_05_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A partner's customer. + */ +@JsonFlatten +public class CustomerInner extends ProxyResource { + /** + * The ID of the billing profile for the invoice section. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile for the invoice section. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The name of the customer. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Azure plans enabled for the customer. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /** + * The list of resellers for which an Azure plan is enabled for the + * customer. + */ + @JsonProperty(value = "properties.resellers") + private List resellers; + + /** + * Get the ID of the billing profile for the invoice section. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the name of the customer. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the customer. + * + * @param displayName the displayName value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get azure plans enabled for the customer. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set azure plans enabled for the customer. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the list of resellers for which an Azure plan is enabled for the customer. + * + * @return the resellers value + */ + public List resellers() { + return this.resellers; + } + + /** + * Set the list of resellers for which an Azure plan is enabled for the customer. + * + * @param resellers the resellers value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withResellers(List resellers) { + this.resellers = resellers; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyImpl.java new file mode 100644 index 0000000000000..826a8a2cc7a29 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyImpl.java @@ -0,0 +1,47 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.CustomerPolicy; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.ViewCharges; + +class CustomerPolicyImpl extends WrapperImpl implements CustomerPolicy { + private final BillingManager manager; + CustomerPolicyImpl(CustomerPolicyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ViewCharges viewCharges() { + return this.inner().viewCharges(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyInner.java new file mode 100644 index 0000000000000..15db84b845894 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomerPolicyInner.java @@ -0,0 +1,49 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ViewCharges; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The customer's Policy. + */ +@JsonFlatten +public class CustomerPolicyInner extends ProxyResource { + /** + * The policy that controls whether the users in customer's organization + * can view charges at pay-as-you-go prices. Possible values include: + * 'Allowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewCharges viewCharges; + + /** + * Get the policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the viewCharges value + */ + public ViewCharges viewCharges() { + return this.viewCharges; + } + + /** + * Set the policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param viewCharges the viewCharges value to set + * @return the CustomerPolicyInner object itself. + */ + public CustomerPolicyInner withViewCharges(ViewCharges viewCharges) { + this.viewCharges = viewCharges; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersImpl.java new file mode 100644 index 0000000000000..98935a657817b --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersImpl.java @@ -0,0 +1,83 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Customers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Customer; + +class CustomersImpl extends WrapperImpl implements Customers { + private final BillingManager manager; + + CustomersImpl(BillingManager manager) { + super(manager.inner().customers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private CustomerImpl wrapModel(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + CustomersInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String customerName) { + CustomersInner client = this.inner(); + return client.getAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + CustomersInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersInner.java new file mode 100644 index 0000000000000..6fd11ab04d1a9 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/CustomersInner.java @@ -0,0 +1,930 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Customers. + */ +public class CustomersInner { + /** The Retrofit service to perform REST calls. */ + private CustomersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of CustomersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(CustomersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Customers to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Customers listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("$search") String search, @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.v2020_05_01.Customers listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$search") String search, @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.v2020_05_01.Customers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @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.v2020_05_01.Customers listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @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.v2020_05_01.Customers listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String search = null; + final String filter = null; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, search, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String search, final String filter) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String search, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String search, final String filter) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, search, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String search, final String filter) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + ServiceResponse> * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String search, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, search, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String search = null; + final String filter = null; + return service.listByBillingAccount(billingAccountName, apiVersion, search, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String search, final String filter) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, search, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @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> listByBillingAccountAsync(final String billingAccountName, final String search, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, search, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String search, final String filter) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, search, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String search, final String filter) { + return listByBillingAccountSinglePageAsync(billingAccountName, search, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param search Used for searching customers by their name. Any customer with name containing the search text will be included in the response + ServiceResponse> * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String search, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, search, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String expand = null; + return service.get(billingAccountName, customerName, 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); + } + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @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 CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).toBlocking().single().body(); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @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 customerName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName, expand), serviceCallback); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, customerName, 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); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlImpl.java new file mode 100644 index 0000000000000..e75c5b569a7e1 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlImpl.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.DownloadUrl; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class DownloadUrlImpl extends WrapperImpl implements DownloadUrl { + private final BillingManager manager; + DownloadUrlImpl(DownloadUrlInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public DateTime expiryTime() { + return this.inner().expiryTime(); + } + + @Override + public String url() { + return this.inner().url(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlInner.java new file mode 100644 index 0000000000000..d09a32717cf44 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/DownloadUrlInner.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.v2020_05_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A secure URL that can be used to download a an entity until the URL expires. + */ +public class DownloadUrlInner { + /** + * The time in UTC when the download URL will expire. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * The URL to the PDF file. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the time in UTC when the download URL will expire. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the URL to the PDF file. + * + * @return the url value + */ + public String url() { + return this.url; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountInner.java new file mode 100644 index 0000000000000..be39caeda1d39 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountInner.java @@ -0,0 +1,205 @@ +/** + * 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.v2020_05_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.Department; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An enrollment account. + */ +@JsonFlatten +public class EnrollmentAccountInner extends ProxyResource { + /** + * The name of the enrollment account. + */ + @JsonProperty(value = "properties.accountName") + private String accountName; + + /** + * The cost center associated with the enrollment account. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The owner of the enrollment account. + */ + @JsonProperty(value = "properties.accountOwner") + private String accountOwner; + + /** + * The status of the enrollment account. + */ + @JsonProperty(value = "properties.status") + private String status; + + /** + * The start date of the enrollment account. + */ + @JsonProperty(value = "properties.startDate") + private DateTime startDate; + + /** + * The end date of the enrollment account. + */ + @JsonProperty(value = "properties.endDate") + private DateTime endDate; + + /** + * Associated department. By default this is not populated, unless it's + * specified in $expand. + */ + @JsonProperty(value = "properties.department") + private Department department; + + /** + * Get the name of the enrollment account. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the name of the enrollment account. + * + * @param accountName the accountName value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the cost center associated with the enrollment account. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the enrollment account. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the owner of the enrollment account. + * + * @return the accountOwner value + */ + public String accountOwner() { + return this.accountOwner; + } + + /** + * Set the owner of the enrollment account. + * + * @param accountOwner the accountOwner value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withAccountOwner(String accountOwner) { + this.accountOwner = accountOwner; + return this; + } + + /** + * Get the status of the enrollment account. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the enrollment account. + * + * @param status the status value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the start date of the enrollment account. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment account. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment account. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment account. + * + * @param endDate the endDate value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get associated department. By default this is not populated, unless it's specified in $expand. + * + * @return the department value + */ + public Department department() { + return this.department; + } + + /** + * Set associated department. By default this is not populated, unless it's specified in $expand. + * + * @param department the department value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withDepartment(Department department) { + this.department = department; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryImpl.java new file mode 100644 index 0000000000000..c7332898bed0c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryImpl.java @@ -0,0 +1,46 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.EnrollmentAccountSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class EnrollmentAccountSummaryImpl extends WrapperImpl implements EnrollmentAccountSummary { + private final BillingManager manager; + EnrollmentAccountSummaryImpl(EnrollmentAccountSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String principalName() { + return this.inner().principalName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryInner.java new file mode 100644 index 0000000000000..876117c337c39 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountSummaryInner.java @@ -0,0 +1,35 @@ +/** + * 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.v2020_05_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An enrollment account resource. + */ +@JsonFlatten +public class EnrollmentAccountSummaryInner extends ProxyResource { + /** + * The account owner's principal name. + */ + @JsonProperty(value = "properties.principalName", access = JsonProperty.Access.WRITE_ONLY) + private String principalName; + + /** + * Get the account owner's principal name. + * + * @return the principalName value + */ + public String principalName() { + return this.principalName; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsImpl.java new file mode 100644 index 0000000000000..0c214ad76c331 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsImpl.java @@ -0,0 +1,61 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.EnrollmentAccounts; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.EnrollmentAccountSummary; + +class EnrollmentAccountsImpl extends WrapperImpl implements EnrollmentAccounts { + private final BillingManager manager; + + EnrollmentAccountsImpl(BillingManager manager) { + super(manager.inner().enrollmentAccounts()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String name) { + EnrollmentAccountsInner client = this.inner(); + return client.getAsync(name) + .map(new Func1() { + @Override + public EnrollmentAccountSummary call(EnrollmentAccountSummaryInner inner) { + return new EnrollmentAccountSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + EnrollmentAccountsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EnrollmentAccountSummary call(EnrollmentAccountSummaryInner inner) { + return new EnrollmentAccountSummaryImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsInner.java new file mode 100644 index 0000000000000..9b11f61946121 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/EnrollmentAccountsInner.java @@ -0,0 +1,361 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EnrollmentAccounts. + */ +public class EnrollmentAccountsInner { + /** The Retrofit service to perform REST calls. */ + private EnrollmentAccountsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of EnrollmentAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(EnrollmentAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EnrollmentAccounts to be + * 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.v2020_05_01.EnrollmentAccounts list" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts") + Observable> list(@Query("api-version") String apiVersion, @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.v2020_05_01.EnrollmentAccounts get" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts/{name}") + Observable> get(@Path("name") String name, @Query("api-version") String apiVersion, @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.v2020_05_01.EnrollmentAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @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 PagedList<EnrollmentAccountSummaryInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountSummaryInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountSummaryInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2018-03-01-preview"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @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 EnrollmentAccountSummaryInner object if successful. + */ + public EnrollmentAccountSummaryInner get(String name) { + return getWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @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 name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountSummaryInner object + */ + public Observable getAsync(String name) { + return getWithServiceResponseAsync(name).map(new Func1, EnrollmentAccountSummaryInner>() { + @Override + public EnrollmentAccountSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountSummaryInner object + */ + public Observable> getWithServiceResponseAsync(String name) { + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2018-03-01-preview"; + return service.get(name, apiVersion, 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); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<EnrollmentAccountSummaryInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountSummaryInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountSummaryInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/IdParsingUtils.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f912ca746ffd2 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2020_05_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionImpl.java new file mode 100644 index 0000000000000..2cb61e5cd067f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionImpl.java @@ -0,0 +1,139 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Instruction; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class InstructionImpl extends CreatableUpdatableImpl implements Instruction, Instruction.Definition, Instruction.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String instructionName; + + InstructionImpl(String name, BillingManager manager) { + super(name, new InstructionInner()); + this.manager = manager; + // Set resource name + this.instructionName = name; + // + } + + InstructionImpl(InstructionInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.instructionName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + this.instructionName = IdParsingUtils.getValueFromIdByName(inner.id(), "instructions"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.putAsync(this.billingAccountName, this.billingProfileName, this.instructionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.putAsync(this.billingAccountName, this.billingProfileName, this.instructionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.getAsync(this.billingAccountName, this.billingProfileName, this.instructionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public double amount() { + return this.inner().amount(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InstructionImpl withExistingBillingProfile(String billingAccountName, String billingProfileName) { + this.billingAccountName = billingAccountName; + this.billingProfileName = billingProfileName; + return this; + } + + @Override + public InstructionImpl withAmount(double amount) { + this.inner().withAmount(amount); + return this; + } + + @Override + public InstructionImpl withEndDate(DateTime endDate) { + this.inner().withEndDate(endDate); + return this; + } + + @Override + public InstructionImpl withStartDate(DateTime startDate) { + this.inner().withStartDate(startDate); + return this; + } + + @Override + public InstructionImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionInner.java new file mode 100644 index 0000000000000..7b337da62fc29 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionInner.java @@ -0,0 +1,125 @@ +/** + * 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.v2020_05_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An instruction. + */ +@JsonFlatten +public class InstructionInner extends ProxyResource { + /** + * The amount budgeted for this billing instruction. + */ + @JsonProperty(value = "properties.amount", required = true) + private double amount; + + /** + * The date this billing instruction goes into effect. + */ + @JsonProperty(value = "properties.startDate", required = true) + private DateTime startDate; + + /** + * The date this billing instruction is no longer in effect. + */ + @JsonProperty(value = "properties.endDate", required = true) + private DateTime endDate; + + /** + * The date this billing instruction was created. + */ + @JsonProperty(value = "properties.creationDate") + private DateTime creationDate; + + /** + * Get the amount budgeted for this billing instruction. + * + * @return the amount value + */ + public double amount() { + return this.amount; + } + + /** + * Set the amount budgeted for this billing instruction. + * + * @param amount the amount value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withAmount(double amount) { + this.amount = amount; + return this; + } + + /** + * Get the date this billing instruction goes into effect. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the date this billing instruction goes into effect. + * + * @param startDate the startDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the date this billing instruction is no longer in effect. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the date this billing instruction is no longer in effect. + * + * @param endDate the endDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the date this billing instruction was created. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the date this billing instruction was created. + * + * @param creationDate the creationDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsImpl.java new file mode 100644 index 0000000000000..e522576244214 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsImpl.java @@ -0,0 +1,78 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Instructions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Instruction; + +class InstructionsImpl extends WrapperImpl implements Instructions { + private final BillingManager manager; + + InstructionsImpl(BillingManager manager) { + super(manager.inner().instructions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public InstructionImpl define(String name) { + return wrapModel(name); + } + + private InstructionImpl wrapModel(InstructionInner inner) { + return new InstructionImpl(inner, manager()); + } + + private InstructionImpl wrapModel(String name) { + return new InstructionImpl(name, this.manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + InstructionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Instruction call(InstructionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String instructionName) { + InstructionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, instructionName) + .flatMap(new Func1>() { + @Override + public Observable call(InstructionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Instruction)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsInner.java new file mode 100644 index 0000000000000..e29f75d8d8aae --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InstructionsInner.java @@ -0,0 +1,494 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Instructions. + */ +public class InstructionsInner { + /** The Retrofit service to perform REST calls. */ + private InstructionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InstructionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstructionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InstructionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Instructions to be + * used by Retrofit to perform actually REST calls. + */ + interface InstructionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Instructions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.Instructions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("instructionName") String instructionName, @Query("api-version") String apiVersion, @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.v2020_05_01.Instructions put" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}") + Observable> put(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("instructionName") String instructionName, @Query("api-version") String apiVersion, @Body InstructionInner parameters, @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.v2020_05_01.Instructions listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<InstructionInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstructionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @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 InstructionInner object if successful. + */ + public InstructionInner get(String billingAccountName, String billingProfileName, String instructionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName).toBlocking().single().body(); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @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 billingProfileName, String instructionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName), serviceCallback); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String instructionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName).map(new Func1, InstructionInner>() { + @Override + public InstructionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String instructionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (instructionName == null) { + throw new IllegalArgumentException("Parameter instructionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, billingProfileName, instructionName, apiVersion, 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); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @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 InstructionInner object if successful. + */ + public InstructionInner put(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @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 putAsync(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters), serviceCallback); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable putAsync(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters).map(new Func1, InstructionInner>() { + @Override + public InstructionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable> putWithServiceResponseAsync(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (instructionName == null) { + throw new IllegalArgumentException("Parameter instructionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.put(billingAccountName, billingProfileName, instructionName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = putDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse putDelegate(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); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InstructionInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstructionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceImpl.java new file mode 100644 index 0000000000000..9734576ca9223 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceImpl.java @@ -0,0 +1,191 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Invoice; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.Document; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceDocumentType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceType; +import com.microsoft.azure.management.billing.v2020_05_01.PaymentProperties; +import java.util.Map; +import com.microsoft.azure.management.billing.v2020_05_01.RebillDetails; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceStatus; + +class InvoiceImpl extends IndexableRefreshableWrapperImpl implements Invoice { + private final BillingManager manager; + private String billingAccountName; + private String invoiceName; + + InvoiceImpl(InvoiceInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.invoiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoices"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + InvoicesInner client = this.manager().inner().invoices(); + return client.getAsync(this.billingAccountName, this.invoiceName); + } + + + + @Override + public Amount amountDue() { + return this.inner().amountDue(); + } + + @Override + public Amount azurePrepaymentApplied() { + return this.inner().azurePrepaymentApplied(); + } + + @Override + public Amount billedAmount() { + return this.inner().billedAmount(); + } + + @Override + public String billedDocumentId() { + return this.inner().billedDocumentId(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public Amount creditAmount() { + return this.inner().creditAmount(); + } + + @Override + public String creditForDocumentId() { + return this.inner().creditForDocumentId(); + } + + @Override + public List documents() { + return this.inner().documents(); + } + + @Override + public InvoiceDocumentType documentType() { + return this.inner().documentType(); + } + + @Override + public DateTime dueDate() { + return this.inner().dueDate(); + } + + @Override + public Amount freeAzureCreditApplied() { + return this.inner().freeAzureCreditApplied(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime invoiceDate() { + return this.inner().invoiceDate(); + } + + @Override + public DateTime invoicePeriodEndDate() { + return this.inner().invoicePeriodEndDate(); + } + + @Override + public DateTime invoicePeriodStartDate() { + return this.inner().invoicePeriodStartDate(); + } + + @Override + public InvoiceType invoiceType() { + return this.inner().invoiceType(); + } + + @Override + public Boolean isMonthlyInvoice() { + return this.inner().isMonthlyInvoice(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List payments() { + return this.inner().payments(); + } + + @Override + public String purchaseOrderNumber() { + return this.inner().purchaseOrderNumber(); + } + + @Override + public Map rebillDetails() { + return this.inner().rebillDetails(); + } + + @Override + public InvoiceStatus status() { + return this.inner().status(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public Amount subTotal() { + return this.inner().subTotal(); + } + + @Override + public Amount taxAmount() { + return this.inner().taxAmount(); + } + + @Override + public Amount totalAmount() { + return this.inner().totalAmount(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceInner.java new file mode 100644 index 0000000000000..2631361511566 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceInner.java @@ -0,0 +1,422 @@ +/** + * 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.v2020_05_01.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceStatus; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceType; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.Document; +import com.microsoft.azure.management.billing.v2020_05_01.PaymentProperties; +import java.util.Map; +import com.microsoft.azure.management.billing.v2020_05_01.RebillDetails; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceDocumentType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice. + */ +@JsonFlatten +public class InvoiceInner extends ProxyResource { + /** + * The due date for the invoice. + */ + @JsonProperty(value = "properties.dueDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dueDate; + + /** + * The date when the invoice was generated. + */ + @JsonProperty(value = "properties.invoiceDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoiceDate; + + /** + * The current status of the invoice. Possible values include: 'Due', + * 'OverDue', 'Paid', 'Void'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceStatus status; + + /** + * The amount due as of now. + */ + @JsonProperty(value = "properties.amountDue", access = JsonProperty.Access.WRITE_ONLY) + private Amount amountDue; + + /** + * The amount of Azure prepayment applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.azurePrepaymentApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azurePrepaymentApplied; + + /** + * The total charges for the invoice billing period. + */ + @JsonProperty(value = "properties.billedAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount billedAmount; + + /** + * The total refund for returns and cancellations during the invoice + * billing period. This field is applicable to billing accounts with + * agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.creditAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount creditAmount; + + /** + * The amount of free Azure credits applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.freeAzureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount freeAzureCreditApplied; + + /** + * The pre-tax amount due. This field is applicable to billing accounts + * with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /** + * The amount of tax charged for the billing period. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.taxAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount taxAmount; + + /** + * The amount due when the invoice was generated. This field is applicable + * to billing accounts with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.totalAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount totalAmount; + + /** + * The start date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodStartDate; + + /** + * The end date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodEndDate; + + /** + * Invoice type. Possible values include: 'AzureService', + * 'AzureMarketplace', 'AzureSupport'. + */ + @JsonProperty(value = "properties.invoiceType", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceType invoiceType; + + /** + * Specifies if the invoice is generated as part of monthly invoicing cycle + * or not. This field is applicable to billing accounts with agreement type + * Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.isMonthlyInvoice", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMonthlyInvoice; + + /** + * The ID of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * An optional purchase order number for the invoice. + */ + @JsonProperty(value = "properties.purchaseOrderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String purchaseOrderNumber; + + /** + * List of documents available to download such as invoice and tax receipt. + */ + @JsonProperty(value = "properties.documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * List of payments. + */ + @JsonProperty(value = "properties.payments", access = JsonProperty.Access.WRITE_ONLY) + private List payments; + + /** + * Rebill details for an invoice. + */ + @JsonProperty(value = "properties.rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + private Map rebillDetails; + + /** + * The type of the document. Possible values include: 'Invoice', + * 'CreditNote'. + */ + @JsonProperty(value = "properties.documentType", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceDocumentType documentType; + + /** + * The Id of the active invoice which is originally billed after this + * invoice was voided. This field is applicable to the void invoices only. + */ + @JsonProperty(value = "properties.billedDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String billedDocumentId; + + /** + * The Id of the invoice which got voided and this credit note was issued + * as a result. This field is applicable to the credit notes only. + */ + @JsonProperty(value = "properties.creditForDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String creditForDocumentId; + + /** + * The ID of the subscription for which the invoice is generated. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * Get the due date for the invoice. + * + * @return the dueDate value + */ + public DateTime dueDate() { + return this.dueDate; + } + + /** + * Get the date when the invoice was generated. + * + * @return the invoiceDate value + */ + public DateTime invoiceDate() { + return this.invoiceDate; + } + + /** + * Get the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid', 'Void'. + * + * @return the status value + */ + public InvoiceStatus status() { + return this.status; + } + + /** + * Get the amount due as of now. + * + * @return the amountDue value + */ + public Amount amountDue() { + return this.amountDue; + } + + /** + * Get the amount of Azure prepayment applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the azurePrepaymentApplied value + */ + public Amount azurePrepaymentApplied() { + return this.azurePrepaymentApplied; + } + + /** + * Get the total charges for the invoice billing period. + * + * @return the billedAmount value + */ + public Amount billedAmount() { + return this.billedAmount; + } + + /** + * Get the total refund for returns and cancellations during the invoice billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the creditAmount value + */ + public Amount creditAmount() { + return this.creditAmount; + } + + /** + * Get the amount of free Azure credits applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the freeAzureCreditApplied value + */ + public Amount freeAzureCreditApplied() { + return this.freeAzureCreditApplied; + } + + /** + * Get the pre-tax amount due. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the subTotal value + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the amount of tax charged for the billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the taxAmount value + */ + public Amount taxAmount() { + return this.taxAmount; + } + + /** + * Get the amount due when the invoice was generated. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the totalAmount value + */ + public Amount totalAmount() { + return this.totalAmount; + } + + /** + * Get the start date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodStartDate value + */ + public DateTime invoicePeriodStartDate() { + return this.invoicePeriodStartDate; + } + + /** + * Get the end date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodEndDate value + */ + public DateTime invoicePeriodEndDate() { + return this.invoicePeriodEndDate; + } + + /** + * Get invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport'. + * + * @return the invoiceType value + */ + public InvoiceType invoiceType() { + return this.invoiceType; + } + + /** + * Get specifies if the invoice is generated as part of monthly invoicing cycle or not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the isMonthlyInvoice value + */ + public Boolean isMonthlyInvoice() { + return this.isMonthlyInvoice; + } + + /** + * Get the ID of the billing profile for which the invoice is generated. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile for which the invoice is generated. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get an optional purchase order number for the invoice. + * + * @return the purchaseOrderNumber value + */ + public String purchaseOrderNumber() { + return this.purchaseOrderNumber; + } + + /** + * Get list of documents available to download such as invoice and tax receipt. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get list of payments. + * + * @return the payments value + */ + public List payments() { + return this.payments; + } + + /** + * Get rebill details for an invoice. + * + * @return the rebillDetails value + */ + public Map rebillDetails() { + return this.rebillDetails; + } + + /** + * Get the type of the document. Possible values include: 'Invoice', 'CreditNote'. + * + * @return the documentType value + */ + public InvoiceDocumentType documentType() { + return this.documentType; + } + + /** + * Get the Id of the active invoice which is originally billed after this invoice was voided. This field is applicable to the void invoices only. + * + * @return the billedDocumentId value + */ + public String billedDocumentId() { + return this.billedDocumentId; + } + + /** + * Get the Id of the invoice which got voided and this credit note was issued as a result. This field is applicable to the credit notes only. + * + * @return the creditForDocumentId value + */ + public String creditForDocumentId() { + return this.creditForDocumentId; + } + + /** + * Get the ID of the subscription for which the invoice is generated. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionImpl.java new file mode 100644 index 0000000000000..99621d0707cc6 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionImpl.java @@ -0,0 +1,134 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionState; +import com.microsoft.azure.management.billing.v2020_05_01.TargetCloud; + +class InvoiceSectionImpl extends CreatableUpdatableImpl implements InvoiceSection, InvoiceSection.Definition, InvoiceSection.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String invoiceSectionName; + + InvoiceSectionImpl(String name, BillingManager manager) { + super(name, new InvoiceSectionInner()); + this.manager = manager; + // Set resource name + this.invoiceSectionName = name; + // + } + + InvoiceSectionImpl(InvoiceSectionInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.invoiceSectionName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + this.invoiceSectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoiceSections"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.createOrUpdateAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.createOrUpdateAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.getAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Map labels() { + return this.inner().labels(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public InvoiceSectionState state() { + return this.inner().state(); + } + + @Override + public String systemId() { + return this.inner().systemId(); + } + + @Override + public TargetCloud targetCloud() { + return this.inner().targetCloud(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InvoiceSectionImpl withExistingBillingProfile(String billingAccountName, String billingProfileName) { + this.billingAccountName = billingAccountName; + this.billingProfileName = billingProfileName; + return this; + } + + @Override + public InvoiceSectionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public InvoiceSectionImpl withLabels(Map labels) { + this.inner().withLabels(labels); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionInner.java new file mode 100644 index 0000000000000..33c9f8edf5276 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionInner.java @@ -0,0 +1,124 @@ +/** + * 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.v2020_05_01.implementation; + +import java.util.Map; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionState; +import com.microsoft.azure.management.billing.v2020_05_01.TargetCloud; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice section. + */ +@JsonFlatten +public class InvoiceSectionInner extends ProxyResource { + /** + * The name of the invoice section. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Dictionary of metadata associated with the invoice section. + */ + @JsonProperty(value = "properties.labels") + private Map labels; + + /** + * Identifies the state of an invoice section. Possible values include: + * 'Active', 'Restricted'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceSectionState state; + + /** + * The system generated unique identifier for an invoice section. + */ + @JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY) + private String systemId; + + /** + * Identifies the cloud environments that are associated with an invoice + * section. This is a system managed optional field and gets updated as the + * invoice section gets associated with accounts in various clouds. + * Possible values include: 'USGov', 'USNat', 'USSec'. + */ + @JsonProperty(value = "properties.targetCloud", access = JsonProperty.Access.WRITE_ONLY) + private TargetCloud targetCloud; + + /** + * Get the name of the invoice section. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the invoice section. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get dictionary of metadata associated with the invoice section. + * + * @return the labels value + */ + public Map labels() { + return this.labels; + } + + /** + * Set dictionary of metadata associated with the invoice section. + * + * @param labels the labels value to set + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withLabels(Map labels) { + this.labels = labels; + return this; + } + + /** + * Get identifies the state of an invoice section. Possible values include: 'Active', 'Restricted'. + * + * @return the state value + */ + public InvoiceSectionState state() { + return this.state; + } + + /** + * Get the system generated unique identifier for an invoice section. + * + * @return the systemId value + */ + public String systemId() { + return this.systemId; + } + + /** + * Get identifies the cloud environments that are associated with an invoice section. This is a system managed optional field and gets updated as the invoice section gets associated with accounts in various clouds. Possible values include: 'USGov', 'USNat', 'USSec'. + * + * @return the targetCloud value + */ + public TargetCloud targetCloud() { + return this.targetCloud; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionImpl.java new file mode 100644 index 0000000000000..9d83456fc3c8b --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionImpl.java @@ -0,0 +1,81 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionWithCreateSubPermission; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.SpendingLimitForBillingProfile; +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.StatusReasonCodeForBillingProfile; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; + +class InvoiceSectionWithCreateSubPermissionImpl extends WrapperImpl implements InvoiceSectionWithCreateSubPermission { + private final BillingManager manager; + InvoiceSectionWithCreateSubPermissionImpl(InvoiceSectionWithCreateSubPermissionInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public SpendingLimitForBillingProfile billingProfileSpendingLimit() { + return this.inner().billingProfileSpendingLimit(); + } + + @Override + public BillingProfileStatus billingProfileStatus() { + return this.inner().billingProfileStatus(); + } + + @Override + public StatusReasonCodeForBillingProfile billingProfileStatusReasonCode() { + return this.inner().billingProfileStatusReasonCode(); + } + + @Override + public String billingProfileSystemId() { + return this.inner().billingProfileSystemId(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionSystemId() { + return this.inner().invoiceSectionSystemId(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionInner.java new file mode 100644 index 0000000000000..d39be6f9ec5d6 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionWithCreateSubPermissionInner.java @@ -0,0 +1,186 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.BillingProfileStatus; +import com.microsoft.azure.management.billing.v2020_05_01.StatusReasonCodeForBillingProfile; +import com.microsoft.azure.management.billing.v2020_05_01.SpendingLimitForBillingProfile; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AzurePlan; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Invoice section properties with create subscription permission. + */ +public class InvoiceSectionWithCreateSubPermissionInner { + /** + * The ID of the invoice section. + */ + @JsonProperty(value = "invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section. + */ + @JsonProperty(value = "invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The system generated unique identifier for an invoice section. + */ + @JsonProperty(value = "invoiceSectionSystemId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionSystemId; + + /** + * The ID of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The status of the billing profile. Possible values include: 'Active', + * 'Disabled', 'Warned'. + */ + @JsonProperty(value = "billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus billingProfileStatus; + + /** + * Reason for the specified billing profile status. Possible values + * include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + */ + @JsonProperty(value = "billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private StatusReasonCodeForBillingProfile billingProfileStatusReasonCode; + + /** + * The billing profile spending limit. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimitForBillingProfile billingProfileSpendingLimit; + + /** + * The system generated unique identifier for a billing profile. + */ + @JsonProperty(value = "billingProfileSystemId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileSystemId; + + /** + * Enabled azure plans for the associated billing profile. + */ + @JsonProperty(value = "enabledAzurePlans") + private List enabledAzurePlans; + + /** + * Get the ID of the invoice section. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the system generated unique identifier for an invoice section. + * + * @return the invoiceSectionSystemId value + */ + public String invoiceSectionSystemId() { + return this.invoiceSectionSystemId; + } + + /** + * Get the ID of the billing profile for the invoice section. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned'. + * + * @return the billingProfileStatus value + */ + public BillingProfileStatus billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + * + * @return the billingProfileStatusReasonCode value + */ + public StatusReasonCodeForBillingProfile billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billing profile spending limit. Possible values include: 'Off', 'On'. + * + * @return the billingProfileSpendingLimit value + */ + public SpendingLimitForBillingProfile billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get the system generated unique identifier for a billing profile. + * + * @return the billingProfileSystemId value + */ + public String billingProfileSystemId() { + return this.billingProfileSystemId; + } + + /** + * Get enabled azure plans for the associated billing profile. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set enabled azure plans for the associated billing profile. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the InvoiceSectionWithCreateSubPermissionInner object itself. + */ + public InvoiceSectionWithCreateSubPermissionInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsImpl.java new file mode 100644 index 0000000000000..d15a651073256 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsImpl.java @@ -0,0 +1,78 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSections; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSection; + +class InvoiceSectionsImpl extends WrapperImpl implements InvoiceSections { + private final BillingManager manager; + + InvoiceSectionsImpl(BillingManager manager) { + super(manager.inner().invoiceSections()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public InvoiceSectionImpl define(String name) { + return wrapModel(name); + } + + private InvoiceSectionImpl wrapModel(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + + private InvoiceSectionImpl wrapModel(String name) { + return new InvoiceSectionImpl(name, this.manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + InvoiceSectionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMap(new Func1>() { + @Override + public Observable call(InvoiceSectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((InvoiceSection)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsInner.java new file mode 100644 index 0000000000000..db79aac6dd060 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoiceSectionsInner.java @@ -0,0 +1,580 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.management.billing.v2020_05_01.InvoiceSectionsCreateOrUpdateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in InvoiceSections. + */ +public class InvoiceSectionsInner { + /** The Retrofit service to perform REST calls. */ + private InvoiceSectionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoiceSectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InvoiceSectionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InvoiceSectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InvoiceSections to be + * used by Retrofit to perform actually REST calls. + */ + interface InvoiceSectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.InvoiceSections listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.InvoiceSections get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.InvoiceSections createOrUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> createOrUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body InvoiceSectionInner parameters, @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.v2020_05_01.InvoiceSections beginCreateOrUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> beginCreateOrUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body InvoiceSectionInner parameters, @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.v2020_05_01.InvoiceSections listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner get(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, 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); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner createOrUpdate(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @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 createOrUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + Observable> observable = service.createOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsCreateOrUpdateHeaders.class); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner beginCreateOrUpdate(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @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 beginCreateOrUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable beginCreateOrUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.beginCreateOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoiceSectionsCreateOrUpdateHeaders.class); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesImpl.java new file mode 100644 index 0000000000000..e9cfbda5800f0 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesImpl.java @@ -0,0 +1,179 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Invoices; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Invoice; +import com.microsoft.azure.management.billing.v2020_05_01.DownloadUrl; +import java.util.List; + +class InvoicesImpl extends WrapperImpl implements Invoices { + private final BillingManager manager; + + InvoicesImpl(BillingManager manager) { + super(manager.inner().invoices()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private InvoiceImpl wrapModel(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String invoiceName) { + InvoicesInner client = this.inner(); + return client.getByIdAsync(invoiceName) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable downloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken) { + InvoicesInner client = this.inner(); + return client.downloadInvoiceAsync(billingAccountName, invoiceName, downloadToken) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingSubscriptionAsync(final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingSubscriptionAsync(periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBySubscriptionAndInvoiceIdAsync(String invoiceName) { + InvoicesInner client = this.inner(); + return client.getBySubscriptionAndInvoiceIdAsync(invoiceName) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable downloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken) { + InvoicesInner client = this.inner(); + return client.downloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceName) { + InvoicesInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceName) + .flatMap(new Func1>() { + @Override + public Observable call(InvoiceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Invoice)wrapModel(inner)); + } + } + }); + } + + @Override + public Observable downloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls) { + InvoicesInner client = this.inner(); + return client.downloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + + @Override + public Observable downloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls) { + InvoicesInner client = this.inner(); + return client.downloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesInner.java new file mode 100644 index 0000000000000..e39528ad9275f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/InvoicesInner.java @@ -0,0 +1,1686 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.management.billing.v2020_05_01.InvoicesDownloadBillingSubscriptionInvoiceHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.InvoicesDownloadInvoiceHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.InvoicesDownloadMultipleBillingProfileInvoicesHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in Invoices. + */ +public class InvoicesInner { + /** The Retrofit service to perform REST calls. */ + private InvoicesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InvoicesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InvoicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Invoices to be + * used by Retrofit to perform actually REST calls. + */ + interface InvoicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Invoices listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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.v2020_05_01.Invoices listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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.v2020_05_01.Invoices get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @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.v2020_05_01.Invoices getById" }) + @GET("providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}") + Observable> getById(@Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @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.v2020_05_01.Invoices downloadInvoice" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download") + Observable> downloadInvoice(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Query("downloadToken") String downloadToken, @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.v2020_05_01.Invoices beginDownloadInvoice" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download") + Observable> beginDownloadInvoice(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Query("downloadToken") String downloadToken, @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.v2020_05_01.Invoices downloadMultipleBillingProfileInvoices" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments") + Observable> downloadMultipleBillingProfileInvoices(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body List downloadUrls, @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.v2020_05_01.Invoices beginDownloadMultipleBillingProfileInvoices" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments") + Observable> beginDownloadMultipleBillingProfileInvoices(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body List downloadUrls, @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.v2020_05_01.Invoices listByBillingSubscription" }) + @GET("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices") + Observable> listByBillingSubscription(@Path("subscriptionId") String subscriptionId, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Query("api-version") String apiVersion, @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.v2020_05_01.Invoices getBySubscriptionAndInvoiceId" }) + @GET("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}") + Observable> getBySubscriptionAndInvoiceId(@Path("subscriptionId") String subscriptionId, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @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.v2020_05_01.Invoices downloadBillingSubscriptionInvoice" }) + @POST("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download") + Observable> downloadBillingSubscriptionInvoice(@Path("subscriptionId") String subscriptionId, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Query("downloadToken") String downloadToken, @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.v2020_05_01.Invoices beginDownloadBillingSubscriptionInvoice" }) + @POST("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download") + Observable> beginDownloadBillingSubscriptionInvoice(@Path("subscriptionId") String subscriptionId, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Query("downloadToken") String downloadToken, @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.v2020_05_01.Invoices downloadMultipleBillingSubscriptionInvoices" }) + @POST("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments") + Observable> downloadMultipleBillingSubscriptionInvoices(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body List downloadUrls, @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.v2020_05_01.Invoices beginDownloadMultipleBillingSubscriptionInvoices" }) + @POST("providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments") + Observable> beginDownloadMultipleBillingSubscriptionInvoices(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body List downloadUrls, @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.v2020_05_01.Invoices listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.Invoices listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @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.v2020_05_01.Invoices listByBillingSubscriptionNext" }) + @GET + Observable> listByBillingSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @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> listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner get(String billingAccountName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getAsync(String billingAccountName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, invoiceName, apiVersion, 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); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner getById(String invoiceName) { + return getByIdWithServiceResponseAsync(invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 getByIdAsync(String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(invoiceName), serviceCallback); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getByIdAsync(String invoiceName) { + return getByIdWithServiceResponseAsync(invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getByIdWithServiceResponseAsync(String invoiceName) { + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getById(invoiceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(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); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner downloadInvoice(String billingAccountName, String invoiceName, String downloadToken) { + return downloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken).toBlocking().last().body(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 downloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken), serviceCallback); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken) { + return downloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadInvoiceWithServiceResponseAsync(String billingAccountName, String invoiceName, String downloadToken) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (downloadToken == null) { + throw new IllegalArgumentException("Parameter downloadToken is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + Observable> observable = service.downloadInvoice(billingAccountName, invoiceName, apiVersion, downloadToken, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), InvoicesDownloadInvoiceHeaders.class); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownloadInvoice(String billingAccountName, String invoiceName, String downloadToken) { + return beginDownloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken).toBlocking().single().body(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 beginDownloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken), serviceCallback); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadInvoiceAsync(String billingAccountName, String invoiceName, String downloadToken) { + return beginDownloadInvoiceWithServiceResponseAsync(billingAccountName, invoiceName, downloadToken).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadInvoiceWithServiceResponseAsync(String billingAccountName, String invoiceName, String downloadToken) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (downloadToken == null) { + throw new IllegalArgumentException("Parameter downloadToken is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.beginDownloadInvoice(billingAccountName, invoiceName, apiVersion, downloadToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadInvoiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadInvoiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoicesDownloadInvoiceHeaders.class); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner downloadMultipleBillingProfileInvoices(String billingAccountName, List downloadUrls) { + return downloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls).toBlocking().last().body(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @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 downloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls), serviceCallback); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls) { + return downloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadMultipleBillingProfileInvoicesWithServiceResponseAsync(String billingAccountName, List downloadUrls) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (downloadUrls == null) { + throw new IllegalArgumentException("Parameter downloadUrls is required and cannot be null."); + } + Validator.validate(downloadUrls); + final String apiVersion = "2020-05-01"; + Observable> observable = service.downloadMultipleBillingProfileInvoices(billingAccountName, apiVersion, downloadUrls, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), InvoicesDownloadMultipleBillingProfileInvoicesHeaders.class); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownloadMultipleBillingProfileInvoices(String billingAccountName, List downloadUrls) { + return beginDownloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls).toBlocking().single().body(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @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 beginDownloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls), serviceCallback); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadMultipleBillingProfileInvoicesAsync(String billingAccountName, List downloadUrls) { + return beginDownloadMultipleBillingProfileInvoicesWithServiceResponseAsync(billingAccountName, downloadUrls).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadMultipleBillingProfileInvoicesWithServiceResponseAsync(String billingAccountName, List downloadUrls) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (downloadUrls == null) { + throw new IllegalArgumentException("Parameter downloadUrls is required and cannot be null."); + } + Validator.validate(downloadUrls); + final String apiVersion = "2020-05-01"; + return service.beginDownloadMultipleBillingProfileInvoices(billingAccountName, apiVersion, downloadUrls, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadMultipleBillingProfileInvoicesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadMultipleBillingProfileInvoicesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoicesDownloadMultipleBillingProfileInvoicesHeaders.class); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingSubscription(final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @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> listByBillingSubscriptionAsync(final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingSubscriptionAsync(final String periodStartDate, final String periodEndDate) { + return listByBillingSubscriptionWithServiceResponseAsync(periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingSubscriptionWithServiceResponseAsync(final String periodStartDate, final String periodEndDate) { + return listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingSubscriptionSinglePageAsync(final String periodStartDate, final String periodEndDate) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingSubscription(this.client.subscriptionId(), periodStartDate, periodEndDate, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner getBySubscriptionAndInvoiceId(String invoiceName) { + return getBySubscriptionAndInvoiceIdWithServiceResponseAsync(invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 getBySubscriptionAndInvoiceIdAsync(String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBySubscriptionAndInvoiceIdWithServiceResponseAsync(invoiceName), serviceCallback); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getBySubscriptionAndInvoiceIdAsync(String invoiceName) { + return getBySubscriptionAndInvoiceIdWithServiceResponseAsync(invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getBySubscriptionAndInvoiceIdWithServiceResponseAsync(String invoiceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getBySubscriptionAndInvoiceId(this.client.subscriptionId(), invoiceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBySubscriptionAndInvoiceIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBySubscriptionAndInvoiceIdDelegate(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); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken) { + return downloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken).toBlocking().last().body(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 downloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken), serviceCallback); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken) { + return downloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadBillingSubscriptionInvoiceWithServiceResponseAsync(String invoiceName, String downloadToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (downloadToken == null) { + throw new IllegalArgumentException("Parameter downloadToken is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + Observable> observable = service.downloadBillingSubscriptionInvoice(this.client.subscriptionId(), invoiceName, apiVersion, downloadToken, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), InvoicesDownloadBillingSubscriptionInvoiceHeaders.class); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownloadBillingSubscriptionInvoice(String invoiceName, String downloadToken) { + return beginDownloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken).toBlocking().single().body(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document 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 beginDownloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken), serviceCallback); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken) { + return beginDownloadBillingSubscriptionInvoiceWithServiceResponseAsync(invoiceName, downloadToken).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadBillingSubscriptionInvoiceWithServiceResponseAsync(String invoiceName, String downloadToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (downloadToken == null) { + throw new IllegalArgumentException("Parameter downloadToken is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.beginDownloadBillingSubscriptionInvoice(this.client.subscriptionId(), invoiceName, apiVersion, downloadToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadBillingSubscriptionInvoiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadBillingSubscriptionInvoiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoicesDownloadBillingSubscriptionInvoiceHeaders.class); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner downloadMultipleBillingSubscriptionInvoices(List downloadUrls) { + return downloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls).toBlocking().last().body(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @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 downloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls), serviceCallback); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls) { + return downloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(List downloadUrls) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (downloadUrls == null) { + throw new IllegalArgumentException("Parameter downloadUrls is required and cannot be null."); + } + Validator.validate(downloadUrls); + final String apiVersion = "2020-05-01"; + Observable> observable = service.downloadMultipleBillingSubscriptionInvoices(this.client.subscriptionId(), apiVersion, downloadUrls, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.class); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownloadMultipleBillingSubscriptionInvoices(List downloadUrls) { + return beginDownloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls).toBlocking().single().body(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @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 beginDownloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls), serviceCallback); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls) { + return beginDownloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(downloadUrls).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadMultipleBillingSubscriptionInvoicesWithServiceResponseAsync(List downloadUrls) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (downloadUrls == null) { + throw new IllegalArgumentException("Parameter downloadUrls is required and cannot be null."); + } + Validator.validate(downloadUrls); + final String apiVersion = "2020-05-01"; + return service.beginDownloadMultipleBillingSubscriptionInvoices(this.client.subscriptionId(), apiVersion, downloadUrls, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadMultipleBillingSubscriptionInvoicesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadMultipleBillingSubscriptionInvoicesDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.class); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoices for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingSubscriptionNextAsync(final String nextPageLink) { + return listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingSubscriptionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingSubscriptionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationImpl.java new file mode 100644 index 0000000000000..3c9d2c7e7d5c6 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationImpl.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final BillingManager manager; + OperationImpl(OperationInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationInner.java new file mode 100644 index 0000000000000..2f6e3241a716f --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationInner.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Billing REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..27aa6d67fa729 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final BillingManager manager; + + OperationsImpl(BillingManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsInner.java new file mode 100644 index 0000000000000..c44175bed34fa --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/OperationsInner.java @@ -0,0 +1,281 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Operations list" }) + @GET("providers/Microsoft.Billing/operations") + Observable> list(@Query("api-version") String apiVersion, @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.v2020_05_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the available billing REST API operations. + * + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing REST API operations. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2020-05-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PageImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..a6ed81cba52e1 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * 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.v2020_05_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesImpl.java new file mode 100644 index 0000000000000..10a9cd61e9dfd --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesImpl.java @@ -0,0 +1,79 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.billing.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Policies; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.Policy; +import com.microsoft.azure.management.billing.v2020_05_01.CustomerPolicy; + +class PoliciesImpl extends WrapperImpl implements Policies { + private final BillingManager manager; + + PoliciesImpl(BillingManager manager) { + super(manager.inner().policies()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + PoliciesInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + PoliciesInner client = this.inner(); + return client.updateAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByCustomerAsync(String billingAccountName, String customerName) { + PoliciesInner client = this.inner(); + return client.getByCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public CustomerPolicy call(CustomerPolicyInner inner) { + return new CustomerPolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateCustomerAsync(String billingAccountName, String customerName) { + PoliciesInner client = this.inner(); + return client.updateCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public CustomerPolicy call(CustomerPolicyInner inner) { + return new CustomerPolicyImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesInner.java new file mode 100644 index 0000000000000..752038d6ef76c --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PoliciesInner.java @@ -0,0 +1,491 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.management.billing.v2020_05_01.ViewCharges; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +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 Policies. + */ +public class PoliciesInner { + /** The Retrofit service to perform REST calls. */ + private PoliciesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoliciesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policies to be + * used by Retrofit to perform actually REST calls. + */ + interface PoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Policies getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.Policies update" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body PolicyInner parameters, @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.v2020_05_01.Policies getByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") + Observable> getByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @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.v2020_05_01.Policies updateCustomer" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") + Observable> updateCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CustomerPolicyInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PolicyInner object if successful. + */ + public PolicyInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByBillingProfile(billingAccountName, billingProfileName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(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); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @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 PolicyInner object if successful. + */ + public PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @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 updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.update(billingAccountName, billingProfileName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner getByCustomer(String billingAccountName, String customerName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 getByCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable getByCustomerAsync(String billingAccountName, String customerName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> getByCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.getByCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByCustomerDelegate(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); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner updateCustomer(String billingAccountName, String customerName) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 updateCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable updateCustomerAsync(String billingAccountName, String customerName) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> updateCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final ViewCharges viewCharges = null; + CustomerPolicyInner parameters = new CustomerPolicyInner(); + parameters.withViewCharges(null); + return service.updateCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner updateCustomer(String billingAccountName, String customerName, ViewCharges viewCharges) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges).toBlocking().single().body(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @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 updateCustomerAsync(String billingAccountName, String customerName, ViewCharges viewCharges, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges), serviceCallback); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable updateCustomerAsync(String billingAccountName, String customerName, ViewCharges viewCharges) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> updateCustomerWithServiceResponseAsync(String billingAccountName, String customerName, ViewCharges viewCharges) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + CustomerPolicyInner parameters = new CustomerPolicyInner(); + parameters.withViewCharges(viewCharges); + return service.updateCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateCustomerDelegate(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/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyImpl.java new file mode 100644 index 0000000000000..9c5e9b33095aa --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyImpl.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Policy; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.MarketplacePurchasesPolicy; +import com.microsoft.azure.management.billing.v2020_05_01.ReservationPurchasesPolicy; +import com.microsoft.azure.management.billing.v2020_05_01.ViewChargesPolicy; + +class PolicyImpl extends WrapperImpl implements Policy { + private final BillingManager manager; + PolicyImpl(PolicyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.inner().marketplacePurchases(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ReservationPurchasesPolicy reservationPurchases() { + return this.inner().reservationPurchases(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ViewChargesPolicy viewCharges() { + return this.inner().viewCharges(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyInner.java new file mode 100644 index 0000000000000..435281bbceeaa --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/PolicyInner.java @@ -0,0 +1,106 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.MarketplacePurchasesPolicy; +import com.microsoft.azure.management.billing.v2020_05_01.ReservationPurchasesPolicy; +import com.microsoft.azure.management.billing.v2020_05_01.ViewChargesPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A policy. + */ +@JsonFlatten +public class PolicyInner extends ProxyResource { + /** + * The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. Possible values include: 'AllAllowed', + * 'OnlyFreeAllowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.marketplacePurchases") + private MarketplacePurchasesPolicy marketplacePurchases; + + /** + * The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.reservationPurchases") + private ReservationPurchasesPolicy reservationPurchases; + + /** + * The policy that controls whether users with Azure RBAC access to a + * subscription can view its charges. Possible values include: 'Allowed', + * 'NotAllowed'. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewChargesPolicy viewCharges; + + /** + * Get the policy that controls whether Azure marketplace purchases are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed'. + * + * @return the marketplacePurchases value + */ + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.marketplacePurchases; + } + + /** + * Set the policy that controls whether Azure marketplace purchases are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed'. + * + * @param marketplacePurchases the marketplacePurchases value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withMarketplacePurchases(MarketplacePurchasesPolicy marketplacePurchases) { + this.marketplacePurchases = marketplacePurchases; + return this; + } + + /** + * Get the policy that controls whether Azure reservation purchases are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the reservationPurchases value + */ + public ReservationPurchasesPolicy reservationPurchases() { + return this.reservationPurchases; + } + + /** + * Set the policy that controls whether Azure reservation purchases are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param reservationPurchases the reservationPurchases value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withReservationPurchases(ReservationPurchasesPolicy reservationPurchases) { + this.reservationPurchases = reservationPurchases; + return this; + } + + /** + * Get the policy that controls whether users with Azure RBAC access to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the viewCharges value + */ + public ViewChargesPolicy viewCharges() { + return this.viewCharges; + } + + /** + * Set the policy that controls whether users with Azure RBAC access to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param viewCharges the viewCharges value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withViewCharges(ViewChargesPolicy viewCharges) { + this.viewCharges = viewCharges; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductImpl.java new file mode 100644 index 0000000000000..81d13d8a0b938 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductImpl.java @@ -0,0 +1,218 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Product; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.AutoRenew; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.ProductStatusType; +import com.microsoft.azure.management.billing.v2020_05_01.BillingFrequency; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; + +class ProductImpl extends CreatableUpdatableImpl implements Product, Product.Update { + private final BillingManager manager; + private String billingAccountName; + private String productName; + + ProductImpl(String name, BillingManager manager) { + super(name, new ProductInner()); + this.manager = manager; + // Set resource name + this.productName = name; + // + } + + ProductImpl(ProductInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.productName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.productName = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ProductsInner client = this.manager().inner().products(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + ProductsInner client = this.manager().inner().products(); + return client.updateAsync(this.billingAccountName, this.productName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ProductsInner client = this.manager().inner().products(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AutoRenew autoRenew() { + return this.inner().autoRenew(); + } + + @Override + public String availabilityId() { + return this.inner().availabilityId(); + } + + @Override + public BillingFrequency billingFrequency() { + return this.inner().billingFrequency(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public Amount lastCharge() { + return this.inner().lastCharge(); + } + + @Override + public DateTime lastChargeDate() { + return this.inner().lastChargeDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public DateTime purchaseDate() { + return this.inner().purchaseDate(); + } + + @Override + public Double quantity() { + return this.inner().quantity(); + } + + @Override + public Reseller reseller() { + return this.inner().reseller(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public ProductStatusType status() { + return this.inner().status(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ProductImpl withAutoRenew(AutoRenew autoRenew) { + this.inner().withAutoRenew(autoRenew); + return this; + } + + @Override + public ProductImpl withBillingFrequency(BillingFrequency billingFrequency) { + this.inner().withBillingFrequency(billingFrequency); + return this; + } + + @Override + public ProductImpl withStatus(ProductStatusType status) { + this.inner().withStatus(status); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductInner.java new file mode 100644 index 0000000000000..dc65643575592 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductInner.java @@ -0,0 +1,395 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.AutoRenew; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.ProductStatusType; +import com.microsoft.azure.management.billing.v2020_05_01.BillingFrequency; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.microsoft.azure.management.billing.v2020_05_01.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A product. + */ +@JsonFlatten +public class ProductInner extends ProxyResource { + /** + * Indicates whether auto renewal is turned on or off for a product. + * Possible values include: 'Off', 'On'. + */ + @JsonProperty(value = "properties.autoRenew") + private AutoRenew autoRenew; + + /** + * The display name of the product. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The date when the product was purchased. + */ + @JsonProperty(value = "properties.purchaseDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime purchaseDate; + + /** + * The ID of the type of product. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The description of the type of product. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * The current status of the product. Possible values include: 'Active', + * 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', + * 'AutoRenew'. + */ + @JsonProperty(value = "properties.status") + private ProductStatusType status; + + /** + * The date when the product will be renewed or canceled. + */ + @JsonProperty(value = "properties.endDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endDate; + + /** + * The frequency at which the product will be billed. Possible values + * include: 'OneTime', 'Monthly', 'UsageBased'. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /** + * The last month charges. + */ + @JsonProperty(value = "properties.lastCharge", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastCharge; + + /** + * The date of the last charge. + */ + @JsonProperty(value = "properties.lastChargeDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastChargeDate; + + /** + * The quantity purchased for the product. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Double quantity; + + /** + * The sku ID of the product. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * The sku description of the product. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * The id of the tenant in which the product is used. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The availability of the product. + */ + @JsonProperty(value = "properties.availabilityId", access = JsonProperty.Access.WRITE_ONLY) + private String availabilityId; + + /** + * The ID of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The ID of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The ID of the customer for whom the product was purchased. The field is + * applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for whom the product was purchased. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * Reseller for this product. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * Get indicates whether auto renewal is turned on or off for a product. Possible values include: 'Off', 'On'. + * + * @return the autoRenew value + */ + public AutoRenew autoRenew() { + return this.autoRenew; + } + + /** + * Set indicates whether auto renewal is turned on or off for a product. Possible values include: 'Off', 'On'. + * + * @param autoRenew the autoRenew value to set + * @return the ProductInner object itself. + */ + public ProductInner withAutoRenew(AutoRenew autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * Get the display name of the product. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the date when the product was purchased. + * + * @return the purchaseDate value + */ + public DateTime purchaseDate() { + return this.purchaseDate; + } + + /** + * Get the ID of the type of product. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the description of the type of product. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @return the status value + */ + public ProductStatusType status() { + return this.status; + } + + /** + * Set the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @param status the status value to set + * @return the ProductInner object itself. + */ + public ProductInner withStatus(ProductStatusType status) { + this.status = status; + return this; + } + + /** + * Get the date when the product will be renewed or canceled. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Get the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @return the billingFrequency value + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @param billingFrequency the billingFrequency value to set + * @return the ProductInner object itself. + */ + public ProductInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get the last month charges. + * + * @return the lastCharge value + */ + public Amount lastCharge() { + return this.lastCharge; + } + + /** + * Get the date of the last charge. + * + * @return the lastChargeDate value + */ + public DateTime lastChargeDate() { + return this.lastChargeDate; + } + + /** + * Get the quantity purchased for the product. + * + * @return the quantity value + */ + public Double quantity() { + return this.quantity; + } + + /** + * Get the sku ID of the product. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the sku description of the product. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get the id of the tenant in which the product is used. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the availability of the product. + * + * @return the availabilityId value + */ + public String availabilityId() { + return this.availabilityId; + } + + /** + * Get the ID of the invoice section to which the product is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the product is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the ID of the billing profile to which the product is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the product is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the ID of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get reseller for this product. + * + * @return the reseller value + */ + public Reseller reseller() { + return this.reseller; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsImpl.java new file mode 100644 index 0000000000000..a25490ad7253d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsImpl.java @@ -0,0 +1,144 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Products; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Product; +import com.microsoft.azure.management.billing.v2020_05_01.ValidateProductTransferEligibilityResult; + +class ProductsImpl extends WrapperImpl implements Products { + private final BillingManager manager; + + ProductsImpl(BillingManager manager) { + super(manager.inner().products()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private ProductImpl wrapModel(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + ProductsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + ProductsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ProductsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String productName) { + ProductsInner client = this.inner(); + return client.getAsync(billingAccountName, productName) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable moveAsync(String billingAccountName, String productName) { + ProductsInner client = this.inner(); + return client.moveAsync(billingAccountName, productName) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateMoveAsync(String billingAccountName, String productName) { + ProductsInner client = this.inner(); + return client.validateMoveAsync(billingAccountName, productName) + .map(new Func1() { + @Override + public ValidateProductTransferEligibilityResult call(ValidateProductTransferEligibilityResultInner inner) { + return new ValidateProductTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerAsync(final String billingAccountName, final String customerName) { + ProductsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsInner.java new file mode 100644 index 0000000000000..185728c963dce --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ProductsInner.java @@ -0,0 +1,1883 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.management.billing.v2020_05_01.ProductsMoveHeaders; +import com.microsoft.azure.management.billing.v2020_05_01.TransferProductRequestProperties; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Products. + */ +public class ProductsInner { + /** The Retrofit service to perform REST calls. */ + private ProductsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of ProductsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(ProductsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Products to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Products listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @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.v2020_05_01.Products listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2020_05_01.Products listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @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.v2020_05_01.Products listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2020_05_01.Products get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @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.v2020_05_01.Products update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Body ProductInner parameters, @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.v2020_05_01.Products move" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move") + Observable> move(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferProductRequestProperties parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Products validateMove" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility") + Observable> validateMove(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferProductRequestProperties parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Products listByCustomerNext" }) + @GET + Observable> listByCustomerNext(@Url String nextUrl, @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.v2020_05_01.Products listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.v2020_05_01.Products listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @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.v2020_05_01.Products listByInvoiceSectionNext" }) + @GET + Observable> listByInvoiceSectionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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> listByCustomerAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerSinglePageAsync(billingAccountName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByCustomer(billingAccountName, customerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String filter = null; + return service.listByBillingAccount(billingAccountName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String filter) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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> listByBillingAccountAsync(final String billingAccountName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String filter) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String filter) { + return listByBillingAccountSinglePageAsync(billingAccountName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingAccount(billingAccountName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String filter = null; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String filter) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String filter) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String filter) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByBillingProfile(billingAccountName, billingProfileName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByInvoiceSection(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByInvoiceSectionWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String filter = null; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByInvoiceSection(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final String filter) { + ServiceResponse> response = listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @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> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByInvoiceSectionAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByInvoiceSectionWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 ProductInner object if successful. + */ + public ProductInner get(String billingAccountName, String productName) { + return getWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, productName), serviceCallback); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable getAsync(String billingAccountName, String productName) { + return getWithServiceResponseAsync(billingAccountName, productName).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.get(billingAccountName, productName, apiVersion, 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); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @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 ProductInner object if successful. + */ + public ProductInner update(String billingAccountName, String productName, ProductInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, productName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @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 updateAsync(String billingAccountName, String productName, ProductInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, productName, parameters), serviceCallback); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable updateAsync(String billingAccountName, String productName, ProductInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, productName, parameters).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String productName, ProductInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2020-05-01"; + return service.update(billingAccountName, productName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 ProductInner object if successful. + */ + public ProductInner move(String billingAccountName, String productName) { + return moveWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 moveAsync(String billingAccountName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(moveWithServiceResponseAsync(billingAccountName, productName), serviceCallback); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable moveAsync(String billingAccountName, String productName) { + return moveWithServiceResponseAsync(billingAccountName, productName).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> moveWithServiceResponseAsync(String billingAccountName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String destinationInvoiceSectionId = null; + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + parameters.withDestinationInvoiceSectionId(null); + return service.move(billingAccountName, productName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = moveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section 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 ProductInner object if successful. + */ + public ProductInner move(String billingAccountName, String productName, String destinationInvoiceSectionId) { + return moveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId).toBlocking().single().body(); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section 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 moveAsync(String billingAccountName, String productName, String destinationInvoiceSectionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(moveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId), serviceCallback); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable moveAsync(String billingAccountName, String productName, String destinationInvoiceSectionId) { + return moveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> moveWithServiceResponseAsync(String billingAccountName, String productName, String destinationInvoiceSectionId) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + parameters.withDestinationInvoiceSectionId(destinationInvoiceSectionId); + return service.move(billingAccountName, productName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = moveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders moveDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductsMoveHeaders.class); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 ValidateProductTransferEligibilityResultInner object if successful. + */ + public ValidateProductTransferEligibilityResultInner validateMove(String billingAccountName, String productName) { + return validateMoveWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @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 validateMoveAsync(String billingAccountName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateMoveWithServiceResponseAsync(billingAccountName, productName), serviceCallback); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable validateMoveAsync(String billingAccountName, String productName) { + return validateMoveWithServiceResponseAsync(billingAccountName, productName).map(new Func1, ValidateProductTransferEligibilityResultInner>() { + @Override + public ValidateProductTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable> validateMoveWithServiceResponseAsync(String billingAccountName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + final String destinationInvoiceSectionId = null; + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + parameters.withDestinationInvoiceSectionId(null); + return service.validateMove(billingAccountName, productName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateMoveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section 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 ValidateProductTransferEligibilityResultInner object if successful. + */ + public ValidateProductTransferEligibilityResultInner validateMove(String billingAccountName, String productName, String destinationInvoiceSectionId) { + return validateMoveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId).toBlocking().single().body(); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section 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 validateMoveAsync(String billingAccountName, String productName, String destinationInvoiceSectionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateMoveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId), serviceCallback); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable validateMoveAsync(String billingAccountName, String productName, String destinationInvoiceSectionId) { + return validateMoveWithServiceResponseAsync(billingAccountName, productName, destinationInvoiceSectionId).map(new Func1, ValidateProductTransferEligibilityResultInner>() { + @Override + public ValidateProductTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param destinationInvoiceSectionId The destination invoice section id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable> validateMoveWithServiceResponseAsync(String billingAccountName, String productName, String destinationInvoiceSectionId) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + parameters.withDestinationInvoiceSectionId(destinationInvoiceSectionId); + return service.validateMove(billingAccountName, productName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateMoveDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateMoveDelegate(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); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByCustomerNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByCustomerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByCustomerNextAsync(final String nextPageLink) { + return listByCustomerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByCustomerNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCustomerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<ProductInner> object if successful. + */ + public PagedList listByInvoiceSectionNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceSectionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByInvoiceSectionNextAsync(final String nextPageLink) { + return listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByInvoiceSectionNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionImpl.java new file mode 100644 index 0000000000000..85fdb111c15df --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionImpl.java @@ -0,0 +1,229 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.Transaction; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.TransactionTypeKind; +import com.microsoft.azure.management.billing.v2020_05_01.ReservationType; + +class TransactionImpl extends WrapperImpl implements Transaction { + private final BillingManager manager; + + TransactionImpl(TransactionInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public Amount azureCreditApplied() { + return this.inner().azureCreditApplied(); + } + + @Override + public String azurePlan() { + return this.inner().azurePlan(); + } + + @Override + public String billingCurrency() { + return this.inner().billingCurrency(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public DateTime dateProperty() { + return this.inner().dateProperty(); + } + + @Override + public Double discount() { + return this.inner().discount(); + } + + @Override + public Amount effectivePrice() { + return this.inner().effectivePrice(); + } + + @Override + public Double exchangeRate() { + return this.inner().exchangeRate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoice() { + return this.inner().invoice(); + } + + @Override + public String invoiceId() { + return this.inner().invoiceId(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public TransactionTypeKind kind() { + return this.inner().kind(); + } + + @Override + public Amount marketPrice() { + return this.inner().marketPrice(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String orderId() { + return this.inner().orderId(); + } + + @Override + public String orderName() { + return this.inner().orderName(); + } + + @Override + public String pricingCurrency() { + return this.inner().pricingCurrency(); + } + + @Override + public String productDescription() { + return this.inner().productDescription(); + } + + @Override + public String productFamily() { + return this.inner().productFamily(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public Integer quantity() { + return this.inner().quantity(); + } + + @Override + public DateTime servicePeriodEndDate() { + return this.inner().servicePeriodEndDate(); + } + + @Override + public DateTime servicePeriodStartDate() { + return this.inner().servicePeriodStartDate(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String subscriptionName() { + return this.inner().subscriptionName(); + } + + @Override + public Amount subTotal() { + return this.inner().subTotal(); + } + + @Override + public Amount tax() { + return this.inner().tax(); + } + + @Override + public Amount transactionAmount() { + return this.inner().transactionAmount(); + } + + @Override + public ReservationType transactionType() { + return this.inner().transactionType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unitOfMeasure() { + return this.inner().unitOfMeasure(); + } + + @Override + public Double units() { + return this.inner().units(); + } + + @Override + public String unitType() { + return this.inner().unitType(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionInner.java new file mode 100644 index 0000000000000..54e6c59bc851a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionInner.java @@ -0,0 +1,604 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.TransactionTypeKind; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2020_05_01.ReservationType; +import com.microsoft.azure.management.billing.v2020_05_01.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A transaction. + */ +@JsonFlatten +public class TransactionInner extends ProxyResource { + /** + * The kind of transaction. Options are all or reservation. Possible values + * include: 'all', 'reservation'. + */ + @JsonProperty(value = "properties.kind") + private TransactionTypeKind kind; + + /** + * The date of transaction. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * Invoice on which the transaction was billed or 'pending' if the + * transaction is not billed. + */ + @JsonProperty(value = "properties.invoice", access = JsonProperty.Access.WRITE_ONLY) + private String invoice; + + /** + * The ID of the invoice on which the transaction was billed. This field is + * only applicable for transactions which are billed. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The order ID of the reservation. The field is only applicable for + * transaction of kind reservation. + */ + @JsonProperty(value = "properties.orderId", access = JsonProperty.Access.WRITE_ONLY) + private String orderId; + + /** + * The name of the reservation order. The field is only applicable for + * transactions of kind reservation. + */ + @JsonProperty(value = "properties.orderName", access = JsonProperty.Access.WRITE_ONLY) + private String orderName; + + /** + * The family of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productFamily", access = JsonProperty.Access.WRITE_ONLY) + private String productFamily; + + /** + * The ID of the product type for which the transaction took place. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The type of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * The description of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productDescription", access = JsonProperty.Access.WRITE_ONLY) + private String productDescription; + + /** + * The type of transaction. Possible values include: 'Purchase', 'Usage + * Charge'. + */ + @JsonProperty(value = "properties.transactionType") + private ReservationType transactionType; + + /** + * The charge associated with the transaction. + */ + @JsonProperty(value = "properties.transactionAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount transactionAmount; + + /** + * The quantity purchased in the transaction. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Integer quantity; + + /** + * The ID of the invoice section which will be billed for the transaction. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The ID of the billing profile which will be billed for the transaction. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The ID of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * The ID of the subscription that was used for the transaction. The field + * is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The name of the subscription that was used for the transaction. The + * field is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /** + * The type of azure plan of the subscription that was used for the + * transaction. + */ + @JsonProperty(value = "properties.azurePlan", access = JsonProperty.Access.WRITE_ONLY) + private String azurePlan; + + /** + * The amount of any Azure credits automatically applied to this + * transaction. + */ + @JsonProperty(value = "properties.azureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azureCreditApplied; + + /** + * The ISO 4217 code for the currency in which this transaction is billed. + */ + @JsonProperty(value = "properties.billingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String billingCurrency; + + /** + * The percentage discount, if any, applied to this transaction. + */ + @JsonProperty(value = "properties.discount", access = JsonProperty.Access.WRITE_ONLY) + private Double discount; + + /** + * The price of the product after applying any discounts. + */ + @JsonProperty(value = "properties.effectivePrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount effectivePrice; + + /** + * The exchange rate used to convert charged amount to billing currency, if + * applicable. + */ + @JsonProperty(value = "properties.exchangeRate", access = JsonProperty.Access.WRITE_ONLY) + private Double exchangeRate; + + /** + * The retail price of the product. + */ + @JsonProperty(value = "properties.marketPrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount marketPrice; + + /** + * The ISO 4217 code for the currency in which the product is priced. + */ + @JsonProperty(value = "properties.pricingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String pricingCurrency; + + /** + * The date of the purchase of the product, or the start date of the month + * in which usage started. + */ + @JsonProperty(value = "properties.servicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime servicePeriodStartDate; + + /** + * The end date of the product term, or the end date of the month in which + * usage ended. + */ + @JsonProperty(value = "properties.servicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime servicePeriodEndDate; + + /** + * The pre-tax charged amount for the transaction. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /** + * The tax amount applied to the transaction. + */ + @JsonProperty(value = "properties.tax", access = JsonProperty.Access.WRITE_ONLY) + private Amount tax; + + /** + * The unit of measure used to bill for the product. For example, compute + * services are billed per hour. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /** + * The number of units used for a given product. + */ + @JsonProperty(value = "properties.units", access = JsonProperty.Access.WRITE_ONLY) + private Double units; + + /** + * The description for the unit of measure for a given product. + */ + @JsonProperty(value = "properties.unitType", access = JsonProperty.Access.WRITE_ONLY) + private String unitType; + + /** + * Get the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation'. + * + * @return the kind value + */ + public TransactionTypeKind kind() { + return this.kind; + } + + /** + * Set the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation'. + * + * @param kind the kind value to set + * @return the TransactionInner object itself. + */ + public TransactionInner withKind(TransactionTypeKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the date of transaction. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Get invoice on which the transaction was billed or 'pending' if the transaction is not billed. + * + * @return the invoice value + */ + public String invoice() { + return this.invoice; + } + + /** + * Get the ID of the invoice on which the transaction was billed. This field is only applicable for transactions which are billed. + * + * @return the invoiceId value + */ + public String invoiceId() { + return this.invoiceId; + } + + /** + * Get the order ID of the reservation. The field is only applicable for transaction of kind reservation. + * + * @return the orderId value + */ + public String orderId() { + return this.orderId; + } + + /** + * Get the name of the reservation order. The field is only applicable for transactions of kind reservation. + * + * @return the orderName value + */ + public String orderName() { + return this.orderName; + } + + /** + * Get the family of the product for which the transaction took place. + * + * @return the productFamily value + */ + public String productFamily() { + return this.productFamily; + } + + /** + * Get the ID of the product type for which the transaction took place. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the type of the product for which the transaction took place. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get the description of the product for which the transaction took place. + * + * @return the productDescription value + */ + public String productDescription() { + return this.productDescription; + } + + /** + * Get the type of transaction. Possible values include: 'Purchase', 'Usage Charge'. + * + * @return the transactionType value + */ + public ReservationType transactionType() { + return this.transactionType; + } + + /** + * Set the type of transaction. Possible values include: 'Purchase', 'Usage Charge'. + * + * @param transactionType the transactionType value to set + * @return the TransactionInner object itself. + */ + public TransactionInner withTransactionType(ReservationType transactionType) { + this.transactionType = transactionType; + return this; + } + + /** + * Get the charge associated with the transaction. + * + * @return the transactionAmount value + */ + public Amount transactionAmount() { + return this.transactionAmount; + } + + /** + * Get the quantity purchased in the transaction. + * + * @return the quantity value + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Get the ID of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the ID of the billing profile which will be billed for the transaction. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile which will be billed for the transaction. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the ID of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the ID of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the name of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the type of azure plan of the subscription that was used for the transaction. + * + * @return the azurePlan value + */ + public String azurePlan() { + return this.azurePlan; + } + + /** + * Get the amount of any Azure credits automatically applied to this transaction. + * + * @return the azureCreditApplied value + */ + public Amount azureCreditApplied() { + return this.azureCreditApplied; + } + + /** + * Get the ISO 4217 code for the currency in which this transaction is billed. + * + * @return the billingCurrency value + */ + public String billingCurrency() { + return this.billingCurrency; + } + + /** + * Get the percentage discount, if any, applied to this transaction. + * + * @return the discount value + */ + public Double discount() { + return this.discount; + } + + /** + * Get the price of the product after applying any discounts. + * + * @return the effectivePrice value + */ + public Amount effectivePrice() { + return this.effectivePrice; + } + + /** + * Get the exchange rate used to convert charged amount to billing currency, if applicable. + * + * @return the exchangeRate value + */ + public Double exchangeRate() { + return this.exchangeRate; + } + + /** + * Get the retail price of the product. + * + * @return the marketPrice value + */ + public Amount marketPrice() { + return this.marketPrice; + } + + /** + * Get the ISO 4217 code for the currency in which the product is priced. + * + * @return the pricingCurrency value + */ + public String pricingCurrency() { + return this.pricingCurrency; + } + + /** + * Get the date of the purchase of the product, or the start date of the month in which usage started. + * + * @return the servicePeriodStartDate value + */ + public DateTime servicePeriodStartDate() { + return this.servicePeriodStartDate; + } + + /** + * Get the end date of the product term, or the end date of the month in which usage ended. + * + * @return the servicePeriodEndDate value + */ + public DateTime servicePeriodEndDate() { + return this.servicePeriodEndDate; + } + + /** + * Get the pre-tax charged amount for the transaction. + * + * @return the subTotal value + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the tax amount applied to the transaction. + * + * @return the tax value + */ + public Amount tax() { + return this.tax; + } + + /** + * Get the unit of measure used to bill for the product. For example, compute services are billed per hour. + * + * @return the unitOfMeasure value + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the number of units used for a given product. + * + * @return the units value + */ + public Double units() { + return this.units; + } + + /** + * Get the description for the unit of measure for a given product. + * + * @return the unitType value + */ + public String unitType() { + return this.unitType; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsImpl.java new file mode 100644 index 0000000000000..06b7580f4b087 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsImpl.java @@ -0,0 +1,53 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.Transactions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2020_05_01.Transaction; + +class TransactionsImpl extends WrapperImpl implements Transactions { + private final BillingManager manager; + + TransactionsImpl(BillingManager manager) { + super(manager.inner().transactions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private TransactionImpl wrapModel(TransactionInner inner) { + return new TransactionImpl(inner, manager()); + } + + @Override + public Observable listByInvoiceAsync(final String billingAccountName, final String invoiceName) { + TransactionsInner client = this.inner(); + return client.listByInvoiceAsync(billingAccountName, invoiceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Transaction call(TransactionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsInner.java new file mode 100644 index 0000000000000..d42295a014ae4 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/TransactionsInner.java @@ -0,0 +1,298 @@ +/** + * 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.v2020_05_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2020_05_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Transactions. + */ +public class TransactionsInner { + /** The Retrofit service to perform REST calls. */ + private TransactionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of TransactionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransactionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(TransactionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Transactions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransactionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2020_05_01.Transactions listByInvoice" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions") + Observable> listByInvoice(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @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.v2020_05_01.Transactions listByInvoiceNext" }) + @GET + Observable> listByInvoiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 PagedList<TransactionInner> object if successful. + */ + public PagedList listByInvoice(final String billingAccountName, final String invoiceName) { + ServiceResponse> response = listByInvoiceSinglePageAsync(billingAccountName, invoiceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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> listByInvoiceAsync(final String billingAccountName, final String invoiceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSinglePageAsync(billingAccountName, invoiceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByInvoiceAsync(final String billingAccountName, final String invoiceName) { + return listByInvoiceWithServiceResponseAsync(billingAccountName, invoiceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByInvoiceWithServiceResponseAsync(final String billingAccountName, final String invoiceName) { + return listByInvoiceSinglePageAsync(billingAccountName, invoiceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSinglePageAsync(final String billingAccountName, final String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + final String apiVersion = "2020-05-01"; + return service.listByInvoice(billingAccountName, invoiceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 PagedList<TransactionInner> object if successful. + */ + public PagedList listByInvoiceNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listByInvoiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByInvoiceNextAsync(final String nextPageLink) { + return listByInvoiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByInvoiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseImpl.java new file mode 100644 index 0000000000000..819799fc0d00d --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseImpl.java @@ -0,0 +1,44 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ValidateAddressResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.AddressValidationStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; + +class ValidateAddressResponseImpl extends WrapperImpl implements ValidateAddressResponse { + private final BillingManager manager; + ValidateAddressResponseImpl(ValidateAddressResponseInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public AddressValidationStatus status() { + return this.inner().status(); + } + + @Override + public List suggestedAddresses() { + return this.inner().suggestedAddresses(); + } + + @Override + public String validationMessage() { + return this.inner().validationMessage(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseInner.java new file mode 100644 index 0000000000000..aef6d7df8118a --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateAddressResponseInner.java @@ -0,0 +1,99 @@ +/** + * 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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.AddressValidationStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2020_05_01.AddressDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the address validation. + */ +public class ValidateAddressResponseInner { + /** + * status of the address validation. Possible values include: 'Valid', + * 'Invalid'. + */ + @JsonProperty(value = "status") + private AddressValidationStatus status; + + /** + * The list of suggested addresses. + */ + @JsonProperty(value = "suggestedAddresses") + private List suggestedAddresses; + + /** + * Validation error message. + */ + @JsonProperty(value = "validationMessage") + private String validationMessage; + + /** + * Get status of the address validation. Possible values include: 'Valid', 'Invalid'. + * + * @return the status value + */ + public AddressValidationStatus status() { + return this.status; + } + + /** + * Set status of the address validation. Possible values include: 'Valid', 'Invalid'. + * + * @param status the status value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withStatus(AddressValidationStatus status) { + this.status = status; + return this; + } + + /** + * Get the list of suggested addresses. + * + * @return the suggestedAddresses value + */ + public List suggestedAddresses() { + return this.suggestedAddresses; + } + + /** + * Set the list of suggested addresses. + * + * @param suggestedAddresses the suggestedAddresses value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withSuggestedAddresses(List suggestedAddresses) { + this.suggestedAddresses = suggestedAddresses; + return this; + } + + /** + * Get validation error message. + * + * @return the validationMessage value + */ + public String validationMessage() { + return this.validationMessage; + } + + /** + * Set validation error message. + * + * @param validationMessage the validationMessage value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withValidationMessage(String validationMessage) { + this.validationMessage = validationMessage; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..a80b8acd42b47 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultImpl.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ValidateProductTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.ValidateProductTransferEligibilityError; + +class ValidateProductTransferEligibilityResultImpl extends WrapperImpl implements ValidateProductTransferEligibilityResult { + private final BillingManager manager; + ValidateProductTransferEligibilityResultImpl(ValidateProductTransferEligibilityResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public ValidateProductTransferEligibilityError errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public Boolean isMoveEligible() { + return this.inner().isMoveEligible(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..ce223265bf044 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateProductTransferEligibilityResultInner.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ValidateProductTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the product transfer eligibility validation. + */ +public class ValidateProductTransferEligibilityResultInner { + /** + * Specifies whether the transfer is eligible or not. + */ + @JsonProperty(value = "isMoveEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMoveEligible; + + /** + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateProductTransferEligibilityError errorDetails; + + /** + * Get specifies whether the transfer is eligible or not. + * + * @return the isMoveEligible value + */ + public Boolean isMoveEligible() { + return this.isMoveEligible; + } + + /** + * Get validation error details. + * + * @return the errorDetails value + */ + public ValidateProductTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set validation error details. + * + * @param errorDetails the errorDetails value to set + * @return the ValidateProductTransferEligibilityResultInner object itself. + */ + public ValidateProductTransferEligibilityResultInner withErrorDetails(ValidateProductTransferEligibilityError errorDetails) { + this.errorDetails = errorDetails; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..cf1f656483253 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultImpl.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ValidateSubscriptionTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2020_05_01.ValidateSubscriptionTransferEligibilityError; + +class ValidateSubscriptionTransferEligibilityResultImpl extends WrapperImpl implements ValidateSubscriptionTransferEligibilityResult { + private final BillingManager manager; + ValidateSubscriptionTransferEligibilityResultImpl(ValidateSubscriptionTransferEligibilityResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public Boolean isMoveEligible() { + return this.inner().isMoveEligible(); + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..3f02a0cfa0855 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/ValidateSubscriptionTransferEligibilityResultInner.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.v2020_05_01.implementation; + +import com.microsoft.azure.management.billing.v2020_05_01.ValidateSubscriptionTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the transfer eligibility validation. + */ +public class ValidateSubscriptionTransferEligibilityResultInner { + /** + * Specifies whether the subscription is eligible to be transferred. + */ + @JsonProperty(value = "isMoveEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMoveEligible; + + /** + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateSubscriptionTransferEligibilityError errorDetails; + + /** + * Get specifies whether the subscription is eligible to be transferred. + * + * @return the isMoveEligible value + */ + public Boolean isMoveEligible() { + return this.isMoveEligible; + } + + /** + * Get validation error details. + * + * @return the errorDetails value + */ + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set validation error details. + * + * @param errorDetails the errorDetails value to set + * @return the ValidateSubscriptionTransferEligibilityResultInner object itself. + */ + public ValidateSubscriptionTransferEligibilityResultInner withErrorDetails(ValidateSubscriptionTransferEligibilityError errorDetails) { + this.errorDetails = errorDetails; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/package-info.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/package-info.java new file mode 100644 index 0000000000000..dfa01aefc4f82 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the implementation classes for BillingManagementClient. + * Billing client provides access to billing resources for Azure subscriptions. + */ +package com.microsoft.azure.management.billing.v2020_05_01.implementation; diff --git a/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/package-info.java b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/package-info.java new file mode 100644 index 0000000000000..e216378d5d9e6 --- /dev/null +++ b/sdk/billing/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/billing/v2020_05_01/package-info.java @@ -0,0 +1,11 @@ +// 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. + +/** + * This package contains the classes for BillingManagementClient. + * Billing client provides access to billing resources for Azure subscriptions. + */ +package com.microsoft.azure.management.billing.v2020_05_01;