From 88bb7b0a3a18bae0ba792ef02b3336569a69e06b Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:45:03 +0800 Subject: [PATCH 01/10] generated Billing by autorest csharp --- .../Billing.Management.Sdk.csproj | 13 + .../Generated/AddressOperations.cs | 241 ++ .../Generated/AddressOperationsExtensions.cs | 61 + .../Generated/AgreementsOperations.cs | 604 +++++ .../AgreementsOperationsExtensions.cs | 151 ++ .../Generated/AvailableBalancesOperations.cs | 244 ++ .../AvailableBalancesOperationsExtensions.cs | 73 + .../Generated/BillingAccountsOperations.cs | 1156 ++++++++ .../BillingAccountsOperationsExtensions.cs | 311 +++ .../Generated/BillingManagementClient.cs | 464 ++++ .../Generated/BillingPermissionsOperations.cs | 1478 +++++++++++ .../BillingPermissionsOperationsExtensions.cs | 337 +++ .../Generated/BillingProfilesOperations.cs | 856 ++++++ .../BillingProfilesOperationsExtensions.cs | 263 ++ .../Generated/BillingPropertyOperations.cs | 419 +++ .../BillingPropertyOperationsExtensions.cs | 95 + .../BillingRoleAssignmentsOperations.cs | 2319 ++++++++++++++++ ...lingRoleAssignmentsOperationsExtensions.cs | 589 +++++ .../BillingRoleDefinitionsOperations.cs | 1728 ++++++++++++ ...lingRoleDefinitionsOperationsExtensions.cs | 439 ++++ .../BillingSubscriptionsOperations.cs | 2324 ++++++++++++++++ ...illingSubscriptionsOperationsExtensions.cs | 593 +++++ .../Generated/CustomersOperations.cs | 995 +++++++ .../CustomersOperationsExtensions.cs | 269 ++ .../Generated/IAddressOperations.cs | 50 + .../Generated/IAgreementsOperations.cs | 105 + .../Generated/IAvailableBalancesOperations.cs | 56 + .../Generated/IBillingAccountsOperations.cs | 207 ++ .../Generated/IBillingManagementClient.cs | 165 ++ .../IBillingPermissionsOperations.cs | 223 ++ .../Generated/IBillingProfilesOperations.cs | 171 ++ .../Generated/IBillingPropertyOperations.cs | 73 + .../IBillingRoleAssignmentsOperations.cs | 369 +++ .../IBillingRoleDefinitionsOperations.cs | 279 ++ .../IBillingSubscriptionsOperations.cs | 378 +++ .../Generated/ICustomersOperations.cs | 174 ++ .../Generated/IInstructionsOperations.cs | 138 + .../Generated/IInvoiceSectionsOperations.cs | 183 ++ .../Generated/IInvoicesOperations.cs | 389 +++ .../Generated/IOperations.cs | 70 + .../Generated/IPoliciesOperations.cs | 146 + .../Generated/IProductsOperations.cs | 384 +++ .../Generated/ITransactionsOperations.cs | 78 + .../Generated/InstructionsOperations.cs | 821 ++++++ .../InstructionsOperationsExtensions.cs | 207 ++ .../Generated/InvoiceSectionsOperations.cs | 871 ++++++ .../InvoiceSectionsOperationsExtensions.cs | 283 ++ .../Generated/InvoicesOperations.cs | 2208 ++++++++++++++++ .../Generated/InvoicesOperationsExtensions.cs | 609 +++++ .../Generated/Models/AcceptanceMode.cs | 23 + .../Generated/Models/AccountStatus.cs | 27 + .../Generated/Models/AccountType.cs | 23 + .../Generated/Models/AddressDetails.cs | 166 ++ .../Models/AddressValidationStatus.cs | 22 + .../Generated/Models/Agreement.cs | 120 + .../Generated/Models/AgreementType.cs | 24 + .../Generated/Models/Amount.cs | 59 + .../Generated/Models/AutoRenew.cs | 22 + .../Generated/Models/AvailableBalance.cs | 59 + .../Generated/Models/AzurePlan.cs | 59 + .../Generated/Models/BillingAccount.cs | 168 ++ .../Models/BillingAccountUpdateRequest.cs | 166 ++ .../Generated/Models/BillingFrequency.cs | 23 + .../Models/BillingPermissionsProperties.cs | 66 + .../Generated/Models/BillingProfile.cs | 192 ++ .../Models/BillingProfileCreationRequest.cs | 107 + .../Models/BillingProfileSpendingLimit.cs | 22 + .../Generated/Models/BillingProfileStatus.cs | 23 + .../Models/BillingProfileStatusReasonCode.cs | 23 + .../BillingProfilesCreateOrUpdateHeaders.cs | 65 + .../Models/BillingProfilesOnExpand.cs | 70 + .../Generated/Models/BillingProperty.cs | 217 ++ .../Generated/Models/BillingRoleAssignment.cs | 142 + .../Generated/Models/BillingRoleDefinition.cs | 77 + .../Generated/Models/BillingSubscription.cs | 194 ++ .../Models/BillingSubscriptionStatusType.cs | 25 + .../Models/BillingSubscriptionsMoveHeaders.cs | 65 + .../Generated/Models/Category.cs | 23 + .../Generated/Models/Customer.cs | 97 + .../Generated/Models/CustomerPolicy.cs | 62 + .../Generated/Models/Department.cs | 88 + .../Generated/Models/Document.cs | 72 + .../Generated/Models/DocumentSource.cs | 22 + .../Generated/Models/DocumentType.cs | 24 + .../Generated/Models/DownloadUrl.cs | 61 + .../Generated/Models/Enrollment.cs | 119 + .../Generated/Models/EnrollmentAccount.cs | 114 + .../Models/EnrollmentAccountContext.cs | 80 + .../Generated/Models/EnrollmentPolicies.cs | 84 + .../Generated/Models/ErrorDetails.cs | 68 + .../Generated/Models/ErrorResponse.cs | 52 + .../Models/ErrorResponseException.cs | 62 + .../Generated/Models/Instruction.cs | 97 + .../Generated/Models/Invoice.cs | 267 ++ .../Generated/Models/InvoiceSection.cs | 79 + .../Models/InvoiceSectionCreationRequest.cs | 53 + .../InvoiceSectionWithCreateSubPermission.cs | 144 + .../InvoiceSectionsCreateOrUpdateHeaders.cs | 65 + .../Models/InvoiceSectionsOnExpand.cs | 70 + .../Generated/Models/InvoiceStatus.cs | 23 + .../Generated/Models/InvoiceType.cs | 23 + ...wnloadBillingSubscriptionInvoiceHeaders.cs | 66 + .../Models/InvoicesDownloadInvoiceHeaders.cs | 66 + .../Models/MarketplacePurchasesPolicy.cs | 23 + .../Generated/Models/Operation.cs | 61 + .../Generated/Models/OperationDisplay.cs | 70 + .../Generated/Models/Page.cs | 53 + .../Generated/Models/Participants.cs | 69 + .../Generated/Models/PaymentMethodFamily.cs | 24 + .../Generated/Models/PaymentProperties.cs | 86 + .../Generated/Models/Policy.cs | 87 + .../Generated/Models/Product.cs | 256 ++ .../Generated/Models/ProductStatusType.cs | 28 + .../ProductTransferValidationErrorCode.cs | 29 + .../Generated/Models/ProductsMoveHeaders.cs | 63 + .../Generated/Models/Reseller.cs | 59 + .../Models/ReservationPurchasesPolicy.cs | 22 + .../Generated/Models/ReservationType.cs | 22 + .../Generated/Models/Resource.cs | 69 + .../Generated/Models/SpendingLimit.cs | 22 + .../Models/SpendingLimitForBillingProfile.cs | 22 + .../Generated/Models/StatusReasonCode.cs | 23 + .../StatusReasonCodeForBillingProfile.cs | 23 + ...SubscriptionTransferValidationErrorCode.cs | 28 + .../Generated/Models/Transaction.cs | 408 +++ .../Generated/Models/TransactionTypeKind.cs | 22 + ...ferBillingSubscriptionRequestProperties.cs | 68 + .../TransferProductRequestProperties.cs | 54 + .../Models/ValidateAddressResponse.cs | 72 + ...ValidateProductTransferEligibilityError.cs | 84 + ...alidateProductTransferEligibilityResult.cs | 62 + ...ateSubscriptionTransferEligibilityError.cs | 81 + ...teSubscriptionTransferEligibilityResult.cs | 63 + .../Generated/Models/ViewCharges.cs | 22 + .../Generated/Models/ViewChargesPolicy.cs | 22 + .../Generated/Operations.cs | 392 +++ .../Generated/OperationsExtensions.cs | 91 + .../Generated/PoliciesOperations.cs | 835 ++++++ .../Generated/PoliciesOperationsExtensions.cs | 213 ++ .../Generated/ProductsOperations.cs | 2341 +++++++++++++++++ .../Generated/ProductsOperationsExtensions.cs | 609 +++++ .../SdkInfo_BillingManagementClient.cs | 44 + .../Generated/TransactionsOperations.cs | 412 +++ .../TransactionsOperationsExtensions.cs | 107 + .../Properties/AssemblyInfo.cs | 29 + src/Billing/Billing.Management.Sdk/README.md | 35 + 146 files changed, 36094 insertions(+) create mode 100644 src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Operations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs create mode 100644 src/Billing/Billing.Management.Sdk/README.md diff --git a/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj b/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj new file mode 100644 index 000000000000..f01a79c2fc4e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + Billing + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Billing.Management.Sdk + Microsoft.Azure.Management.Billing + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs new file mode 100644 index 000000000000..d922a0b43aa9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AddressOperations operations. + /// + internal partial class AddressOperations : IServiceOperations, IAddressOperations + { + /// + /// Initializes a new instance of the AddressOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AddressOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (address == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "address"); + } + if (address != null) + { + address.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("address", address); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/validateAddress").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(address != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(address, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs new file mode 100644 index 000000000000..820680b6ba61 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AddressOperations. + /// + public static partial class AddressOperationsExtensions + { + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) + { + return operations.ValidateAsync(address).GetAwaiter().GetResult(); + } + + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ValidateAsync(this IAddressOperations operations, AddressDetails address, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs new file mode 100644 index 000000000000..1d43b32dd395 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AgreementsOperations operations. + /// + internal partial class AgreementsOperations : IServiceOperations, IAgreementsOperations + { + /// + /// Initializes a new instance of the AgreementsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AgreementsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an agreement by ID. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (agreementName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agreementName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("agreementName", agreementName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{agreementName}", System.Uri.EscapeDataString(agreementName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs new file mode 100644 index 000000000000..e5377e98818a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AgreementsOperations. + /// + public static partial class AgreementsOperationsExtensions + { + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + public static IPage ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an agreement by ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + public static Agreement Get(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, agreementName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets an agreement by ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, agreementName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IAgreementsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IAgreementsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs new file mode 100644 index 000000000000..0d741b8bb43d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs @@ -0,0 +1,244 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailableBalancesOperations operations. + /// + internal partial class AvailableBalancesOperations : IServiceOperations, IAvailableBalancesOperations + { + /// + /// Initializes a new instance of the AvailableBalancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailableBalancesOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs new file mode 100644 index 000000000000..88f874001632 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AvailableBalancesOperations. + /// + public static partial class AvailableBalancesOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static AvailableBalance Get(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName) + { + return operations.GetAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs new file mode 100644 index 000000000000..b2d052925aee --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs @@ -0,0 +1,1156 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingAccountsOperations operations. + /// + internal partial class BillingAccountsOperations : IServiceOperations, IBillingAccountsOperations + { + /// + /// Initializes a new instance of the BillingAccountsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingAccountsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a billing account by its ID. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermission", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermissionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs new file mode 100644 index 000000000000..077b97c61b0e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs @@ -0,0 +1,311 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingAccountsOperations. + /// + public static partial class BillingAccountsOperationsExtensions + { + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static IPage List(this IBillingAccountsOperations operations, string expand = default(string)) + { + return operations.ListAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBillingAccountsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a billing account by its ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a billing account by its ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static IPage ListInvoiceSectionsByCreateSubscriptionPermission(this IBillingAccountsOperations operations, string billingAccountName) + { + return operations.ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(this IBillingAccountsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IBillingAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListInvoiceSectionsByCreateSubscriptionPermissionNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(this IBillingAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs new file mode 100644 index 000000000000..6792e2b31610 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs @@ -0,0 +1,464 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Billing client provides access to billing resources for Azure + /// subscriptions. + /// + public partial class BillingManagementClient : ServiceClient, IBillingManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The version of the API to be used with the client request. The current + /// version is 2020-05-01. + /// + public string ApiVersion { get; private set; } + + /// + /// The ID that uniquely identifies an Azure subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// 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. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IBillingAccountsOperations. + /// + public virtual IBillingAccountsOperations BillingAccounts { get; private set; } + + /// + /// Gets the IAddressOperations. + /// + public virtual IAddressOperations Address { get; private set; } + + /// + /// Gets the IAvailableBalancesOperations. + /// + public virtual IAvailableBalancesOperations AvailableBalances { get; private set; } + + /// + /// Gets the IInstructionsOperations. + /// + public virtual IInstructionsOperations Instructions { get; private set; } + + /// + /// Gets the IBillingProfilesOperations. + /// + public virtual IBillingProfilesOperations BillingProfiles { get; private set; } + + /// + /// Gets the ICustomersOperations. + /// + public virtual ICustomersOperations Customers { get; private set; } + + /// + /// Gets the IInvoiceSectionsOperations. + /// + public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; } + + /// + /// Gets the IBillingPermissionsOperations. + /// + public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } + + /// + /// Gets the IBillingSubscriptionsOperations. + /// + public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } + + /// + /// Gets the IProductsOperations. + /// + public virtual IProductsOperations Products { get; private set; } + + /// + /// Gets the IInvoicesOperations. + /// + public virtual IInvoicesOperations Invoices { get; private set; } + + /// + /// Gets the ITransactionsOperations. + /// + public virtual ITransactionsOperations Transactions { get; private set; } + + /// + /// Gets the IPoliciesOperations. + /// + public virtual IPoliciesOperations Policies { get; private set; } + + /// + /// Gets the IBillingPropertyOperations. + /// + public virtual IBillingPropertyOperations BillingProperty { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IBillingRoleDefinitionsOperations. + /// + public virtual IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; private set; } + + /// + /// Gets the IBillingRoleAssignmentsOperations. + /// + public virtual IBillingRoleAssignmentsOperations BillingRoleAssignments { get; private set; } + + /// + /// Gets the IAgreementsOperations. + /// + public virtual IAgreementsOperations Agreements { get; private set; } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BillingManagementClient.Dispose(). False: will not dispose provided httpClient + protected BillingManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BillingManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BillingManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BillingManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BillingManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BillingManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + BillingAccounts = new BillingAccountsOperations(this); + Address = new AddressOperations(this); + AvailableBalances = new AvailableBalancesOperations(this); + Instructions = new InstructionsOperations(this); + BillingProfiles = new BillingProfilesOperations(this); + Customers = new CustomersOperations(this); + InvoiceSections = new InvoiceSectionsOperations(this); + BillingPermissions = new BillingPermissionsOperations(this); + BillingSubscriptions = new BillingSubscriptionsOperations(this); + Products = new ProductsOperations(this); + Invoices = new InvoicesOperations(this); + Transactions = new TransactionsOperations(this); + Policies = new PoliciesOperations(this); + BillingProperty = new BillingPropertyOperations(this); + Operations = new Operations(this); + BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); + BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); + Agreements = new AgreementsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-05-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs new file mode 100644 index 000000000000..69e92624c14a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs @@ -0,0 +1,1478 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingPermissionsOperations operations. + /// + internal partial class BillingPermissionsOperations : IServiceOperations, IBillingPermissionsOperations + { + /// + /// Initializes a new instance of the BillingPermissionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPermissionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs new file mode 100644 index 000000000000..11e6740a5193 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs @@ -0,0 +1,337 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingPermissionsOperations. + /// + public static partial class BillingPermissionsOperationsExtensions + { + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static IPage ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) + { + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static IPage ListByBillingAccount(this IBillingPermissionsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingPermissionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static IPage ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return operations.ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCustomerNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceSectionsNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceSectionsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionsNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs new file mode 100644 index 000000000000..f0b4b805d750 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs @@ -0,0 +1,856 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingProfilesOperations operations. + /// + internal partial class BillingProfilesOperations : IServiceOperations, IBillingProfilesOperations + { + /// + /// Initializes a new instance of the BillingProfilesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingProfilesOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs new file mode 100644 index 000000000000..c83e977d70be --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs @@ -0,0 +1,263 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingProfilesOperations. + /// + public static partial class BillingProfilesOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + public static IPage ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + public static BillingProfile Get(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, billingProfileName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + public static BillingProfile CreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return operations.CreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + public static BillingProfile BeginCreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return operations.BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingProfilesOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingProfilesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs new file mode 100644 index 000000000000..60f4773dc9d0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs @@ -0,0 +1,419 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingPropertyOperations operations. + /// + internal partial class BillingPropertyOperations : IServiceOperations, IBillingPropertyOperations + { + /// + /// Initializes a new instance of the BillingPropertyOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPropertyOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The cost center applied to the subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + BillingProperty parameters = new BillingProperty(); + if (costCenter != null) + { + parameters.CostCenter = costCenter; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs new file mode 100644 index 000000000000..c1495f26a1ac --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs @@ -0,0 +1,95 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingPropertyOperations. + /// + public static partial class BillingPropertyOperationsExtensions + { + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + public static BillingProperty Get(this IBillingPropertyOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBillingPropertyOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cost center applied to the subscription. + /// + public static BillingProperty Update(this IBillingPropertyOperations operations, string costCenter = default(string)) + { + return operations.UpdateAsync(costCenter).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cost center applied to the subscription. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBillingPropertyOperations operations, string costCenter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(costCenter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs new file mode 100644 index 000000000000..96b79c9460a9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs @@ -0,0 +1,2319 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingRoleAssignmentsOperations operations. + /// + internal partial class BillingRoleAssignmentsOperations : IServiceOperations, IBillingRoleAssignmentsOperations + { + /// + /// Initializes a new instance of the BillingRoleAssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingRoleAssignmentsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (billingRoleAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..48c8e80f6279 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs @@ -0,0 +1,589 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingRoleAssignmentsOperations. + /// + public static partial class BillingRoleAssignmentsOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return operations.GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task GetByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return operations.DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return operations.DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return operations.DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static IPage ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static IPage ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceSectionNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs new file mode 100644 index 000000000000..bf753c9e6b5c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs @@ -0,0 +1,1728 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingRoleDefinitionsOperations operations. + /// + internal partial class BillingRoleDefinitionsOperations : IServiceOperations, IBillingRoleDefinitionsOperations + { + /// + /// Initializes a new instance of the BillingRoleDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingRoleDefinitionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingRoleDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingRoleDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (billingRoleDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..4191352dd36f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs @@ -0,0 +1,439 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingRoleDefinitionsOperations. + /// + public static partial class BillingRoleDefinitionsOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) + { + return operations.GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) + { + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) + { + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static IPage ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static IPage ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceSectionNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs new file mode 100644 index 000000000000..017230326095 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs @@ -0,0 +1,2324 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingSubscriptionsOperations operations. + /// + internal partial class BillingSubscriptionsOperations : IServiceOperations, IBillingSubscriptionsOperations + { + /// + /// Initializes a new instance of the BillingSubscriptionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingSubscriptionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing subscription + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (destinationInvoiceSectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "destinationInvoiceSectionId"); + } + TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); + if (destinationInvoiceSectionId != null) + { + parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (destinationInvoiceSectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "destinationInvoiceSectionId"); + } + TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); + if (destinationInvoiceSectionId != null) + { + parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginMove", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs new file mode 100644 index 000000000000..a1527cd534ec --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -0,0 +1,593 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BillingSubscriptionsOperations. + /// + public static partial class BillingSubscriptionsOperationsExtensions + { + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) + { + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static IPage ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return operations.GetAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing subscription + /// operation. + /// + public static BillingSubscription Update(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters) + { + return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing subscription + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return operations.MoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The cancellation token. + /// + public static async Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return operations.ValidateMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return operations.BeginMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The cancellation token. + /// + public static async Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceSectionNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs new file mode 100644 index 000000000000..5469cab8ec66 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs @@ -0,0 +1,995 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CustomersOperations operations. + /// + internal partial class CustomersOperations : IServiceOperations, ICustomersOperations + { + /// + /// Initializes a new instance of the CustomersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("search", search); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (search != null) + { + _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("search", search); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (search != null) + { + _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs new file mode 100644 index 000000000000..feace61fe227 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs @@ -0,0 +1,269 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CustomersOperations. + /// + public static partial class CustomersOperationsExtensions + { + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string)) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, search, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, search, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, search, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, search, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs new file mode 100644 index 000000000000..bdce96e8c9b8 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AddressOperations operations. + /// + public partial interface IAddressOperations + { + /// + /// Validates an address. Use the operation to validate an address + /// before using it as soldTo or a billTo address. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs new file mode 100644 index 000000000000..cc4316dacee9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AgreementsOperations operations. + /// + public partial interface IAgreementsOperations + { + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an agreement by ID. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the agreements for a billing account. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs new file mode 100644 index 000000000000..4bb7400fb5b3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailableBalancesOperations operations. + /// + public partial interface IAvailableBalancesOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs new file mode 100644 index 000000000000..b20fbe01ba4e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs @@ -0,0 +1,207 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingAccountsOperations operations. + /// + public partial interface IBillingAccountsOperations + { + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// May be used to expand the soldTo, invoice sections and billing + /// profiles. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a billing account by its ID. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing + /// profiles. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs new file mode 100644 index 000000000000..03374ac78766 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Billing client provides access to billing resources for Azure + /// subscriptions. + /// + public partial interface IBillingManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The version of the API to be used with the client request. The + /// current version is 2020-05-01. + /// + string ApiVersion { get; } + + /// + /// The ID that uniquely identifies an Azure subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// 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. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IBillingAccountsOperations. + /// + IBillingAccountsOperations BillingAccounts { get; } + + /// + /// Gets the IAddressOperations. + /// + IAddressOperations Address { get; } + + /// + /// Gets the IAvailableBalancesOperations. + /// + IAvailableBalancesOperations AvailableBalances { get; } + + /// + /// Gets the IInstructionsOperations. + /// + IInstructionsOperations Instructions { get; } + + /// + /// Gets the IBillingProfilesOperations. + /// + IBillingProfilesOperations BillingProfiles { get; } + + /// + /// Gets the ICustomersOperations. + /// + ICustomersOperations Customers { get; } + + /// + /// Gets the IInvoiceSectionsOperations. + /// + IInvoiceSectionsOperations InvoiceSections { get; } + + /// + /// Gets the IBillingPermissionsOperations. + /// + IBillingPermissionsOperations BillingPermissions { get; } + + /// + /// Gets the IBillingSubscriptionsOperations. + /// + IBillingSubscriptionsOperations BillingSubscriptions { get; } + + /// + /// Gets the IProductsOperations. + /// + IProductsOperations Products { get; } + + /// + /// Gets the IInvoicesOperations. + /// + IInvoicesOperations Invoices { get; } + + /// + /// Gets the ITransactionsOperations. + /// + ITransactionsOperations Transactions { get; } + + /// + /// Gets the IPoliciesOperations. + /// + IPoliciesOperations Policies { get; } + + /// + /// Gets the IBillingPropertyOperations. + /// + IBillingPropertyOperations BillingProperty { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IBillingRoleDefinitionsOperations. + /// + IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; } + + /// + /// Gets the IBillingRoleAssignmentsOperations. + /// + IBillingRoleAssignmentsOperations BillingRoleAssignments { get; } + + /// + /// Gets the IAgreementsOperations. + /// + IAgreementsOperations Agreements { get; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs new file mode 100644 index 000000000000..12dcf5666b33 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs @@ -0,0 +1,223 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingPermissionsOperations operations. + /// + public partial interface IBillingPermissionsOperations + { + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs new file mode 100644 index 000000000000..ebb48861f5f2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs @@ -0,0 +1,171 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingProfilesOperations operations. + /// + public partial interface IBillingProfilesOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a billing profile by its ID. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement + /// or Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a billing profile. The operation is supported + /// for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a billing profile. The operation is supported + /// for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs new file mode 100644 index 000000000000..b8cc5b1c212f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingPropertyOperations operations. + /// + public partial interface IBillingPropertyOperations + { + /// + /// Get the billing properties for a subscription. This operation is + /// not supported for billing accounts with agreement type Enterprise + /// Agreement. + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The cost center applied to the subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs new file mode 100644 index 000000000000..694bccf30013 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs @@ -0,0 +1,369 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingRoleAssignmentsOperations operations. + /// + public partial interface IBillingRoleAssignmentsOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the role assignments for the caller on an invoice section. + /// The operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the role assignments for the caller on an invoice section. + /// The operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs new file mode 100644 index 000000000000..5e57e22c27af --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs @@ -0,0 +1,279 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingRoleDefinitionsOperations operations. + /// + public partial interface IBillingRoleDefinitionsOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the definition for a role on an invoice section. The operation + /// is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs new file mode 100644 index 000000000000..5994c28e7d14 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs @@ -0,0 +1,378 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BillingSubscriptionsOperations operations. + /// + public partial interface IBillingSubscriptionsOperations + { + /// + /// Lists the subscriptions for a customer. The operation is supported + /// only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the subscriptions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft + /// Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a subscription by its ID. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement + /// and Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing + /// subscription operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the subscriptions for a customer. The operation is supported + /// only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the subscriptions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft + /// Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs new file mode 100644 index 000000000000..a35aebad63e1 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs @@ -0,0 +1,174 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CustomersOperations operations. + /// + public partial interface ICustomersOperations + { + /// + /// Lists the customers that are billed to a billing profile. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the customers that are billed to a billing account. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a customer by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the customers that are billed to a billing profile. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Partner Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the customers that are billed to a billing account. The + /// operation is supported only for billing accounts with agreement + /// type Microsoft Partner Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs new file mode 100644 index 000000000000..6f1f8810d35e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs @@ -0,0 +1,138 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InstructionsOperations operations. + /// + public partial interface IInstructionsOperations + { + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the instruction by name. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an instruction. These are custom billing + /// instructions and are only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs new file mode 100644 index 000000000000..2c31ee4b50ca --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs @@ -0,0 +1,183 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InvoiceSectionsOperations operations. + /// + public partial interface IInvoiceSectionsOperations + { + /// + /// Lists the invoice sections that a user has access to. The operation + /// is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an invoice section by its ID. The operation is supported only + /// for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an invoice section. The operation is supported + /// only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an invoice section. The operation is supported + /// only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the invoice sections that a user has access to. The operation + /// is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs new file mode 100644 index 000000000000..f5e65474be40 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs @@ -0,0 +1,389 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InvoicesOperations operations. + /// + public partial interface IInvoicesOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified + /// in MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified + /// in MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an invoice by ID. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a URL to download an invoice. The operation is supported for + /// billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a URL to download an invoice. The operation is supported for + /// billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..ecace1e9febc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs new file mode 100644 index 000000000000..b0772a689ab0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs @@ -0,0 +1,146 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PoliciesOperations operations. + /// + public partial interface IPoliciesOperations + { + /// + /// Lists the policies for a billing profile. This operation is + /// supported only for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the policies for a billing profile. This operation is + /// supported only for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the policies for a customer. This operation is supported only + /// for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the policies for a customer. This operation is supported + /// only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs new file mode 100644 index 000000000000..aa5cf73e8598 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs @@ -0,0 +1,384 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProductsOperations operations. + /// + public partial interface IProductsOperations + { + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a product by ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs new file mode 100644 index 000000000000..4f8e8eff7811 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TransactionsOperations operations. + /// + public partial interface ITransactionsOperations + { + /// + /// Lists the transactions for an invoice. Transactions include + /// purchases, refunds and Azure usage charges. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the transactions for an invoice. Transactions include + /// purchases, refunds and Azure usage charges. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs new file mode 100644 index 000000000000..8d35a98a3884 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs @@ -0,0 +1,821 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InstructionsOperations operations. + /// + internal partial class InstructionsOperations : IServiceOperations, IInstructionsOperations + { + /// + /// Initializes a new instance of the InstructionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InstructionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (instructionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instructionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("instructionName", instructionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (instructionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instructionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("instructionName", instructionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs new file mode 100644 index 000000000000..449f73587cc0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs @@ -0,0 +1,207 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for InstructionsOperations. + /// + public static partial class InstructionsOperationsExtensions + { + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IInstructionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + public static Instruction Get(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName) + { + return operations.GetAsync(billingAccountName, billingProfileName, instructionName).GetAwaiter().GetResult(); + } + + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + public static Instruction Put(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters) + { + return operations.PutAsync(billingAccountName, billingProfileName, instructionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IInstructionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IInstructionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs new file mode 100644 index 000000000000..3000576e7780 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs @@ -0,0 +1,871 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InvoiceSectionsOperations operations. + /// + internal partial class InvoiceSectionsOperations : IServiceOperations, IInvoiceSectionsOperations + { + /// + /// Initializes a new instance of the InvoiceSectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InvoiceSectionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + InvoiceSection parameters = new InvoiceSection(); + if (displayName != null || labels != null) + { + parameters.DisplayName = displayName; + parameters.Labels = labels; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs new file mode 100644 index 000000000000..f737203cbeb1 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs @@ -0,0 +1,283 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for InvoiceSectionsOperations. + /// + public static partial class InvoiceSectionsOperationsExtensions + { + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static IPage ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary)) + { + return operations.CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary)) + { + return operations.BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The name of the invoice section. + /// + /// + /// Dictionary of metadata associated with the invoice section. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IInvoiceSectionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IInvoiceSectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs new file mode 100644 index 000000000000..23bb29215f1d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs @@ -0,0 +1,2208 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InvoicesOperations operations. + /// + internal partial class InvoicesOperations : IServiceOperations, IInvoicesOperations + { + /// + /// Initializes a new instance of the InvoicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InvoicesOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (periodStartDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + } + if (periodEndDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (periodStartDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + } + if (periodEndDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (periodStartDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + } + if (periodEndDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetBySubscriptionAndInvoiceId", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + if (downloadToken == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "downloadToken"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("downloadToken", downloadToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadInvoice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (downloadToken != null) + { + _queryParameters.Add(string.Format("downloadToken={0}", System.Uri.EscapeDataString(downloadToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + if (downloadToken == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "downloadToken"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("downloadToken", downloadToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadBillingSubscriptionInvoice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (downloadToken != null) + { + _queryParameters.Add(string.Format("downloadToken={0}", System.Uri.EscapeDataString(downloadToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs new file mode 100644 index 000000000000..51e787b272ca --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs @@ -0,0 +1,609 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for InvoicesOperations. + /// + public static partial class InvoicesOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static IPage ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) + { + return operations.ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static IPage ListByBillingProfile(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string invoiceName) + { + return operations.GetAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetById(this IInvoicesOperations operations, string invoiceName) + { + return operations.GetByIdAsync(invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IInvoicesOperations operations, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return operations.DownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + public static IPage ListByBillingSubscription(this IInvoicesOperations operations, string periodStartDate, string periodEndDate) + { + return operations.ListByBillingSubscriptionAsync(periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingSubscriptionAsync(this IInvoicesOperations operations, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionWithHttpMessagesAsync(periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetBySubscriptionAndInvoiceId(this IInvoicesOperations operations, string invoiceName) + { + return operations.GetBySubscriptionAndInvoiceIdAsync(invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async Task GetBySubscriptionAndInvoiceIdAsync(this IInvoicesOperations operations, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return operations.DownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return operations.BeginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return operations.BeginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IInvoicesOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IInvoicesOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingSubscriptionNext(this IInvoicesOperations operations, string nextPageLink) + { + return operations.ListByBillingSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingSubscriptionNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs new file mode 100644 index 000000000000..a6257a0c5c3d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AcceptanceMode. + /// + public static class AcceptanceMode + { + public const string ClickToAccept = "ClickToAccept"; + public const string ESignEmbedded = "ESignEmbedded"; + public const string ESignOffline = "ESignOffline"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs new file mode 100644 index 000000000000..51802b73f8b7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AccountStatus. + /// + public static class AccountStatus + { + public const string Active = "Active"; + public const string Deleted = "Deleted"; + public const string Disabled = "Disabled"; + public const string Expired = "Expired"; + public const string Transferred = "Transferred"; + public const string Extended = "Extended"; + public const string Terminated = "Terminated"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs new file mode 100644 index 000000000000..39da7284d44c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AccountType. + /// + public static class AccountType + { + public const string Enterprise = "Enterprise"; + public const string Individual = "Individual"; + public const string Partner = "Partner"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs new file mode 100644 index 000000000000..be2312fb279b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs @@ -0,0 +1,166 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Address details. + /// + public partial class AddressDetails + { + /// + /// Initializes a new instance of the AddressDetails class. + /// + public AddressDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AddressDetails class. + /// + /// Address line 1. + /// Country code uses ISO2, 2-digit + /// format. + /// First name. + /// Last name. + /// Company name. + /// Address line 2. + /// Address line 3. + /// Address city. + /// Address district. + /// Address region. + /// Postal code. + /// Email address. + /// Phone number. + public AddressDetails(string addressLine1, string country, string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string district = default(string), string region = default(string), string postalCode = default(string), string email = default(string), string phoneNumber = default(string)) + { + FirstName = firstName; + LastName = lastName; + CompanyName = companyName; + AddressLine1 = addressLine1; + AddressLine2 = addressLine2; + AddressLine3 = addressLine3; + City = city; + District = district; + Region = region; + Country = country; + PostalCode = postalCode; + Email = email; + PhoneNumber = phoneNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets first name. + /// + [JsonProperty(PropertyName = "firstName")] + public string FirstName { get; set; } + + /// + /// Gets or sets last name. + /// + [JsonProperty(PropertyName = "lastName")] + public string LastName { get; set; } + + /// + /// Gets or sets company name. + /// + [JsonProperty(PropertyName = "companyName")] + public string CompanyName { get; set; } + + /// + /// Gets or sets address line 1. + /// + [JsonProperty(PropertyName = "addressLine1")] + public string AddressLine1 { get; set; } + + /// + /// Gets or sets address line 2. + /// + [JsonProperty(PropertyName = "addressLine2")] + public string AddressLine2 { get; set; } + + /// + /// Gets or sets address line 3. + /// + [JsonProperty(PropertyName = "addressLine3")] + public string AddressLine3 { get; set; } + + /// + /// Gets or sets address city. + /// + [JsonProperty(PropertyName = "city")] + public string City { get; set; } + + /// + /// Gets or sets address district. + /// + [JsonProperty(PropertyName = "district")] + public string District { get; set; } + + /// + /// Gets or sets address region. + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; set; } + + /// + /// Gets or sets country code uses ISO2, 2-digit format. + /// + [JsonProperty(PropertyName = "country")] + public string Country { get; set; } + + /// + /// Gets or sets postal code. + /// + [JsonProperty(PropertyName = "postalCode")] + public string PostalCode { get; set; } + + /// + /// Gets or sets email address. + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or sets phone number. + /// + [JsonProperty(PropertyName = "phoneNumber")] + public string PhoneNumber { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AddressLine1 == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AddressLine1"); + } + if (Country == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Country"); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs new file mode 100644 index 000000000000..41d215933e7e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AddressValidationStatus. + /// + public static class AddressValidationStatus + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs new file mode 100644 index 000000000000..ef8b3b47aa74 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An agreement. + /// + [Rest.Serialization.JsonTransformation] + public partial class Agreement : Resource + { + /// + /// Initializes a new instance of the Agreement class. + /// + public Agreement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Agreement class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The URL to download the + /// agreement. + /// The category of the agreement signed by a + /// customer. Possible values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + /// The mode of acceptance for an + /// agreement. Possible values include: 'ClickToAccept', + /// 'ESignEmbedded', 'ESignOffline' + /// The date from which the agreement is + /// effective. + /// The date when the agreement + /// expires. + /// The list of participants that + /// participates in acceptance of an agreement. + /// The current status of the agreement. + public Agreement(string id = default(string), string name = default(string), string type = default(string), string agreementLink = default(string), string category = default(string), string acceptanceMode = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), IList participants = default(IList), string status = default(string)) + : base(id, name, type) + { + AgreementLink = agreementLink; + Category = category; + AcceptanceMode = acceptanceMode; + EffectiveDate = effectiveDate; + ExpirationDate = expirationDate; + Participants = participants; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the URL to download the agreement. + /// + [JsonProperty(PropertyName = "properties.agreementLink")] + public string AgreementLink { get; private set; } + + /// + /// Gets the category of the agreement signed by a customer. Possible + /// values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; private set; } + + /// + /// Gets the mode of acceptance for an agreement. Possible values + /// include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + /// + [JsonProperty(PropertyName = "properties.acceptanceMode")] + public string AcceptanceMode { get; private set; } + + /// + /// Gets the date from which the agreement is effective. + /// + [JsonProperty(PropertyName = "properties.effectiveDate")] + public System.DateTime? EffectiveDate { get; private set; } + + /// + /// Gets the date when the agreement expires. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; private set; } + + /// + /// Gets or sets the list of participants that participates in + /// acceptance of an agreement. + /// + [JsonProperty(PropertyName = "properties.participants")] + public IList Participants { get; set; } + + /// + /// Gets the current status of the agreement. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs new file mode 100644 index 000000000000..97f72f610539 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs @@ -0,0 +1,24 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AgreementType. + /// + public static class AgreementType + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string EnterpriseAgreement = "EnterpriseAgreement"; + public const string MicrosoftOnlineServicesProgram = "MicrosoftOnlineServicesProgram"; + public const string MicrosoftPartnerAgreement = "MicrosoftPartnerAgreement"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs new file mode 100644 index 000000000000..9dde6d59e280 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The amount. + /// + public partial class Amount + { + /// + /// Initializes a new instance of the Amount class. + /// + public Amount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Amount class. + /// + /// The currency for the amount value. + /// Amount value. + public Amount(string currency = default(string), double? value = default(double?)) + { + Currency = currency; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the currency for the amount value. + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; private set; } + + /// + /// Gets or sets amount value. + /// + [JsonProperty(PropertyName = "value")] + public double? Value { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs new file mode 100644 index 000000000000..34af34329611 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AutoRenew. + /// + public static class AutoRenew + { + public const string Off = "Off"; + public const string On = "On"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs new file mode 100644 index 000000000000..b2955e2d9d1a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The latest Azure credit balance. This is the balance available for pay + /// now. + /// + [Rest.Serialization.JsonTransformation] + public partial class AvailableBalance : Resource + { + /// + /// Initializes a new instance of the AvailableBalance class. + /// + public AvailableBalance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableBalance class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Balance amount. + public AvailableBalance(string id = default(string), string name = default(string), string type = default(string), Amount amount = default(Amount)) + : base(id, name, type) + { + Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets balance amount. + /// + [JsonProperty(PropertyName = "properties.amount")] + public Amount Amount { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs new file mode 100644 index 000000000000..3e89d33d93e9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of the Azure plan. + /// + public partial class AzurePlan + { + /// + /// Initializes a new instance of the AzurePlan class. + /// + public AzurePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzurePlan class. + /// + /// The sku id. + /// The sku description. + public AzurePlan(string skuId = default(string), string skuDescription = default(string)) + { + SkuId = skuId; + SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sku id. + /// + [JsonProperty(PropertyName = "skuId")] + public string SkuId { get; set; } + + /// + /// Gets the sku description. + /// + [JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs new file mode 100644 index 000000000000..d6f75c453bd2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs @@ -0,0 +1,168 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A billing account. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingAccount : Resource + { + /// + /// Initializes a new instance of the BillingAccount class. + /// + public BillingAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccount class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The billing account name. + /// The address of the individual or organization + /// that is responsible for the billing account. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' + /// The current status of the billing + /// account. Possible values include: 'Active', 'Deleted', 'Disabled', + /// 'Expired', 'Transferred', 'Extended', 'Terminated' + /// The billing profiles associated with + /// the billing account. By default this is not populated, unless it's + /// specified in $expand. + /// The details about the associated + /// legacy enrollment. By default this is not populated, unless it's + /// specified in $expand. + /// The departments associated to the + /// enrollment. + /// The accounts associated to the + /// enrollment. + /// Indicates whether user has read access + /// to the billing account. + public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) + : base(id, name, type) + { + DisplayName = displayName; + SoldTo = soldTo; + AgreementType = agreementType; + AccountType = accountType; + AccountStatus = accountStatus; + BillingProfiles = billingProfiles; + EnrollmentDetails = enrollmentDetails; + Departments = departments; + EnrollmentAccounts = enrollmentAccounts; + HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the billing account name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo { get; set; } + + /// + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' + /// + [JsonProperty(PropertyName = "properties.accountType")] + public string AccountType { get; private set; } + + /// + /// Gets the current status of the billing account. Possible values + /// include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + /// 'Extended', 'Terminated' + /// + [JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus { get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing + /// account. By default this is not populated, unless it's specified in + /// $expand. + /// + [JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles { get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default + /// this is not populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails { get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.departments")] + public IList Departments { get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public IList EnrollmentAccounts { get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SoldTo != null) + { + SoldTo.Validate(); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs new file mode 100644 index 000000000000..597cbbfc8e58 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs @@ -0,0 +1,166 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request properties of the billing account that can be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingAccountUpdateRequest + { + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + public BillingAccountUpdateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + /// The billing account name. + /// The address of the individual or organization + /// that is responsible for the billing account. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' + /// The current status of the billing + /// account. Possible values include: 'Active', 'Deleted', 'Disabled', + /// 'Expired', 'Transferred', 'Extended', 'Terminated' + /// The billing profiles associated with + /// the billing account. By default this is not populated, unless it's + /// specified in $expand. + /// The details about the associated + /// legacy enrollment. By default this is not populated, unless it's + /// specified in $expand. + /// The departments associated to the + /// enrollment. + /// The accounts associated to the + /// enrollment. + /// Indicates whether user has read access + /// to the billing account. + public BillingAccountUpdateRequest(string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) + { + DisplayName = displayName; + SoldTo = soldTo; + AgreementType = agreementType; + AccountType = accountType; + AccountStatus = accountStatus; + BillingProfiles = billingProfiles; + EnrollmentDetails = enrollmentDetails; + Departments = departments; + EnrollmentAccounts = enrollmentAccounts; + HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the billing account name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo { get; set; } + + /// + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' + /// + [JsonProperty(PropertyName = "properties.accountType")] + public string AccountType { get; private set; } + + /// + /// Gets the current status of the billing account. Possible values + /// include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', + /// 'Extended', 'Terminated' + /// + [JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus { get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing + /// account. By default this is not populated, unless it's specified in + /// $expand. + /// + [JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles { get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default + /// this is not populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails { get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.departments")] + public IList Departments { get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public IList EnrollmentAccounts { get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SoldTo != null) + { + SoldTo.Validate(); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs new file mode 100644 index 000000000000..35679ba0e15e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingFrequency. + /// + public static class BillingFrequency + { + public const string OneTime = "OneTime"; + public const string Monthly = "Monthly"; + public const string UsageBased = "UsageBased"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs new file mode 100644 index 000000000000..4a5ad7ec7b9c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs @@ -0,0 +1,66 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The set of allowed action and not allowed actions a caller has on a + /// billing account + /// + public partial class BillingPermissionsProperties + { + /// + /// Initializes a new instance of the BillingPermissionsProperties + /// class. + /// + public BillingPermissionsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPermissionsProperties + /// class. + /// + /// The set of actions that the caller is allowed + /// to perform. + /// The set of actions that the caller is not + /// allowed to perform. + public BillingPermissionsProperties(IList actions = default(IList), IList notActions = default(IList)) + { + Actions = actions; + NotActions = notActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of actions that the caller is allowed to perform. + /// + [JsonProperty(PropertyName = "actions")] + public IList Actions { get; private set; } + + /// + /// Gets the set of actions that the caller is not allowed to perform. + /// + [JsonProperty(PropertyName = "notActions")] + public IList NotActions { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs new file mode 100644 index 000000000000..35a438a6a3d6 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs @@ -0,0 +1,192 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A billing profile. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingProfile : Resource + { + /// + /// Initializes a new instance of the BillingProfile class. + /// + public BillingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfile class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the billing profile. + /// The purchase order name that will appear on + /// the invoices generated for the billing profile. + /// Billing address. + /// Flag controlling whether the + /// invoices for the billing profile are sent through email. + /// The day of the month when the invoice for + /// the billing profile is generated. + /// The currency in which the charges for the + /// billing profile are billed. + /// Information about the enabled azure + /// plans. + /// The invoice sections associated to + /// the billing profile. By default this is not populated, unless it's + /// specified in $expand. + /// Indicates whether user has read access + /// to the billing profile. + /// The system generated unique identifier for a + /// billing profile. + /// The status of the billing profile. Possible + /// values include: 'Active', 'Disabled', 'Warned' + /// Reason for the specified billing + /// profile status. Possible values include: 'PastDue', + /// 'SpendingLimitReached', 'SpendingLimitExpired' + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzurePlans = default(IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string), string spendingLimit = default(string)) + : base(id, name, type) + { + DisplayName = displayName; + PoNumber = poNumber; + BillTo = billTo; + InvoiceEmailOptIn = invoiceEmailOptIn; + InvoiceDay = invoiceDay; + Currency = currency; + EnabledAzurePlans = enabledAzurePlans; + InvoiceSections = invoiceSections; + HasReadAccess = hasReadAccess; + SystemId = systemId; + Status = status; + StatusReasonCode = statusReasonCode; + SpendingLimit = spendingLimit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the billing profile. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the + /// invoices generated for the billing profile. + /// + [JsonProperty(PropertyName = "properties.poNumber")] + public string PoNumber { get; set; } + + /// + /// Gets or sets billing address. + /// + [JsonProperty(PropertyName = "properties.billTo")] + public AddressDetails BillTo { get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing + /// profile are sent through email. + /// + [JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn { get; set; } + + /// + /// Gets the day of the month when the invoice for the billing profile + /// is generated. + /// + [JsonProperty(PropertyName = "properties.invoiceDay")] + public int? InvoiceDay { get; private set; } + + /// + /// Gets the currency in which the charges for the billing profile are + /// billed. + /// + [JsonProperty(PropertyName = "properties.currency")] + public string Currency { get; private set; } + + /// + /// Gets or sets information about the enabled azure plans. + /// + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + /// + /// Gets or sets the invoice sections associated to the billing + /// profile. By default this is not populated, unless it's specified in + /// $expand. + /// + [JsonProperty(PropertyName = "properties.invoiceSections")] + public InvoiceSectionsOnExpand InvoiceSections { get; set; } + + /// + /// Gets indicates whether user has read access to the billing profile. + /// + [JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess { get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [JsonProperty(PropertyName = "properties.systemId")] + public string SystemId { get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: + /// 'Active', 'Disabled', 'Warned' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible + /// values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + /// + [JsonProperty(PropertyName = "properties.statusReasonCode")] + public string StatusReasonCode { get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: + /// 'Off', 'On' + /// + [JsonProperty(PropertyName = "properties.spendingLimit")] + public string SpendingLimit { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BillTo != null) + { + BillTo.Validate(); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs new file mode 100644 index 000000000000..c3fb140c6d40 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request parameters for creating a new billing profile. + /// + public partial class BillingProfileCreationRequest + { + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + public BillingProfileCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + /// The name of the billing profile. + /// The purchase order name that will appear on + /// the invoices generated for the billing profile. + /// The address of the individual or organization + /// that is responsible for the billing profile. + /// Flag controlling whether the + /// invoices for the billing profile are sent through email. + /// Enabled azure plans for the billing + /// profile. + public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), IList enabledAzurePlans = default(IList)) + { + DisplayName = displayName; + PoNumber = poNumber; + BillTo = billTo; + InvoiceEmailOptIn = invoiceEmailOptIn; + EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the billing profile. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the + /// invoices generated for the billing profile. + /// + [JsonProperty(PropertyName = "poNumber")] + public string PoNumber { get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing profile. + /// + [JsonProperty(PropertyName = "billTo")] + public AddressDetails BillTo { get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing + /// profile are sent through email. + /// + [JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn { get; set; } + + /// + /// Gets or sets enabled azure plans for the billing profile. + /// + [JsonProperty(PropertyName = "enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BillTo != null) + { + BillTo.Validate(); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs new file mode 100644 index 000000000000..e4902a4b87d7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileSpendingLimit. + /// + public static class BillingProfileSpendingLimit + { + public const string Off = "Off"; + public const string On = "On"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs new file mode 100644 index 000000000000..673be9a7afec --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileStatus. + /// + public static class BillingProfileStatus + { + public const string Active = "Active"; + public const string Disabled = "Disabled"; + public const string Warned = "Warned"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs new file mode 100644 index 000000000000..40a646bebc07 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileStatusReasonCode. + /// + public static class BillingProfileStatusReasonCode + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..d9b7bfb5e74a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs @@ -0,0 +1,65 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class BillingProfilesCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// BillingProfilesCreateOrUpdateHeaders class. + /// + public BillingProfilesCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BillingProfilesCreateOrUpdateHeaders class. + /// + /// Location URI to poll for result + /// Recommended time to wait before making + /// another request to check the status of the operation. The time is + /// specified in seconds. + public BillingProfilesCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommended time to wait before making another request + /// to check the status of the operation. The time is specified in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs new file mode 100644 index 000000000000..76c7d5e48715 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The billing profiles associated with the billing account. By default + /// this is not populated, unless it's specified in $expand. + /// + public partial class BillingProfilesOnExpand + { + /// + /// Initializes a new instance of the BillingProfilesOnExpand class. + /// + public BillingProfilesOnExpand() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfilesOnExpand class. + /// + /// 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. + /// The billing profiles associated with the + /// billing account. + public BillingProfilesOnExpand(bool? hasMoreResults = default(bool?), IList value = default(IList)) + { + HasMoreResults = hasMoreResults; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets 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(PropertyName = "hasMoreResults")] + public bool? HasMoreResults { get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing + /// account. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs new file mode 100644 index 000000000000..1c0f99b42182 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A billing property. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingProperty : Resource + { + /// + /// Initializes a new instance of the BillingProperty class. + /// + public BillingProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProperty class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The email + /// address on which the account admin gets all Azure + /// notifications. + /// The Azure AD tenant ID of the billing + /// account for the subscription. + /// The ID of the billing account to + /// which the subscription is billed. + /// The name of the billing + /// account to which the subscription is billed. + /// The ID of the billing profile to + /// which the subscription is billed. + /// The name of the billing + /// profile to which the subscription is billed. + /// The status of the billing + /// profile. Possible values include: 'Active', 'Disabled', + /// 'Warned' + /// Reason for the + /// specified billing profile status. Possible values include: + /// 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// The billing profile + /// spending limit. Possible values include: 'Off', 'On' + /// The cost center applied to the + /// subscription. + /// The ID of the invoice section to + /// which the subscription is billed. + /// The name of the invoice + /// section to which the subscription is billed. + /// Indicates whether user is the account + /// admin. + /// The product ID of the Azure plan. + /// The product name of the Azure + /// plan. + /// The sku ID of the Azure plan for the + /// subscription. + /// The sku description of the Azure plan + /// for the subscription. + public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string accountAdminNotificationEmailAddress = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), bool? isAccountAdmin = default(bool?), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + : base(id, name, type) + { + AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; + BillingTenantId = billingTenantId; + BillingAccountId = billingAccountId; + BillingAccountDisplayName = billingAccountDisplayName; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + BillingProfileStatus = billingProfileStatus; + BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + BillingProfileSpendingLimit = billingProfileSpendingLimit; + CostCenter = costCenter; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + IsAccountAdmin = isAccountAdmin; + ProductId = productId; + ProductName = productName; + SkuId = skuId; + SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the email address on which the account admin gets all Azure + /// notifications. + /// + [JsonProperty(PropertyName = "properties.accountAdminNotificationEmailAddress")] + public string AccountAdminNotificationEmailAddress { get; private set; } + + /// + /// Gets the Azure AD tenant ID of the billing account for the + /// subscription. + /// + [JsonProperty(PropertyName = "properties.billingTenantId")] + public string BillingTenantId { get; private set; } + + /// + /// Gets the ID of the billing account to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId { get; private set; } + + /// + /// Gets the name of the billing account to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingAccountDisplayName")] + public string BillingAccountDisplayName { get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: + /// 'Active', 'Disabled', 'Warned' + /// + [JsonProperty(PropertyName = "properties.billingProfileStatus")] + public string BillingProfileStatus { get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible + /// values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + /// + [JsonProperty(PropertyName = "properties.billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode { get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: + /// 'Off', 'On' + /// + [JsonProperty(PropertyName = "properties.billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit { get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; set; } + + /// + /// Gets the ID of the invoice section to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets indicates whether user is the account admin. + /// + [JsonProperty(PropertyName = "properties.isAccountAdmin")] + public bool? IsAccountAdmin { get; private set; } + + /// + /// Gets the product ID of the Azure plan. + /// + [JsonProperty(PropertyName = "properties.productId")] + public string ProductId { get; private set; } + + /// + /// Gets the product name of the Azure plan. + /// + [JsonProperty(PropertyName = "properties.productName")] + public string ProductName { get; private set; } + + /// + /// Gets the sku ID of the Azure plan for the subscription. + /// + [JsonProperty(PropertyName = "properties.skuId")] + public string SkuId { get; private set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs new file mode 100644 index 000000000000..bf9622e9c451 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs @@ -0,0 +1,142 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The role assignment + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingRoleAssignment : Resource + { + /// + /// Initializes a new instance of the BillingRoleAssignment class. + /// + public BillingRoleAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleAssignment class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The date the role assignment was + /// created. + /// The tenant Id of the user + /// who created the role assignment. + /// The principal Id of the user who + /// created the role assignment. + /// The email address of the + /// user who created the role assignment. + /// The principal id of the user to whom the + /// role was assigned. + /// The principal tenant id of the user + /// to whom the role was assigned. + /// The ID of the role + /// definition. + /// The scope at which the role was + /// assigned. + /// The authentication + /// type. + /// The email address of the + /// user. + public BillingRoleAssignment(string id = default(string), string name = default(string), string type = default(string), string createdOn = default(string), string createdByPrincipalTenantId = default(string), string createdByPrincipalId = default(string), string createdByUserEmailAddress = default(string), string principalId = default(string), string principalTenantId = default(string), string roleDefinitionId = default(string), string scope = default(string), string userAuthenticationType = default(string), string userEmailAddress = default(string)) + : base(id, name, type) + { + CreatedOn = createdOn; + CreatedByPrincipalTenantId = createdByPrincipalTenantId; + CreatedByPrincipalId = createdByPrincipalId; + CreatedByUserEmailAddress = createdByUserEmailAddress; + PrincipalId = principalId; + PrincipalTenantId = principalTenantId; + RoleDefinitionId = roleDefinitionId; + Scope = scope; + UserAuthenticationType = userAuthenticationType; + UserEmailAddress = userEmailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the date the role assignment was created. + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public string CreatedOn { get; private set; } + + /// + /// Gets the tenant Id of the user who created the role assignment. + /// + [JsonProperty(PropertyName = "properties.createdByPrincipalTenantId")] + public string CreatedByPrincipalTenantId { get; private set; } + + /// + /// Gets the principal Id of the user who created the role assignment. + /// + [JsonProperty(PropertyName = "properties.createdByPrincipalId")] + public string CreatedByPrincipalId { get; private set; } + + /// + /// Gets the email address of the user who created the role assignment. + /// + [JsonProperty(PropertyName = "properties.createdByUserEmailAddress")] + public string CreatedByUserEmailAddress { get; private set; } + + /// + /// Gets or sets the principal id of the user to whom the role was + /// assigned. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets the principal tenant id of the user to whom the role + /// was assigned. + /// + [JsonProperty(PropertyName = "properties.principalTenantId")] + public string PrincipalTenantId { get; set; } + + /// + /// Gets or sets the ID of the role definition. + /// + [JsonProperty(PropertyName = "properties.roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets the scope at which the role was assigned. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; private set; } + + /// + /// Gets or sets the authentication type. + /// + [JsonProperty(PropertyName = "properties.userAuthenticationType")] + public string UserAuthenticationType { get; set; } + + /// + /// Gets or sets the email address of the user. + /// + [JsonProperty(PropertyName = "properties.userEmailAddress")] + public string UserEmailAddress { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs new file mode 100644 index 000000000000..53748e93e72a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties of a role definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingRoleDefinition : Resource + { + /// + /// Initializes a new instance of the BillingRoleDefinition class. + /// + public BillingRoleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleDefinition class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The role description + /// The billingPermissions the role + /// has + /// The name of the role + public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), IList permissions = default(IList), string roleName = default(string)) + : base(id, name, type) + { + Description = description; + Permissions = permissions; + RoleName = roleName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role description + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets or sets the billingPermissions the role has + /// + [JsonProperty(PropertyName = "properties.permissions")] + public IList Permissions { get; set; } + + /// + /// Gets the name of the role + /// + [JsonProperty(PropertyName = "properties.roleName")] + public string RoleName { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs new file mode 100644 index 000000000000..e6b5472658b7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs @@ -0,0 +1,194 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A billing subscription. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingSubscription : Resource + { + /// + /// Initializes a new instance of the BillingSubscription class. + /// + public BillingSubscription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscription class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the subscription. + /// The ID of the subscription. + /// The current billing status + /// of the subscription. Possible values include: 'Active', 'Inactive', + /// 'Abandoned', 'Deleted', 'Warning' + /// The last month charges. + /// The current month to date + /// charges. + /// The ID of the billing profile to + /// which the subscription is billed. + /// The name of the billing + /// profile to which the subscription is billed. + /// The cost center applied to the + /// subscription. + /// The ID of the customer for whom the + /// subscription was created. The field is applicable only for + /// Microsoft Partner Agreement billing account. + /// The name of the customer for whom + /// the subscription was created. The field is applicable only for + /// Microsoft Partner Agreement billing account. + /// The ID of the invoice section to + /// which the subscription is billed. + /// The name of the invoice + /// section to which the subscription is billed. + /// Reseller for this subscription. + /// The sku ID of the Azure plan for the + /// subscription. + /// The sku description of the Azure plan + /// for the subscription. + public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) + : base(id, name, type) + { + DisplayName = displayName; + SubscriptionId = subscriptionId; + SubscriptionBillingStatus = subscriptionBillingStatus; + LastMonthCharges = lastMonthCharges; + MonthToDateCharges = monthToDateCharges; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + CostCenter = costCenter; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + Reseller = reseller; + SkuId = skuId; + SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the subscription. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the ID of the subscription. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public System.Guid? SubscriptionId { get; private set; } + + /// + /// Gets or sets the current billing status of the subscription. + /// Possible values include: 'Active', 'Inactive', 'Abandoned', + /// 'Deleted', 'Warning' + /// + [JsonProperty(PropertyName = "properties.subscriptionBillingStatus")] + public string SubscriptionBillingStatus { get; set; } + + /// + /// Gets the last month charges. + /// + [JsonProperty(PropertyName = "properties.lastMonthCharges")] + public Amount LastMonthCharges { get; private set; } + + /// + /// Gets the current month to date charges. + /// + [JsonProperty(PropertyName = "properties.monthToDateCharges")] + public Amount MonthToDateCharges { get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; set; } + + /// + /// Gets the ID of the customer for whom the subscription was created. + /// The field is applicable only for Microsoft Partner Agreement + /// billing account. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets the name of the customer for whom the subscription was + /// created. The field is applicable only for Microsoft Partner + /// Agreement billing account. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } + + /// + /// Gets the ID of the invoice section to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is + /// billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets reseller for this subscription. + /// + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } + + /// + /// Gets or sets the sku ID of the Azure plan for the subscription. + /// + [JsonProperty(PropertyName = "properties.skuId")] + public string SkuId { get; set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs new file mode 100644 index 000000000000..d84197a2d14d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs @@ -0,0 +1,25 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingSubscriptionStatusType. + /// + public static class BillingSubscriptionStatusType + { + public const string Active = "Active"; + public const string Inactive = "Inactive"; + public const string Abandoned = "Abandoned"; + public const string Deleted = "Deleted"; + public const string Warning = "Warning"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs new file mode 100644 index 000000000000..39f89953b85d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs @@ -0,0 +1,65 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Move operation. + /// + public partial class BillingSubscriptionsMoveHeaders + { + /// + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders + /// class. + /// + public BillingSubscriptionsMoveHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders + /// class. + /// + /// Location URI to poll for result. + /// Recommended time to wait before making + /// another request to check the status of the operation. The time is + /// specified in seconds. + public BillingSubscriptionsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommended time to wait before making another request + /// to check the status of the operation. The time is specified in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs new file mode 100644 index 000000000000..210b36aeaec9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for Category. + /// + public static class Category + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string AffiliatePurchaseTerms = "AffiliatePurchaseTerms"; + public const string Other = "Other"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs new file mode 100644 index 000000000000..bf625a111fd0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs @@ -0,0 +1,97 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A partner's customer. + /// + [Rest.Serialization.JsonTransformation] + public partial class Customer : Resource + { + /// + /// Initializes a new instance of the Customer class. + /// + public Customer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Customer class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The ID of the billing profile for + /// the invoice section. + /// The name of the billing + /// profile for the invoice section. + /// The name of the customer. + /// Azure plans enabled for the + /// customer. + /// The list of resellers for which an Azure + /// plan is enabled for the customer. + public Customer(string id = default(string), string name = default(string), string type = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), IList enabledAzurePlans = default(IList), IList resellers = default(IList)) + : base(id, name, type) + { + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + DisplayName = displayName; + EnabledAzurePlans = enabledAzurePlans; + Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets or sets the name of the customer. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets azure plans enabled for the customer. + /// + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + /// + /// Gets or sets the list of resellers for which an Azure plan is + /// enabled for the customer. + /// + [JsonProperty(PropertyName = "properties.resellers")] + public IList Resellers { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs new file mode 100644 index 000000000000..312bd9f3d5c8 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The customer's Policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class CustomerPolicy : Resource + { + /// + /// Initializes a new instance of the CustomerPolicy class. + /// + public CustomerPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerPolicy class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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' + public CustomerPolicy(string id = default(string), string name = default(string), string type = default(string), string viewCharges = default(string)) + : base(id, name, type) + { + ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets 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(PropertyName = "properties.viewCharges")] + public string ViewCharges { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs new file mode 100644 index 000000000000..6b63c084490c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A department. + /// + [Rest.Serialization.JsonTransformation] + public partial class Department : Resource + { + /// + /// Initializes a new instance of the Department class. + /// + public Department() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Department class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the department. + /// The cost center associated with the + /// department. + /// The status of the department. + /// Associated enrollment accounts. By + /// default this is not populated, unless it's specified in + /// $expand. + public Department(string id = default(string), string name = default(string), string type = default(string), string departmentName = default(string), string costCenter = default(string), string status = default(string), IList enrollmentAccounts = default(IList)) + : base(id, name, type) + { + DepartmentName = departmentName; + CostCenter = costCenter; + Status = status; + EnrollmentAccounts = enrollmentAccounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the department. + /// + [JsonProperty(PropertyName = "properties.departmentName")] + public string DepartmentName { get; set; } + + /// + /// Gets or sets the cost center associated with the department. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; set; } + + /// + /// Gets or sets the status of the department. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets associated enrollment accounts. By default this is not + /// populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public IList EnrollmentAccounts { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs new file mode 100644 index 000000000000..974ab59c7b27 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a document. + /// + public partial class Document + { + /// + /// Initializes a new instance of the Document class. + /// + public Document() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Document class. + /// + /// The type of the document. Possible values + /// include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' + /// Document URL. + /// The source of the document. ENF for Brazil and + /// DRS for rest of the world. Possible values include: 'DRS', + /// 'ENF' + public Document(string kind = default(string), string url = default(string), string source = default(string)) + { + Kind = kind; + Url = url; + Source = source; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of the document. Possible values include: 'Invoice', + /// 'VoidNote', 'TaxReceipt', 'CreditNote' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets document URL. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; private set; } + + /// + /// Gets the source of the document. ENF for Brazil and DRS for rest of + /// the world. Possible values include: 'DRS', 'ENF' + /// + [JsonProperty(PropertyName = "source")] + public string Source { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs new file mode 100644 index 000000000000..95c505550f6e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for DocumentSource. + /// + public static class DocumentSource + { + public const string DRS = "DRS"; + public const string ENF = "ENF"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs new file mode 100644 index 000000000000..1ea4d2a5e778 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs @@ -0,0 +1,24 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for DocumentType. + /// + public static class DocumentType + { + public const string Invoice = "Invoice"; + public const string VoidNote = "VoidNote"; + public const string TaxReceipt = "TaxReceipt"; + public const string CreditNote = "CreditNote"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs new file mode 100644 index 000000000000..9fe7195f5843 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A secure URL that can be used to download a an entity until the URL + /// expires. + /// + public partial class DownloadUrl + { + /// + /// Initializes a new instance of the DownloadUrl class. + /// + public DownloadUrl() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DownloadUrl class. + /// + /// The time in UTC when the download URL will + /// expire. + /// The URL to the PDF file. + public DownloadUrl(System.DateTime? expiryTime = default(System.DateTime?), string url = default(string)) + { + ExpiryTime = expiryTime; + Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time in UTC when the download URL will expire. + /// + [JsonProperty(PropertyName = "expiryTime")] + public System.DateTime? ExpiryTime { get; private set; } + + /// + /// Gets the URL to the PDF file. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs new file mode 100644 index 000000000000..2a45edbd0101 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs @@ -0,0 +1,119 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of an enrollment. + /// + public partial class Enrollment + { + /// + /// Initializes a new instance of the Enrollment class. + /// + public Enrollment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Enrollment class. + /// + /// The start date of the enrollment. + /// The end date of the enrollment. + /// The billing currency for the + /// enrollment. + /// The channel type of the enrollment. + /// The policies for Enterprise Agreement + /// enrollments. + /// The language for the enrollment. + /// The country code of the + /// enrollment. + /// The current status of the enrollment. + /// The billing cycle for the + /// enrollment. + public Enrollment(System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string currency = default(string), string channel = default(string), EnrollmentPolicies policies = default(EnrollmentPolicies), string language = default(string), string countryCode = default(string), string status = default(string), string billingCycle = default(string)) + { + StartDate = startDate; + EndDate = endDate; + Currency = currency; + Channel = channel; + Policies = policies; + Language = language; + CountryCode = countryCode; + Status = status; + BillingCycle = billingCycle; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start date of the enrollment. + /// + [JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the end date of the enrollment. + /// + [JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Gets the billing currency for the enrollment. + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; private set; } + + /// + /// Gets the channel type of the enrollment. + /// + [JsonProperty(PropertyName = "channel")] + public string Channel { get; private set; } + + /// + /// Gets the policies for Enterprise Agreement enrollments. + /// + [JsonProperty(PropertyName = "policies")] + public EnrollmentPolicies Policies { get; private set; } + + /// + /// Gets the language for the enrollment. + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; private set; } + + /// + /// Gets the country code of the enrollment. + /// + [JsonProperty(PropertyName = "countryCode")] + public string CountryCode { get; private set; } + + /// + /// Gets the current status of the enrollment. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the billing cycle for the enrollment. + /// + [JsonProperty(PropertyName = "billingCycle")] + public string BillingCycle { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs new file mode 100644 index 000000000000..140c2fb209c5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs @@ -0,0 +1,114 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An enrollment account. + /// + [Rest.Serialization.JsonTransformation] + public partial class EnrollmentAccount : Resource + { + /// + /// Initializes a new instance of the EnrollmentAccount class. + /// + public EnrollmentAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccount class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the enrollment + /// account. + /// The cost center associated with the + /// enrollment account. + /// The owner of the enrollment + /// account. + /// The status of the enrollment account. + /// The start date of the enrollment + /// account. + /// The end date of the enrollment + /// account. + /// Associated department. By default this is + /// not populated, unless it's specified in $expand. + public EnrollmentAccount(string id = default(string), string name = default(string), string type = default(string), string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), Department department = default(Department)) + : base(id, name, type) + { + AccountName = accountName; + CostCenter = costCenter; + AccountOwner = accountOwner; + Status = status; + StartDate = startDate; + EndDate = endDate; + Department = department; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the enrollment account. + /// + [JsonProperty(PropertyName = "properties.accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets the cost center associated with the enrollment + /// account. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; set; } + + /// + /// Gets or sets the owner of the enrollment account. + /// + [JsonProperty(PropertyName = "properties.accountOwner")] + public string AccountOwner { get; set; } + + /// + /// Gets or sets the status of the enrollment account. + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Gets or sets associated department. By default this is not + /// populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.department")] + public Department Department { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs new file mode 100644 index 000000000000..650e0b3eb3b0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The enrollment account context + /// + public partial class EnrollmentAccountContext + { + /// + /// Initializes a new instance of the EnrollmentAccountContext class. + /// + public EnrollmentAccountContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountContext class. + /// + /// The cost center associated with the + /// enrollment account. + /// The start date of the enrollment + /// account. + /// The end date of the enrollment + /// account. + /// The ID of the enrollment + /// account. + public EnrollmentAccountContext(string costCenter = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string enrollmentAccountName = default(string)) + { + CostCenter = costCenter; + StartDate = startDate; + EndDate = endDate; + EnrollmentAccountName = enrollmentAccountName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cost center associated with the enrollment + /// account. + /// + [JsonProperty(PropertyName = "costCenter")] + public string CostCenter { get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Gets or sets the ID of the enrollment account. + /// + [JsonProperty(PropertyName = "enrollmentAccountName")] + public string EnrollmentAccountName { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs new file mode 100644 index 000000000000..a01dd23728c3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The policies for Enterprise Agreement enrollments. + /// + public partial class EnrollmentPolicies + { + /// + /// Initializes a new instance of the EnrollmentPolicies class. + /// + public EnrollmentPolicies() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentPolicies class. + /// + /// The policy that controls + /// whether Account Owners can view charges. + /// The policy that controls + /// whether Department Administrators can view charges. + /// The policy that controls whether + /// Azure marketplace purchases are allowed in the enrollment. + /// The policy that controls + /// whether Azure reservation purchases are allowed in the + /// enrollment. + public EnrollmentPolicies(bool? accountOwnerViewCharges = default(bool?), bool? departmentAdminViewCharges = default(bool?), bool? marketplacesEnabled = default(bool?), bool? reservedInstancesEnabled = default(bool?)) + { + AccountOwnerViewCharges = accountOwnerViewCharges; + DepartmentAdminViewCharges = departmentAdminViewCharges; + MarketplacesEnabled = marketplacesEnabled; + ReservedInstancesEnabled = reservedInstancesEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the policy that controls whether Account Owners can view + /// charges. + /// + [JsonProperty(PropertyName = "accountOwnerViewCharges")] + public bool? AccountOwnerViewCharges { get; private set; } + + /// + /// Gets the policy that controls whether Department Administrators can + /// view charges. + /// + [JsonProperty(PropertyName = "departmentAdminViewCharges")] + public bool? DepartmentAdminViewCharges { get; private set; } + + /// + /// Gets the policy that controls whether Azure marketplace purchases + /// are allowed in the enrollment. + /// + [JsonProperty(PropertyName = "marketplacesEnabled")] + public bool? MarketplacesEnabled { get; private set; } + + /// + /// Gets the policy that controls whether Azure reservation purchases + /// are allowed in the enrollment. + /// + [JsonProperty(PropertyName = "reservedInstancesEnabled")] + public bool? ReservedInstancesEnabled { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..2abc90d1ef82 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs @@ -0,0 +1,68 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorDetails + { + /// + /// Initializes a new instance of the ErrorDetails class. + /// + public ErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetails class. + /// + /// Error code. + /// Error message indicating why the operation + /// failed. + /// The target of the particular error. + public ErrorDetails(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets error message indicating why the operation failed. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the target of the particular error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..6c39de5c6789 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -0,0 +1,52 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The details of the error. + public ErrorResponse(ErrorDetails error = default(ErrorDetails)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details of the error. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetails Error { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..9d05048b6e32 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs new file mode 100644 index 000000000000..5fd2787f50e4 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs @@ -0,0 +1,97 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An instruction. + /// + [Rest.Serialization.JsonTransformation] + public partial class Instruction : Resource + { + /// + /// Initializes a new instance of the Instruction class. + /// + public Instruction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Instruction class. + /// + /// The amount budgeted for this billing + /// instruction. + /// The date this billing instruction goes into + /// effect. + /// The date this billing instruction is no + /// longer in effect. + /// Resource Id. + /// Resource name. + /// Resource type. + /// The date this billing instruction was + /// created. + public Instruction(double amount, System.DateTime startDate, System.DateTime endDate, string id = default(string), string name = default(string), string type = default(string), System.DateTime? creationDate = default(System.DateTime?)) + : base(id, name, type) + { + Amount = amount; + StartDate = startDate; + EndDate = endDate; + CreationDate = creationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the amount budgeted for this billing instruction. + /// + [JsonProperty(PropertyName = "properties.amount")] + public double Amount { get; set; } + + /// + /// Gets or sets the date this billing instruction goes into effect. + /// + [JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime StartDate { get; set; } + + /// + /// Gets or sets the date this billing instruction is no longer in + /// effect. + /// + [JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime EndDate { get; set; } + + /// + /// Gets or sets the date this billing instruction was created. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs new file mode 100644 index 000000000000..6d360f88ac10 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs @@ -0,0 +1,267 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An invoice. + /// + [Rest.Serialization.JsonTransformation] + public partial class Invoice : Resource + { + /// + /// Initializes a new instance of the Invoice class. + /// + public Invoice() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Invoice class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The due date for the invoice. + /// The date when the invoice was + /// generated. + /// The current status of the invoice. Possible + /// values include: 'Due', 'OverDue', 'Paid' + /// The amount due as of now. + /// The amount of Azure prepayment + /// applied to the charges. This field is applicable to billing + /// accounts with agreement type Microsoft Customer Agreement. + /// The total charges for the invoice + /// billing period. + /// 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. + /// The amount of free Azure + /// credits applied to the charges. This field is applicable to billing + /// accounts with agreement type Microsoft Customer Agreement. + /// The pre-tax amount due. This field is + /// applicable to billing accounts with agreement type Microsoft + /// Customer Agreement. + /// The amount of tax charged for the billing + /// period. This field is applicable to billing accounts with agreement + /// type Microsoft Customer Agreement. + /// The amount due when the invoice was + /// generated. This field is applicable to billing accounts with + /// agreement type Microsoft Customer Agreement. + /// The start date of the billing + /// period for which the invoice is generated. + /// The end date of the billing + /// period for which the invoice is generated. + /// Invoice type. Possible values include: + /// 'AzureService', 'AzureMarketplace', 'AzureSupport' + /// 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. + /// The ID of the billing profile for + /// which the invoice is generated. + /// The name of the billing + /// profile for which the invoice is generated. + /// An optional purchase order number + /// for the invoice. + /// List of documents available to download + /// such as invoice and tax receipt. + /// List of payments. + /// The ID of the subscription for which + /// the invoice is generated. + public Invoice(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string invoiceType = default(string), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), IList documents = default(IList), IList payments = default(IList), string subscriptionId = default(string)) + : base(id, name, type) + { + DueDate = dueDate; + InvoiceDate = invoiceDate; + Status = status; + AmountDue = amountDue; + AzurePrepaymentApplied = azurePrepaymentApplied; + BilledAmount = billedAmount; + CreditAmount = creditAmount; + FreeAzureCreditApplied = freeAzureCreditApplied; + SubTotal = subTotal; + TaxAmount = taxAmount; + TotalAmount = totalAmount; + InvoicePeriodStartDate = invoicePeriodStartDate; + InvoicePeriodEndDate = invoicePeriodEndDate; + InvoiceType = invoiceType; + IsMonthlyInvoice = isMonthlyInvoice; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + PurchaseOrderNumber = purchaseOrderNumber; + Documents = documents; + Payments = payments; + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the due date for the invoice. + /// + [JsonProperty(PropertyName = "properties.dueDate")] + public System.DateTime? DueDate { get; private set; } + + /// + /// Gets the date when the invoice was generated. + /// + [JsonProperty(PropertyName = "properties.invoiceDate")] + public System.DateTime? InvoiceDate { get; private set; } + + /// + /// Gets the current status of the invoice. Possible values include: + /// 'Due', 'OverDue', 'Paid' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the amount due as of now. + /// + [JsonProperty(PropertyName = "properties.amountDue")] + public Amount AmountDue { get; private set; } + + /// + /// Gets the amount of Azure prepayment applied to the charges. This + /// field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + [JsonProperty(PropertyName = "properties.azurePrepaymentApplied")] + public Amount AzurePrepaymentApplied { get; private set; } + + /// + /// Gets the total charges for the invoice billing period. + /// + [JsonProperty(PropertyName = "properties.billedAmount")] + public Amount BilledAmount { get; private set; } + + /// + /// Gets 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(PropertyName = "properties.creditAmount")] + public Amount CreditAmount { get; private set; } + + /// + /// Gets the amount of free Azure credits applied to the charges. This + /// field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + [JsonProperty(PropertyName = "properties.freeAzureCreditApplied")] + public Amount FreeAzureCreditApplied { get; private set; } + + /// + /// Gets the pre-tax amount due. This field is applicable to billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + [JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal { get; private set; } + + /// + /// Gets the amount of tax charged for the billing period. This field + /// is applicable to billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + [JsonProperty(PropertyName = "properties.taxAmount")] + public Amount TaxAmount { get; private set; } + + /// + /// Gets the amount due when the invoice was generated. This field is + /// applicable to billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + [JsonProperty(PropertyName = "properties.totalAmount")] + public Amount TotalAmount { get; private set; } + + /// + /// Gets the start date of the billing period for which the invoice is + /// generated. + /// + [JsonProperty(PropertyName = "properties.invoicePeriodStartDate")] + public System.DateTime? InvoicePeriodStartDate { get; private set; } + + /// + /// Gets the end date of the billing period for which the invoice is + /// generated. + /// + [JsonProperty(PropertyName = "properties.invoicePeriodEndDate")] + public System.DateTime? InvoicePeriodEndDate { get; private set; } + + /// + /// Gets invoice type. Possible values include: 'AzureService', + /// 'AzureMarketplace', 'AzureSupport' + /// + [JsonProperty(PropertyName = "properties.invoiceType")] + public string InvoiceType { get; private set; } + + /// + /// Gets 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(PropertyName = "properties.isMonthlyInvoice")] + public bool? IsMonthlyInvoice { get; private set; } + + /// + /// Gets the ID of the billing profile for which the invoice is + /// generated. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile for which the invoice is + /// generated. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets an optional purchase order number for the invoice. + /// + [JsonProperty(PropertyName = "properties.purchaseOrderNumber")] + public string PurchaseOrderNumber { get; private set; } + + /// + /// Gets list of documents available to download such as invoice and + /// tax receipt. + /// + [JsonProperty(PropertyName = "properties.documents")] + public IList Documents { get; private set; } + + /// + /// Gets list of payments. + /// + [JsonProperty(PropertyName = "properties.payments")] + public IList Payments { get; private set; } + + /// + /// Gets the ID of the subscription for which the invoice is generated. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs new file mode 100644 index 000000000000..1a7aaac35a84 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An invoice section. + /// + [Rest.Serialization.JsonTransformation] + public partial class InvoiceSection : Resource + { + /// + /// Initializes a new instance of the InvoiceSection class. + /// + public InvoiceSection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSection class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the invoice section. + /// Dictionary of metadata associated with the + /// invoice section. + /// The system generated unique identifier for + /// an invoice section. + public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IDictionary labels = default(IDictionary), string systemId = default(string)) + : base(id, name, type) + { + DisplayName = displayName; + Labels = labels; + SystemId = systemId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the invoice section. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets dictionary of metadata associated with the invoice + /// section. + /// + [JsonProperty(PropertyName = "properties.labels")] + public IDictionary Labels { get; set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [JsonProperty(PropertyName = "properties.systemId")] + public string SystemId { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs new file mode 100644 index 000000000000..aabc5101d2f2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the invoice section. + /// + public partial class InvoiceSectionCreationRequest + { + /// + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. + /// + public InvoiceSectionCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. + /// + /// The name of the invoice section. + public InvoiceSectionCreationRequest(string displayName = default(string)) + { + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the invoice section. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs new file mode 100644 index 000000000000..3d02822f8b68 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Invoice section properties with create subscription permission. + /// + public partial class InvoiceSectionWithCreateSubPermission + { + /// + /// Initializes a new instance of the + /// InvoiceSectionWithCreateSubPermission class. + /// + public InvoiceSectionWithCreateSubPermission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InvoiceSectionWithCreateSubPermission class. + /// + /// The ID of the invoice + /// section. + /// The name of the invoice + /// section. + /// The system generated unique + /// identifier for an invoice section. + /// The ID of the billing profile for + /// the invoice section. + /// The name of the billing + /// profile for the invoice section. + /// The status of the billing + /// profile. Possible values include: 'Active', 'Disabled', + /// 'Warned' + /// Reason for the + /// specified billing profile status. Possible values include: + /// 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// The billing profile + /// spending limit. Possible values include: 'Off', 'On' + /// The system generated unique + /// identifier for a billing profile. + /// Enabled azure plans for the + /// associated billing profile. + public InvoiceSectionWithCreateSubPermission(string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string invoiceSectionSystemId = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string billingProfileSystemId = default(string), IList enabledAzurePlans = default(IList)) + { + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + InvoiceSectionSystemId = invoiceSectionSystemId; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + BillingProfileStatus = billingProfileStatus; + BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + BillingProfileSpendingLimit = billingProfileSpendingLimit; + BillingProfileSystemId = billingProfileSystemId; + EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ID of the invoice section. + /// + [JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets the name of the invoice section. + /// + [JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [JsonProperty(PropertyName = "invoiceSectionSystemId")] + public string InvoiceSectionSystemId { get; private set; } + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: + /// 'Active', 'Disabled', 'Warned' + /// + [JsonProperty(PropertyName = "billingProfileStatus")] + public string BillingProfileStatus { get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible + /// values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + /// + [JsonProperty(PropertyName = "billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode { get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: + /// 'Off', 'On' + /// + [JsonProperty(PropertyName = "billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit { get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [JsonProperty(PropertyName = "billingProfileSystemId")] + public string BillingProfileSystemId { get; private set; } + + /// + /// Gets or sets enabled azure plans for the associated billing + /// profile. + /// + [JsonProperty(PropertyName = "enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..28621c7ef62f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs @@ -0,0 +1,65 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class InvoiceSectionsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// InvoiceSectionsCreateOrUpdateHeaders class. + /// + public InvoiceSectionsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InvoiceSectionsCreateOrUpdateHeaders class. + /// + /// Location URI to poll for result + /// Recommended time to wait before making + /// another request to check the status of the operation. The time is + /// specified in seconds. + public InvoiceSectionsCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommended time to wait before making another request + /// to check the status of the operation. The time is specified in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs new file mode 100644 index 000000000000..a30a4a9003e0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The invoice sections associated to the billing profile. By default this + /// is not populated, unless it's specified in $expand. + /// + public partial class InvoiceSectionsOnExpand + { + /// + /// Initializes a new instance of the InvoiceSectionsOnExpand class. + /// + public InvoiceSectionsOnExpand() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionsOnExpand class. + /// + /// 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. + /// The invoice sections associated to the billing + /// profile. + public InvoiceSectionsOnExpand(bool? hasMoreResults = default(bool?), IList value = default(IList)) + { + HasMoreResults = hasMoreResults; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets 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(PropertyName = "hasMoreResults")] + public bool? HasMoreResults { get; private set; } + + /// + /// Gets or sets the invoice sections associated to the billing + /// profile. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs new file mode 100644 index 000000000000..4a4bcaa725a2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for InvoiceStatus. + /// + public static class InvoiceStatus + { + public const string Due = "Due"; + public const string OverDue = "OverDue"; + public const string Paid = "Paid"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs new file mode 100644 index 000000000000..e6fa4d753a6c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for InvoiceType. + /// + public static class InvoiceType + { + public const string AzureService = "AzureService"; + public const string AzureMarketplace = "AzureMarketplace"; + public const string AzureSupport = "AzureSupport"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs new file mode 100644 index 000000000000..ae2853e38f54 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs @@ -0,0 +1,66 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for DownloadBillingSubscriptionInvoice operation. + /// + public partial class InvoicesDownloadBillingSubscriptionInvoiceHeaders + { + /// + /// Initializes a new instance of the + /// InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// + public InvoicesDownloadBillingSubscriptionInvoiceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public InvoicesDownloadBillingSubscriptionInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs new file mode 100644 index 000000000000..3f8c4a1ebf38 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs @@ -0,0 +1,66 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for DownloadInvoice operation. + /// + public partial class InvoicesDownloadInvoiceHeaders + { + /// + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders + /// class. + /// + public InvoicesDownloadInvoiceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders + /// class. + /// + /// GET this URL to retrieve the status of the + /// asynchronous operation. + /// The amount of delay to use while the + /// status of the operation is checked. The value is expressed in + /// seconds. + public InvoicesDownloadInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets GET this URL to retrieve the status of the + /// asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the amount of delay to use while the status of the + /// operation is checked. The value is expressed in seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs new file mode 100644 index 000000000000..528fefe6c4e5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for MarketplacePurchasesPolicy. + /// + public static class MarketplacePurchasesPolicy + { + public const string AllAllowed = "AllAllowed"; + public const string OnlyFreeAllowed = "OnlyFreeAllowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs new file mode 100644 index 000000000000..20cb7d5af963 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A Billing REST API operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation}. + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation name: {provider}/{resource}/{operation}. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..1fb0a8ab0c51 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: Microsoft.Billing. + /// Resource on which the operation is performed + /// such as invoice and billing subscription. + /// Operation type such as read, write and + /// delete. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service provider: Microsoft.Billing. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource on which the operation is performed such as invoice + /// and billing subscription. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets operation type such as read, write and delete. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..5f9ef03c16c2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs new file mode 100644 index 000000000000..760f89ceb15e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details about a participant. + /// + public partial class Participants + { + /// + /// Initializes a new instance of the Participants class. + /// + public Participants() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Participants class. + /// + /// The acceptance status of the + /// participant. + /// The date when the status got + /// changed. + /// The email address of the participant. + public Participants(string status = default(string), System.DateTime? statusDate = default(System.DateTime?), string email = default(string)) + { + Status = status; + StatusDate = statusDate; + Email = email; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the acceptance status of the participant. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the date when the status got changed. + /// + [JsonProperty(PropertyName = "statusDate")] + public System.DateTime? StatusDate { get; private set; } + + /// + /// Gets the email address of the participant. + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs new file mode 100644 index 000000000000..d7e8a23afa8e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs @@ -0,0 +1,24 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for PaymentMethodFamily. + /// + public static class PaymentMethodFamily + { + public const string Credits = "Credits"; + public const string CheckWire = "CheckWire"; + public const string CreditCard = "CreditCard"; + public const string None = "None"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs new file mode 100644 index 000000000000..ce8212f8a6af --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs @@ -0,0 +1,86 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a payment. + /// + public partial class PaymentProperties + { + /// + /// Initializes a new instance of the PaymentProperties class. + /// + public PaymentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PaymentProperties class. + /// + /// The type of payment. + /// The paid amount. + /// The date when the payment was made. + /// The family of payment method. + /// Possible values include: 'Credits', 'CheckWire', 'CreditCard', + /// 'None' + /// The type of payment method. + public PaymentProperties(string paymentType = default(string), Amount amount = default(Amount), System.DateTime? date = default(System.DateTime?), string paymentMethodFamily = default(string), string paymentMethodType = default(string)) + { + PaymentType = paymentType; + Amount = amount; + Date = date; + PaymentMethodFamily = paymentMethodFamily; + PaymentMethodType = paymentMethodType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of payment. + /// + [JsonProperty(PropertyName = "paymentType")] + public string PaymentType { get; private set; } + + /// + /// Gets the paid amount. + /// + [JsonProperty(PropertyName = "amount")] + public Amount Amount { get; private set; } + + /// + /// Gets the date when the payment was made. + /// + [JsonProperty(PropertyName = "date")] + public System.DateTime? Date { get; private set; } + + /// + /// Gets or sets the family of payment method. Possible values include: + /// 'Credits', 'CheckWire', 'CreditCard', 'None' + /// + [JsonProperty(PropertyName = "paymentMethodFamily")] + public string PaymentMethodFamily { get; set; } + + /// + /// Gets the type of payment method. + /// + [JsonProperty(PropertyName = "paymentMethodType")] + public string PaymentMethodType { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs new file mode 100644 index 000000000000..09eb26d7da03 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A policy. + /// + [Rest.Serialization.JsonTransformation] + public partial class Policy : Resource + { + /// + /// Initializes a new instance of the Policy class. + /// + public Policy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Policy class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The policy that controls whether + /// Azure marketplace purchases are allowed for a billing profile. + /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', + /// 'NotAllowed' + /// The policy that controls whether + /// Azure reservation purchases are allowed for a billing profile. + /// Possible values include: 'Allowed', 'NotAllowed' + /// The policy that controls whether users + /// with Azure RBAC access to a subscription can view its charges. + /// Possible values include: 'Allowed', 'NotAllowed' + public Policy(string id = default(string), string name = default(string), string type = default(string), string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) + : base(id, name, type) + { + MarketplacePurchases = marketplacePurchases; + ReservationPurchases = reservationPurchases; + ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the policy that controls whether Azure marketplace + /// purchases are allowed for a billing profile. Possible values + /// include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + /// + [JsonProperty(PropertyName = "properties.marketplacePurchases")] + public string MarketplacePurchases { get; set; } + + /// + /// Gets or sets the policy that controls whether Azure reservation + /// purchases are allowed for a billing profile. Possible values + /// include: 'Allowed', 'NotAllowed' + /// + [JsonProperty(PropertyName = "properties.reservationPurchases")] + public string ReservationPurchases { get; set; } + + /// + /// Gets or sets the policy that controls whether users with Azure RBAC + /// access to a subscription can view its charges. Possible values + /// include: 'Allowed', 'NotAllowed' + /// + [JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs new file mode 100644 index 000000000000..b32228ce453d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs @@ -0,0 +1,256 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A product. + /// + [Rest.Serialization.JsonTransformation] + public partial class Product : Resource + { + /// + /// Initializes a new instance of the Product class. + /// + public Product() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Product class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Indicates whether auto renewal is turned on + /// or off for a product. Possible values include: 'Off', 'On' + /// The display name of the product. + /// The date when the product was + /// purchased. + /// The ID of the type of product. + /// The description of the type of + /// product. + /// The current status of the product. Possible + /// values include: 'Active', 'Inactive', 'PastDue', 'Expiring', + /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + /// The date when the product will be renewed or + /// canceled. + /// The frequency at which the product + /// will be billed. Possible values include: 'OneTime', 'Monthly', + /// 'UsageBased' + /// The last month charges. + /// The date of the last charge. + /// The quantity purchased for the + /// product. + /// The sku ID of the product. + /// The sku description of the + /// product. + /// The id of the tenant in which the product is + /// used. + /// The availability of the + /// product. + /// The ID of the invoice section to + /// which the product is billed. + /// The name of the invoice + /// section to which the product is billed. + /// The ID of the billing profile to + /// which the product is billed. + /// The name of the billing + /// profile to which the product is billed. + /// The ID of the customer for whom the + /// product was purchased. The field is applicable only for Microsoft + /// Partner Agreement billing account. + /// The name of the customer for whom + /// the product was purchased. The field is applicable only for + /// Microsoft Partner Agreement billing account. + /// Reseller for this product. + public Product(string id = default(string), string name = default(string), string type = default(string), string autoRenew = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), Reseller reseller = default(Reseller)) + : base(id, name, type) + { + AutoRenew = autoRenew; + DisplayName = displayName; + PurchaseDate = purchaseDate; + ProductTypeId = productTypeId; + ProductType = productType; + Status = status; + EndDate = endDate; + BillingFrequency = billingFrequency; + LastCharge = lastCharge; + LastChargeDate = lastChargeDate; + Quantity = quantity; + SkuId = skuId; + SkuDescription = skuDescription; + TenantId = tenantId; + AvailabilityId = availabilityId; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; + Reseller = reseller; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether auto renewal is turned on or off for + /// a product. Possible values include: 'Off', 'On' + /// + [JsonProperty(PropertyName = "properties.autoRenew")] + public string AutoRenew { get; set; } + + /// + /// Gets the display name of the product. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the date when the product was purchased. + /// + [JsonProperty(PropertyName = "properties.purchaseDate")] + public System.DateTime? PurchaseDate { get; private set; } + + /// + /// Gets the ID of the type of product. + /// + [JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId { get; private set; } + + /// + /// Gets the description of the type of product. + /// + [JsonProperty(PropertyName = "properties.productType")] + public string ProductType { get; private set; } + + /// + /// Gets or sets the current status of the product. Possible values + /// include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', + /// 'Disabled', 'Cancelled', 'AutoRenew' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets the date when the product will be renewed or canceled. + /// + [JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate { get; private set; } + + /// + /// Gets or sets the frequency at which the product will be billed. + /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' + /// + [JsonProperty(PropertyName = "properties.billingFrequency")] + public string BillingFrequency { get; set; } + + /// + /// Gets the last month charges. + /// + [JsonProperty(PropertyName = "properties.lastCharge")] + public Amount LastCharge { get; private set; } + + /// + /// Gets the date of the last charge. + /// + [JsonProperty(PropertyName = "properties.lastChargeDate")] + public System.DateTime? LastChargeDate { get; private set; } + + /// + /// Gets the quantity purchased for the product. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public double? Quantity { get; private set; } + + /// + /// Gets the sku ID of the product. + /// + [JsonProperty(PropertyName = "properties.skuId")] + public string SkuId { get; private set; } + + /// + /// Gets the sku description of the product. + /// + [JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription { get; private set; } + + /// + /// Gets the id of the tenant in which the product is used. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets the availability of the product. + /// + [JsonProperty(PropertyName = "properties.availabilityId")] + public string AvailabilityId { get; private set; } + + /// + /// Gets the ID of the invoice section to which the product is billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets the name of the invoice section to which the product is + /// billed. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets the ID of the billing profile to which the product is billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile to which the product is + /// billed. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets the ID of the customer for whom the product was purchased. The + /// field is applicable only for Microsoft Partner Agreement billing + /// account. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets the name of the customer for whom the product was purchased. + /// The field is applicable only for Microsoft Partner Agreement + /// billing account. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } + + /// + /// Gets reseller for this product. + /// + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs new file mode 100644 index 000000000000..7e2f470d6198 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ProductStatusType. + /// + public static class ProductStatusType + { + public const string Active = "Active"; + public const string Inactive = "Inactive"; + public const string PastDue = "PastDue"; + public const string Expiring = "Expiring"; + public const string Expired = "Expired"; + public const string Disabled = "Disabled"; + public const string Cancelled = "Cancelled"; + public const string AutoRenew = "AutoRenew"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs new file mode 100644 index 000000000000..b2aa3eff7e27 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ProductTransferValidationErrorCode. + /// + public static class ProductTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string ProductNotActive = "ProductNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string ProductTypeNotSupported = "ProductTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + public const string OneTimePurchaseProductTransferNotAllowed = "OneTimePurchaseProductTransferNotAllowed"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs new file mode 100644 index 000000000000..ace8ee2e077c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Move operation. + /// + public partial class ProductsMoveHeaders + { + /// + /// Initializes a new instance of the ProductsMoveHeaders class. + /// + public ProductsMoveHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProductsMoveHeaders class. + /// + /// Location URI to poll for result + /// Recommended time to wait before making + /// another request to check the status of the operation. The time is + /// specified in seconds. + public ProductsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommended time to wait before making another request + /// to check the status of the operation. The time is specified in + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs new file mode 100644 index 000000000000..c29c43f43865 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of the reseller. + /// + public partial class Reseller + { + /// + /// Initializes a new instance of the Reseller class. + /// + public Reseller() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Reseller class. + /// + /// The MPN ID of the reseller. + /// The name of the reseller. + public Reseller(string resellerId = default(string), string description = default(string)) + { + ResellerId = resellerId; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the MPN ID of the reseller. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets the name of the reseller. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs new file mode 100644 index 000000000000..a41293d8b273 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ReservationPurchasesPolicy. + /// + public static class ReservationPurchasesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs new file mode 100644 index 000000000000..40f0ea280679 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ReservationType. + /// + public static class ReservationType + { + public const string Purchase = "Purchase"; + public const string UsageCharge = "Usage Charge"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..b545457eeb34 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs new file mode 100644 index 000000000000..9c110280d1f3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SpendingLimit. + /// + public static class SpendingLimit + { + public const string Off = "Off"; + public const string On = "On"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs new file mode 100644 index 000000000000..24ac4ee58ff5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SpendingLimitForBillingProfile. + /// + public static class SpendingLimitForBillingProfile + { + public const string Off = "Off"; + public const string On = "On"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs new file mode 100644 index 000000000000..b91f5b60e789 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for StatusReasonCode. + /// + public static class StatusReasonCode + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs new file mode 100644 index 000000000000..dcecf204daac --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs @@ -0,0 +1,23 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for StatusReasonCodeForBillingProfile. + /// + public static class StatusReasonCodeForBillingProfile + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs new file mode 100644 index 000000000000..128d487ef129 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SubscriptionTransferValidationErrorCode. + /// + public static class SubscriptionTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string SubscriptionNotActive = "SubscriptionNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string SubscriptionTypeNotSupported = "SubscriptionTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs new file mode 100644 index 000000000000..f89628991bb9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs @@ -0,0 +1,408 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A transaction. + /// + [Rest.Serialization.JsonTransformation] + public partial class Transaction : Resource + { + /// + /// Initializes a new instance of the Transaction class. + /// + public Transaction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Transaction class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The kind of transaction. Options are all or + /// reservation. Possible values include: 'all', 'reservation' + /// The date of transaction. + /// Invoice on which the transaction was billed + /// or 'pending' if the transaction is not billed. + /// The ID of the invoice on which the + /// transaction was billed. This field is only applicable for + /// transactions which are billed. + /// The order ID of the reservation. The field is + /// only applicable for transaction of kind reservation. + /// The name of the reservation order. The + /// field is only applicable for transactions of kind + /// reservation. + /// The family of the product for which the + /// transaction took place. + /// The ID of the product type for which + /// the transaction took place. + /// The type of the product for which the + /// transaction took place. + /// The description of the product for + /// which the transaction took place. + /// The type of transaction. Possible + /// values include: 'Purchase', 'Usage Charge' + /// The charge associated with the + /// transaction. + /// The quantity purchased in the + /// transaction. + /// The ID of the invoice section which + /// will be billed for the transaction. + /// The name of the invoice + /// section which will be billed for the transaction. + /// The ID of the billing profile which + /// will be billed for the transaction. + /// The name of the billing + /// profile which will be billed for the transaction. + /// The ID of the customer for which the + /// transaction took place. The field is applicable only for Microsoft + /// Partner Agreement billing account. + /// The name of the customer for + /// which the transaction took place. The field is applicable only for + /// Microsoft Partner Agreement billing account. + /// The ID of the subscription that was + /// used for the transaction. The field is only applicable for + /// transaction of kind reservation. + /// The name of the subscription that + /// was used for the transaction. The field is only applicable for + /// transaction of kind reservation. + /// The type of azure plan of the subscription + /// that was used for the transaction. + /// The amount of any Azure credits + /// automatically applied to this transaction. + /// The ISO 4217 code for the currency in + /// which this transaction is billed. + /// The percentage discount, if any, applied to + /// this transaction. + /// The price of the product after + /// applying any discounts. + /// The exchange rate used to convert + /// charged amount to billing currency, if applicable. + /// The retail price of the product. + /// The ISO 4217 code for the currency in + /// which the product is priced. + /// The date of the purchase of + /// the product, or the start date of the month in which usage + /// started. + /// The end date of the product + /// term, or the end date of the month in which usage ended. + /// The pre-tax charged amount for the + /// transaction. + /// The tax amount applied to the + /// transaction. + /// The unit of measure used to bill for + /// the product. For example, compute services are billed per + /// hour. + /// The number of units used for a given + /// product. + /// The description for the unit of measure for + /// a given product. + public Transaction(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string invoiceId = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), string azurePlan = default(string), Amount azureCreditApplied = default(Amount), string billingCurrency = default(string), double? discount = default(double?), Amount effectivePrice = default(Amount), double? exchangeRate = default(double?), Amount marketPrice = default(Amount), string pricingCurrency = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), Amount subTotal = default(Amount), Amount tax = default(Amount), string unitOfMeasure = default(string), double? units = default(double?), string unitType = default(string)) + : base(id, name, type) + { + Kind = kind; + Date = date; + Invoice = invoice; + InvoiceId = invoiceId; + OrderId = orderId; + OrderName = orderName; + ProductFamily = productFamily; + ProductTypeId = productTypeId; + ProductType = productType; + ProductDescription = productDescription; + TransactionType = transactionType; + TransactionAmount = transactionAmount; + Quantity = quantity; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; + SubscriptionId = subscriptionId; + SubscriptionName = subscriptionName; + AzurePlan = azurePlan; + AzureCreditApplied = azureCreditApplied; + BillingCurrency = billingCurrency; + Discount = discount; + EffectivePrice = effectivePrice; + ExchangeRate = exchangeRate; + MarketPrice = marketPrice; + PricingCurrency = pricingCurrency; + ServicePeriodStartDate = servicePeriodStartDate; + ServicePeriodEndDate = servicePeriodEndDate; + SubTotal = subTotal; + Tax = tax; + UnitOfMeasure = unitOfMeasure; + Units = units; + UnitType = unitType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of transaction. Options are all or + /// reservation. Possible values include: 'all', 'reservation' + /// + [JsonProperty(PropertyName = "properties.kind")] + public string Kind { get; set; } + + /// + /// Gets the date of transaction. + /// + [JsonProperty(PropertyName = "properties.date")] + public System.DateTime? Date { get; private set; } + + /// + /// Gets invoice on which the transaction was billed or 'pending' if + /// the transaction is not billed. + /// + [JsonProperty(PropertyName = "properties.invoice")] + public string Invoice { get; private set; } + + /// + /// Gets the ID of the invoice on which the transaction was billed. + /// This field is only applicable for transactions which are billed. + /// + [JsonProperty(PropertyName = "properties.invoiceId")] + public string InvoiceId { get; private set; } + + /// + /// Gets the order ID of the reservation. The field is only applicable + /// for transaction of kind reservation. + /// + [JsonProperty(PropertyName = "properties.orderId")] + public string OrderId { get; private set; } + + /// + /// Gets the name of the reservation order. The field is only + /// applicable for transactions of kind reservation. + /// + [JsonProperty(PropertyName = "properties.orderName")] + public string OrderName { get; private set; } + + /// + /// Gets the family of the product for which the transaction took + /// place. + /// + [JsonProperty(PropertyName = "properties.productFamily")] + public string ProductFamily { get; private set; } + + /// + /// Gets the ID of the product type for which the transaction took + /// place. + /// + [JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId { get; private set; } + + /// + /// Gets the type of the product for which the transaction took place. + /// + [JsonProperty(PropertyName = "properties.productType")] + public string ProductType { get; private set; } + + /// + /// Gets the description of the product for which the transaction took + /// place. + /// + [JsonProperty(PropertyName = "properties.productDescription")] + public string ProductDescription { get; private set; } + + /// + /// Gets or sets the type of transaction. Possible values include: + /// 'Purchase', 'Usage Charge' + /// + [JsonProperty(PropertyName = "properties.transactionType")] + public string TransactionType { get; set; } + + /// + /// Gets the charge associated with the transaction. + /// + [JsonProperty(PropertyName = "properties.transactionAmount")] + public Amount TransactionAmount { get; private set; } + + /// + /// Gets the quantity purchased in the transaction. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public int? Quantity { get; private set; } + + /// + /// Gets the ID of the invoice section which will be billed for the + /// transaction. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets the name of the invoice section which will be billed for the + /// transaction. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets the ID of the billing profile which will be billed for the + /// transaction. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the name of the billing profile which will be billed for the + /// transaction. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets the ID of the customer for which the transaction took place. + /// The field is applicable only for Microsoft Partner Agreement + /// billing account. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets the name of the customer for which the transaction took place. + /// The field is applicable only for Microsoft Partner Agreement + /// billing account. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } + + /// + /// Gets the ID of the subscription that was used for the transaction. + /// The field is only applicable for transaction of kind reservation. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets the name of the subscription that was used for the + /// transaction. The field is only applicable for transaction of kind + /// reservation. + /// + [JsonProperty(PropertyName = "properties.subscriptionName")] + public string SubscriptionName { get; private set; } + + /// + /// Gets the type of azure plan of the subscription that was used for + /// the transaction. + /// + [JsonProperty(PropertyName = "properties.azurePlan")] + public string AzurePlan { get; private set; } + + /// + /// Gets the amount of any Azure credits automatically applied to this + /// transaction. + /// + [JsonProperty(PropertyName = "properties.azureCreditApplied")] + public Amount AzureCreditApplied { get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which this transaction + /// is billed. + /// + [JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency { get; private set; } + + /// + /// Gets the percentage discount, if any, applied to this transaction. + /// + [JsonProperty(PropertyName = "properties.discount")] + public double? Discount { get; private set; } + + /// + /// Gets the price of the product after applying any discounts. + /// + [JsonProperty(PropertyName = "properties.effectivePrice")] + public Amount EffectivePrice { get; private set; } + + /// + /// Gets the exchange rate used to convert charged amount to billing + /// currency, if applicable. + /// + [JsonProperty(PropertyName = "properties.exchangeRate")] + public double? ExchangeRate { get; private set; } + + /// + /// Gets the retail price of the product. + /// + [JsonProperty(PropertyName = "properties.marketPrice")] + public Amount MarketPrice { get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which the product is + /// priced. + /// + [JsonProperty(PropertyName = "properties.pricingCurrency")] + public string PricingCurrency { get; private set; } + + /// + /// Gets the date of the purchase of the product, or the start date of + /// the month in which usage started. + /// + [JsonProperty(PropertyName = "properties.servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate { get; private set; } + + /// + /// Gets the end date of the product term, or the end date of the month + /// in which usage ended. + /// + [JsonProperty(PropertyName = "properties.servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate { get; private set; } + + /// + /// Gets the pre-tax charged amount for the transaction. + /// + [JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal { get; private set; } + + /// + /// Gets the tax amount applied to the transaction. + /// + [JsonProperty(PropertyName = "properties.tax")] + public Amount Tax { get; private set; } + + /// + /// Gets the unit of measure used to bill for the product. For example, + /// compute services are billed per hour. + /// + [JsonProperty(PropertyName = "properties.unitOfMeasure")] + public string UnitOfMeasure { get; private set; } + + /// + /// Gets the number of units used for a given product. + /// + [JsonProperty(PropertyName = "properties.units")] + public double? Units { get; private set; } + + /// + /// Gets the description for the unit of measure for a given product. + /// + [JsonProperty(PropertyName = "properties.unitType")] + public string UnitType { get; private set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs new file mode 100644 index 000000000000..700c53775320 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for TransactionTypeKind. + /// + public static class TransactionTypeKind + { + public const string All = "all"; + public const string Reservation = "reservation"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs new file mode 100644 index 000000000000..58ad2fc19b6b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs @@ -0,0 +1,68 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request parameters to transfer billing subscription. + /// + public partial class TransferBillingSubscriptionRequestProperties + { + /// + /// Initializes a new instance of the + /// TransferBillingSubscriptionRequestProperties class. + /// + public TransferBillingSubscriptionRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// TransferBillingSubscriptionRequestProperties class. + /// + /// The destination invoice + /// section id. + public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId) + { + DestinationInvoiceSectionId = destinationInvoiceSectionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the destination invoice section id. + /// + [JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DestinationInvoiceSectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationInvoiceSectionId"); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs new file mode 100644 index 000000000000..f8ce7edb5219 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of the product to initiate a transfer. + /// + public partial class TransferProductRequestProperties + { + /// + /// Initializes a new instance of the TransferProductRequestProperties + /// class. + /// + public TransferProductRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransferProductRequestProperties + /// class. + /// + /// The destination invoice + /// section id. + public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string)) + { + DestinationInvoiceSectionId = destinationInvoiceSectionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the destination invoice section id. + /// + [JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs new file mode 100644 index 000000000000..f3ec2bbcb846 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the address validation + /// + public partial class ValidateAddressResponse + { + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + public ValidateAddressResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + /// status of the address validation. Possible + /// values include: 'Valid', 'Invalid' + /// The list of suggested + /// addresses. + /// Validation error message. + public ValidateAddressResponse(string status = default(string), IList suggestedAddresses = default(IList), string validationMessage = default(string)) + { + Status = status; + SuggestedAddresses = suggestedAddresses; + ValidationMessage = validationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the address validation. Possible values + /// include: 'Valid', 'Invalid' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the list of suggested addresses. + /// + [JsonProperty(PropertyName = "suggestedAddresses")] + public IList SuggestedAddresses { get; set; } + + /// + /// Gets or sets validation error message. + /// + [JsonProperty(PropertyName = "validationMessage")] + public string ValidationMessage { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs new file mode 100644 index 000000000000..6d06b5bcc559 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + public ValidateProductTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateProductTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs new file mode 100644 index 000000000000..ff0c8119304e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + public ValidateProductTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + /// Specifies whether the transfer is + /// eligible or not. + /// Validation error details. + public ValidateProductTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateProductTransferEligibilityError errorDetails = default(ValidateProductTransferEligibilityError)) + { + IsMoveEligible = isMoveEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateProductTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs new file mode 100644 index 000000000000..93b4696ea517 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the transfer eligibility validation + /// + public partial class ValidateSubscriptionTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + public ValidateSubscriptionTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateSubscriptionTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs new file mode 100644 index 000000000000..e8fb98e41044 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the transfer eligibility validation. + /// + public partial class ValidateSubscriptionTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + public ValidateSubscriptionTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + /// Specifies whether the subscription is + /// eligible to be transferred. + /// Validation error details. + public ValidateSubscriptionTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateSubscriptionTransferEligibilityError errorDetails = default(ValidateSubscriptionTransferEligibilityError)) + { + IsMoveEligible = isMoveEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the subscription is eligible to be + /// transferred. + /// + [JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateSubscriptionTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs new file mode 100644 index 000000000000..1554a09e32ab --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ViewCharges. + /// + public static class ViewCharges + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs new file mode 100644 index 000000000000..39e0334d635c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs @@ -0,0 +1,22 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ViewChargesPolicy. + /// + public static class ViewChargesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Operations.cs b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..7507aedc3476 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,392 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..e34702e76499 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs @@ -0,0 +1,91 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs new file mode 100644 index 000000000000..730a744a6ed5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs @@ -0,0 +1,835 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PoliciesOperations operations. + /// + internal partial class PoliciesOperations : IServiceOperations, IPoliciesOperations + { + /// + /// Initializes a new instance of the PoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoliciesOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + CustomerPolicy parameters = new CustomerPolicy(); + if (viewCharges != null) + { + parameters.ViewCharges = viewCharges; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..e88b3ba9afde --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -0,0 +1,213 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PoliciesOperations. + /// + public static partial class PoliciesOperationsExtensions + { + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) + { + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies operation. + /// + public static Policy Update(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters) + { + return operations.UpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName) + { + return operations.GetByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async Task GetByCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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' + /// + public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string)) + { + return operations.UpdateCustomerAsync(billingAccountName, customerName, viewCharges).GetAwaiter().GetResult(); + } + + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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' + /// + /// + /// The cancellation token. + /// + public static async Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, viewCharges, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs new file mode 100644 index 000000000000..a6570c4be059 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs @@ -0,0 +1,2341 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProductsOperations operations. + /// + internal partial class ProductsOperations : IServiceOperations, IProductsOperations + { + /// + /// Initializes a new instance of the ProductsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProductsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + if (destinationInvoiceSectionId != null) + { + parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + TransferProductRequestProperties parameters = new TransferProductRequestProperties(); + if (destinationInvoiceSectionId != null) + { + parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs new file mode 100644 index 000000000000..5c70f8a05d64 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs @@ -0,0 +1,609 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProductsOperations. + /// + public static partial class ProductsOperationsExtensions + { + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static IPage ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName) + { + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + public static IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + public static IPage ListByBillingProfile(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string)) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, filter).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + public static IPage ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) + { + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Get(this IProductsOperations operations, string billingAccountName, string productName) + { + return operations.GetAsync(billingAccountName, productName).GetAwaiter().GetResult(); + } + + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, productName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product operation. + /// + public static Product Update(this IProductsOperations operations, string billingAccountName, string productName, Product parameters) + { + return operations.UpdateAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProductsOperations operations, string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + { + return operations.MoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// The cancellation token. + /// + public static async Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + { + return operations.ValidateMoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The destination invoice section id. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCustomerNext(this IProductsOperations operations, string nextPageLink) + { + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IProductsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceSectionNext(this IProductsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceSectionNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs new file mode 100644 index 000000000000..8b3c30035787 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs @@ -0,0 +1,44 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_BillingManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Billing", "Address", "2020-05-01"), + new Tuple("Billing", "Agreements", "2020-05-01"), + new Tuple("Billing", "AvailableBalances", "2020-05-01"), + new Tuple("Billing", "BillingAccounts", "2020-05-01"), + new Tuple("Billing", "BillingPermissions", "2020-05-01"), + new Tuple("Billing", "BillingProfiles", "2020-05-01"), + new Tuple("Billing", "BillingProperty", "2020-05-01"), + new Tuple("Billing", "BillingRoleAssignments", "2020-05-01"), + new Tuple("Billing", "BillingRoleDefinitions", "2020-05-01"), + new Tuple("Billing", "BillingSubscriptions", "2020-05-01"), + new Tuple("Billing", "Customers", "2020-05-01"), + new Tuple("Billing", "Instructions", "2020-05-01"), + new Tuple("Billing", "InvoiceSections", "2020-05-01"), + new Tuple("Billing", "Invoices", "2020-05-01"), + new Tuple("Billing", "Operations", "2020-05-01"), + new Tuple("Billing", "Policies", "2020-05-01"), + new Tuple("Billing", "Products", "2020-05-01"), + new Tuple("Billing", "Transactions", "2020-05-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs new file mode 100644 index 000000000000..b0fe0e9a9911 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs @@ -0,0 +1,412 @@ +// +// 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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TransactionsOperations operations. + /// + internal partial class TransactionsOperations : IServiceOperations, ITransactionsOperations + { + /// + /// Initializes a new instance of the TransactionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TransactionsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (invoiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs new file mode 100644 index 000000000000..9273d6443e9e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TransactionsOperations. + /// + public static partial class TransactionsOperationsExtensions + { + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static IPage ListByInvoice(this ITransactionsOperations operations, string billingAccountName, string invoiceName) + { + return operations.ListByInvoiceAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByInvoiceNext(this ITransactionsOperations operations, string nextPageLink) + { + return operations.ListByInvoiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByInvoiceNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs b/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..9b851f0e0fc5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Billing Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("4.1.0.0")] \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/README.md b/src/Billing/Billing.Management.Sdk/README.md new file mode 100644 index 000000000000..529e31af2e5b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/README.md @@ -0,0 +1,35 @@ +# Overall +This directory contains management plane service clients of Az.Storage module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@microsoft.azure/autorest.csharp@2.3.90 +autorest.cmd README.md --version=v2 +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +csharp: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +payload-flattening-threshold: 2 +``` + + + +### +``` yaml +commit: bfd326ea58084517f8e9cb2e6bdbcb0c400f6370 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/billing.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Billing +``` \ No newline at end of file From cbefbb243db0f51b3261992788c29bd496a69c08 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:51:21 +0800 Subject: [PATCH 02/10] add Microsoft.Azure.PowerShell.Billing.Management.Sdk --- src/Billing/Billing.Test/Billing.Test.csproj | 2 +- src/Billing/Billing.sln | 38 +++++++++++--------- src/Billing/Billing/Billing.csproj | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/Billing/Billing.Test/Billing.Test.csproj b/src/Billing/Billing.Test/Billing.Test.csproj index d8407996b96a..ed59d32342f1 100644 --- a/src/Billing/Billing.Test/Billing.Test.csproj +++ b/src/Billing/Billing.Test/Billing.Test.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/Billing/Billing.sln b/src/Billing/Billing.sln index 830f1f135255..e916a6a3f578 100644 --- a/src/Billing/Billing.sln +++ b/src/Billing/Billing.sln @@ -5,42 +5,41 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{311A44F7-E3F9-4D2B-AC76-5C10BB3447F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{B41714D2-DAAA-49D0-940C-D26056956572}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{B41714D2-DAAA-49D0-940C-D26056956572}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{C54A7430-DB21-4A10-AA15-2529FC3A6A5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{C54A7430-DB21-4A10-AA15-2529FC3A6A5F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{257DBAA6-F0C7-41AA-810E-B3EB0FC5A14E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{257DBAA6-F0C7-41AA-810E-B3EB0FC5A14E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{10851341-36EB-4DE6-BF05-AF35BFEAD64C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{10851341-36EB-4DE6-BF05-AF35BFEAD64C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{CEDEA167-925D-4806-AA23-09E874C5C6A0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{CEDEA167-925D-4806-AA23-09E874C5C6A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9FB12028-0B88-429D-8CEF-AAE313818C49}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9FB12028-0B88-429D-8CEF-AAE313818C49}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{D91557EF-D059-4FFB-86B1-BE1E567C56E8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Billing.Test", "Billing.Test\Billing.Test.csproj", "{8DE30CD1-B2A6-43C2-A4D3-60E14C0CBCD9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing.Test", "Billing.Test\Billing.Test.csproj", "{8DE30CD1-B2A6-43C2-A4D3-60E14C0CBCD9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Billing", "Billing\Billing.csproj", "{FDED408F-D9BA-4B98-9CE4-DF89D6991151}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing", "Billing\Billing.csproj", "{FDED408F-D9BA-4B98-9CE4-DF89D6991151}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consumption.Test", "Consumption.Test\Consumption.Test.csproj", "{F56BCD91-DC54-448A-972C-4CB3A755D6BB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consumption.Test", "Consumption.Test\Consumption.Test.csproj", "{F56BCD91-DC54-448A-972C-4CB3A755D6BB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consumption", "Consumption\Consumption.csproj", "{3BFAF07F-070D-4833-A4E4-8B547FC0C65A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consumption", "Consumption\Consumption.csproj", "{3BFAF07F-070D-4833-A4E4-8B547FC0C65A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageAggregates.Test", "UsageAggregates.Test\UsageAggregates.Test.csproj", "{FB24E8D0-36A2-4138-A567-8B9CE3920E57}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsageAggregates.Test", "UsageAggregates.Test\UsageAggregates.Test.csproj", "{FB24E8D0-36A2-4138-A567-8B9CE3920E57}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageAggregates", "UsageAggregates\UsageAggregates.csproj", "{F06B0A62-71FF-43A9-800D-A390844682E5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsageAggregates", "UsageAggregates\UsageAggregates.csproj", "{F06B0A62-71FF-43A9-800D-A390844682E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{DC961B46-3B4E-4094-BCD5-C6A5DA300597}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{DC961B46-3B4E-4094-BCD5-C6A5DA300597}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing.Management.Sdk", "Billing.Management.Sdk\Billing.Management.Sdk.csproj", "{162555C6-2861-4C0A-879F-1BF3BBFDB281}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B41714D2-DAAA-49D0-940C-D26056956572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B41714D2-DAAA-49D0-940C-D26056956572}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -94,6 +93,13 @@ Global {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Debug|Any CPU.Build.0 = Debug|Any CPU {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Release|Any CPU.ActiveCfg = Release|Any CPU {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Release|Any CPU.Build.0 = Release|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Debug|Any CPU.Build.0 = Debug|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Release|Any CPU.ActiveCfg = Release|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {B41714D2-DAAA-49D0-940C-D26056956572} = {311A44F7-E3F9-4D2B-AC76-5C10BB3447F9} diff --git a/src/Billing/Billing/Billing.csproj b/src/Billing/Billing/Billing.csproj index d071144e34ea..f05a2c4003de 100644 --- a/src/Billing/Billing/Billing.csproj +++ b/src/Billing/Billing/Billing.csproj @@ -11,7 +11,7 @@ - + From 704078100ed751928b75c7b20d6b9e87bbf11d58 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:51:48 +0800 Subject: [PATCH 03/10] generate Microsoft.Azure.PowerShell.Billing.Management.Sdk by autorest powershell --- .../Generated/AddressOperations.cs | 129 +- .../Generated/AddressOperationsExtensions.cs | 74 +- .../Generated/AgreementsOperations.cs | 307 +++-- .../AgreementsOperationsExtensions.cs | 240 ++-- .../Generated/AvailableBalancesOperations.cs | 128 +- .../AvailableBalancesOperationsExtensions.cs | 102 +- .../Generated/BillingAccountsOperations.cs | 592 ++++---- .../BillingAccountsOperationsExtensions.cs | 512 ++++--- .../Generated/BillingManagementClient.cs | 279 ++-- .../Generated/BillingPeriodsOperations.cs | 650 +++++++++ .../BillingPeriodsOperationsExtensions.cs | 155 +++ .../Generated/BillingPermissionsOperations.cs | 748 +++++----- .../BillingPermissionsOperationsExtensions.cs | 567 ++++---- .../Generated/BillingProfilesOperations.cs | 438 +++--- .../BillingProfilesOperationsExtensions.cs | 438 +++--- .../Generated/BillingPropertyOperations.cs | 235 ++-- .../BillingPropertyOperationsExtensions.cs | 133 +- .../BillingRoleAssignmentsOperations.cs | 1183 +++++++++------- ...lingRoleAssignmentsOperationsExtensions.cs | 1041 +++++++------- .../BillingRoleDefinitionsOperations.cs | 877 ++++++------ ...lingRoleDefinitionsOperationsExtensions.cs | 762 +++++------ .../BillingSubscriptionsOperations.cs | 1216 ++++++++-------- ...illingSubscriptionsOperationsExtensions.cs | 1010 +++++++------- .../Generated/CustomersOperations.cs | 490 ++++--- .../CustomersOperationsExtensions.cs | 458 +++---- .../Generated/EnrollmentAccountsOperations.cs | 587 ++++++++ .../EnrollmentAccountsOperationsExtensions.cs | 109 ++ .../Generated/IAddressOperations.cs | 34 +- .../Generated/IAgreementsOperations.cs | 52 +- .../Generated/IAvailableBalancesOperations.cs | 39 +- .../Generated/IBillingAccountsOperations.cs | 136 +- .../Generated/IBillingManagementClient.cs | 90 +- .../Generated/IBillingPeriodsOperations.cs | 114 ++ .../IBillingPermissionsOperations.cs | 112 +- .../Generated/IBillingProfilesOperations.cs | 114 +- .../Generated/IBillingPropertyOperations.cs | 53 +- .../IBillingRoleAssignmentsOperations.cs | 239 ++-- .../IBillingRoleDefinitionsOperations.cs | 184 +-- .../IBillingSubscriptionsOperations.cs | 277 ++-- .../Generated/ICustomersOperations.cs | 113 +- .../IEnrollmentAccountsOperations.cs | 83 ++ .../Generated/IInstructionsOperations.cs | 73 +- .../Generated/IInvoiceSectionsOperations.cs | 108 +- .../Generated/IInvoicesOperations.cs | 246 ++-- .../Generated/IOperations.cs | 40 +- .../Generated/IPoliciesOperations.cs | 94 +- .../Generated/IProductsOperations.cs | 292 ++-- .../Generated/ITransactionsOperations.cs | 50 +- .../Generated/InstructionsOperations.cs | 426 +++--- .../InstructionsOperationsExtensions.cs | 339 +++-- .../Generated/InvoiceSectionsOperations.cs | 435 +++--- .../InvoiceSectionsOperationsExtensions.cs | 464 +++---- .../Generated/InvoicesOperations.cs | 1129 ++++++++------- .../Generated/InvoicesOperationsExtensions.cs | 1066 +++++++-------- .../Generated/Models/AcceptanceMode.cs | 13 +- .../Generated/Models/AccountStatus.cs | 13 +- .../Generated/Models/AccountType.cs | 13 +- .../Generated/Models/AddressDetails.cs | 170 ++- .../Models/AddressValidationStatus.cs | 13 +- .../Generated/Models/Agreement.cs | 129 +- .../Generated/Models/AgreementProperties.cs | 110 ++ .../Generated/Models/AgreementType.cs | 13 +- .../Generated/Models/Amount.cs | 35 +- .../Generated/Models/AutoRenew.cs | 13 +- .../Generated/Models/AvailableBalance.cs | 46 +- .../Models/AvailableBalanceProperties.cs | 48 + .../Generated/Models/AzurePlan.cs | 35 +- .../Generated/Models/BillingAccount.cs | 197 +-- .../Models/BillingAccountProperties.cs | 168 +++ .../Models/BillingAccountUpdateRequest.cs | 189 +-- .../Generated/Models/BillingFrequency.cs | 13 +- .../Generated/Models/BillingPeriod.cs | 81 ++ .../Models/BillingPeriodProperties.cs | 70 + .../Models/BillingPermissionsProperties.cs | 51 +- .../Generated/Models/BillingProfile.cs | 233 ++-- .../Models/BillingProfileCreationRequest.cs | 99 +- .../Models/BillingProfileProperties.cs | 198 +++ .../Models/BillingProfileSpendingLimit.cs | 13 +- .../Generated/Models/BillingProfileStatus.cs | 13 +- .../Models/BillingProfileStatusReasonCode.cs | 13 +- .../BillingProfilesCreateOrUpdateHeaders.cs | 52 +- .../Models/BillingProfilesOnExpand.cs | 59 +- .../Generated/Models/BillingProperty.cs | 254 ++-- .../Models/BillingPropertyProperties.cs | 210 +++ .../Generated/Models/BillingRoleAssignment.cs | 150 +- .../Models/BillingRoleAssignmentProperties.cs | 139 ++ .../Generated/Models/BillingRoleDefinition.cs | 68 +- .../Models/BillingRoleDefinitionProperties.cs | 68 + .../Generated/Models/BillingSubscription.cs | 236 ++-- .../Models/BillingSubscriptionProperties.cs | 193 +++ .../Models/BillingSubscriptionStatusType.cs | 13 +- .../Models/BillingSubscriptionsMoveHeaders.cs | 52 +- .../Generated/Models/Category.cs | 13 +- .../Generated/Models/Customer.cs | 97 +- .../Generated/Models/CustomerPolicy.cs | 53 +- .../Models/CustomerPolicyProperties.cs | 50 + .../Generated/Models/CustomerProperties.cs | 89 ++ .../Generated/Models/Department.cs | 83 +- .../Generated/Models/DepartmentProperties.cs | 80 ++ .../Generated/Models/Document.cs | 55 +- .../Generated/Models/DocumentSource.cs | 13 +- .../Generated/Models/DocumentType.cs | 13 +- .../Generated/Models/DownloadUrl.cs | 36 +- .../Generated/Models/Enrollment.cs | 109 +- .../Generated/Models/EnrollmentAccount.cs | 125 +- .../Models/EnrollmentAccountContext.cs | 62 +- .../Models/EnrollmentAccountProperties.cs | 110 ++ .../Models/EnrollmentAccountSummary.cs | 59 + .../EnrollmentAccountSummaryProperties.cs | 48 + .../Generated/Models/EnrollmentPolicies.cs | 78 +- .../Generated/Models/ErrorDetails.cs | 46 +- .../Generated/Models/ErrorResponse.cs | 25 +- .../Models/ErrorResponseException.cs | 25 +- .../Generated/Models/Instruction.cs | 92 +- .../Generated/Models/InstructionProperties.cs | 88 ++ .../Generated/Models/Invoice.cs | 354 ++--- .../Generated/Models/InvoiceProperties.cs | 274 ++++ .../Generated/Models/InvoiceSection.cs | 72 +- .../Models/InvoiceSectionCreationRequest.cs | 31 +- .../Models/InvoiceSectionProperties.cs | 68 + .../InvoiceSectionWithCreateSubPermission.cs | 151 +- .../InvoiceSectionsCreateOrUpdateHeaders.cs | 52 +- .../Models/InvoiceSectionsOnExpand.cs | 59 +- .../Generated/Models/InvoiceStatus.cs | 13 +- .../Generated/Models/InvoiceType.cs | 13 +- ...wnloadBillingSubscriptionInvoiceHeaders.cs | 53 +- .../Models/InvoicesDownloadInvoiceHeaders.cs | 53 +- .../Models/MarketplacePurchasesPolicy.cs | 13 +- .../Generated/Models/Operation.cs | 37 +- .../Generated/Models/OperationDisplay.cs | 52 +- .../Generated/Models/Page.cs | 74 +- .../Generated/Models/Participants.cs | 47 +- .../Generated/Models/PaymentMethodFamily.cs | 13 +- .../Generated/Models/PaymentProperties.cs | 68 +- .../Generated/Models/Policy.cs | 88 +- .../Generated/Models/PolicyProperties.cs | 74 + .../Generated/Models/Product.cs | 319 +++-- .../Generated/Models/ProductProperties.cs | 264 ++++ .../Generated/Models/ProductStatusType.cs | 13 +- .../ProductTransferValidationErrorCode.cs | 13 +- .../Generated/Models/ProductsMoveHeaders.cs | 46 +- .../Generated/Models/Reseller.cs | 35 +- .../Models/ReservationPurchasesPolicy.cs | 13 +- .../Generated/Models/ReservationType.cs | 13 +- .../Generated/Models/Resource.cs | 49 +- .../Generated/Models/SpendingLimit.cs | 13 +- .../Models/SpendingLimitForBillingProfile.cs | 13 +- .../Generated/Models/StatusReasonCode.cs | 13 +- .../StatusReasonCodeForBillingProfile.cs | 13 +- ...SubscriptionTransferValidationErrorCode.cs | 13 +- .../Generated/Models/Transaction.cs | 525 +++---- .../Generated/Models/TransactionProperties.cs | 430 ++++++ .../Generated/Models/TransactionTypeKind.cs | 13 +- ...ferBillingSubscriptionRequestProperties.cs | 40 +- .../TransferProductRequestProperties.cs | 32 +- .../Models/ValidateAddressResponse.cs | 54 +- ...ValidateProductTransferEligibilityError.cs | 70 +- ...alidateProductTransferEligibilityResult.cs | 42 +- ...ateSubscriptionTransferEligibilityError.cs | 66 +- ...teSubscriptionTransferEligibilityResult.cs | 45 +- .../Generated/Models/ViewCharges.cs | 13 +- .../Generated/Models/ViewChargesPolicy.cs | 13 +- .../Generated/Operations.cs | 202 +-- .../Generated/OperationsExtensions.cs | 129 +- .../Generated/PoliciesOperations.cs | 446 +++--- .../Generated/PoliciesOperationsExtensions.cs | 343 +++-- .../Generated/ProductsOperations.cs | 1218 +++++++++-------- .../Generated/ProductsOperationsExtensions.cs | 1059 +++++++------- .../SdkInfo_BillingManagementClient.cs | 44 - .../Generated/TransactionsOperations.cs | 208 +-- .../TransactionsOperationsExtensions.cs | 161 +-- src/Billing/Billing.Management.Sdk/README.md | 9 +- 172 files changed, 18590 insertions(+), 13855 deletions(-) create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs create mode 100644 src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs delete mode 100644 src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs index d922a0b43aa9..7835d50a5a1e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// AddressOperations operations. /// - internal partial class AddressOperations : IServiceOperations, IAddressOperations + internal partial class AddressOperations : Microsoft.Rest.IServiceOperations, IAddressOperations { /// /// Initializes a new instance of the AddressOperations class. @@ -36,13 +24,13 @@ internal partial class AddressOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AddressOperations(BillingManagementClient client) + internal AddressOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -53,9 +41,9 @@ internal AddressOperations(BillingManagementClient client) /// /// Validates an address. Use the operation to validate an address before using /// it as soldTo or a billTo address. - /// /// /// + /// /// /// /// Headers that will be added to request. @@ -63,13 +51,13 @@ internal AddressOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -78,63 +66,68 @@ internal AddressOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ValidateWithHttpMessagesAsync(AddressDetails address, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (address == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "address"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "address"); } if (address != null) { address.Validate(); } + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("address", address); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/validateAddress").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -146,56 +139,57 @@ internal AddressOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(address != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(address, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(address, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -205,9 +199,10 @@ internal AddressOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -218,24 +213,28 @@ internal AddressOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs index 820680b6ba61..3d38e4dffcda 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs @@ -1,61 +1,45 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for AddressOperations. + /// Extension methods for AddressOperations /// public static partial class AddressOperationsExtensions { - /// - /// Validates an address. Use the operation to validate an address before using - /// it as soldTo or a billTo address. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) - { - return operations.ValidateAsync(address).GetAwaiter().GetResult(); - } + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// The operations group for this extension method. + /// + public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) + { + return ((IAddressOperations)operations).ValidateAsync(address).GetAwaiter().GetResult(); + } - /// - /// Validates an address. Use the operation to validate an address before using - /// it as soldTo or a billTo address. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task ValidateAsync(this IAddressOperations operations, AddressDetails address, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateAsync(this IAddressOperations operations, AddressDetails address, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs index 1d43b32dd395..853b3eed1c88 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// AgreementsOperations operations. /// - internal partial class AgreementsOperations : IServiceOperations, IAgreementsOperations + internal partial class AgreementsOperations : Microsoft.Rest.IServiceOperations, IAgreementsOperations { /// /// Initializes a new instance of the AgreementsOperations class. @@ -36,13 +24,13 @@ internal partial class AgreementsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AgreementsOperations(BillingManagementClient client) + internal AgreementsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -52,7 +40,6 @@ internal AgreementsOperations(BillingManagementClient client) /// /// Lists the agreements for a billing account. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -66,13 +53,13 @@ internal AgreementsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -81,36 +68,44 @@ internal AgreementsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -121,25 +116,24 @@ internal AgreementsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -151,50 +145,51 @@ internal AgreementsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -204,9 +199,10 @@ internal AgreementsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -217,28 +213,31 @@ internal AgreementsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets an agreement by ID. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -255,13 +254,13 @@ internal AgreementsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -270,42 +269,51 @@ internal AgreementsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (agreementName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "agreementName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "agreementName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("agreementName", agreementName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{agreementName}", System.Uri.EscapeDataString(agreementName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -316,25 +324,24 @@ internal AgreementsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -346,50 +353,51 @@ internal AgreementsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -399,9 +407,10 @@ internal AgreementsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -412,28 +421,31 @@ internal AgreementsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the agreements for a billing account. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -444,13 +456,13 @@ internal AgreementsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -459,51 +471,54 @@ internal AgreementsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -515,50 +530,51 @@ internal AgreementsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -568,9 +584,10 @@ internal AgreementsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -581,24 +598,28 @@ internal AgreementsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs index e5377e98818a..cd31a703652a 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs @@ -1,151 +1,133 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for AgreementsOperations. + /// Extension methods for AgreementsOperations /// public static partial class AgreementsOperationsExtensions { - /// - /// Lists the agreements for a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the participants. - /// - public static IPage ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) - { - return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// Lists the agreements for a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the participants. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IAgreementsOperations)operations).ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } - /// - /// Gets an agreement by ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an agreement. - /// - /// - /// May be used to expand the participants. - /// - public static Agreement Get(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string)) + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(billingAccountName, agreementName, expand).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Gets an agreement by ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + public static Agreement Get(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string)) + { + return ((IAgreementsOperations)operations).GetAsync(billingAccountName, agreementName, expand).GetAwaiter().GetResult(); + } - /// - /// Gets an agreement by ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an agreement. - /// - /// - /// May be used to expand the participants. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets an agreement by ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, agreementName, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, agreementName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IAgreementsOperations operations, string nextPageLink) + { + return ((IAgreementsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the agreements for a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IAgreementsOperations operations, string nextPageLink) + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IAgreementsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists the agreements for a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IAgreementsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs index 0d741b8bb43d..be16479e3fb0 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// AvailableBalancesOperations operations. /// - internal partial class AvailableBalancesOperations : IServiceOperations, IAvailableBalancesOperations + internal partial class AvailableBalancesOperations : Microsoft.Rest.IServiceOperations, IAvailableBalancesOperations { /// /// Initializes a new instance of the AvailableBalancesOperations class. @@ -36,13 +24,13 @@ internal partial class AvailableBalancesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal AvailableBalancesOperations(BillingManagementClient client) + internal AvailableBalancesOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -55,7 +43,6 @@ internal AvailableBalancesOperations(BillingManagementClient client) /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -69,13 +56,13 @@ internal AvailableBalancesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -84,66 +71,73 @@ internal AvailableBalancesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -155,50 +149,51 @@ internal AvailableBalancesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -208,9 +203,10 @@ internal AvailableBalancesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -221,24 +217,28 @@ internal AvailableBalancesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs index 88f874001632..d42e6f55aab0 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs @@ -1,73 +1,61 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for AvailableBalancesOperations. + /// Extension methods for AvailableBalancesOperations /// public static partial class AvailableBalancesOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static AvailableBalance Get(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName) - { - return operations.GetAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static AvailableBalance Get(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName) + { + return ((IAvailableBalancesOperations)operations).GetAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs index b2d052925aee..009f3a4b6d0b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingAccountsOperations operations. /// - internal partial class BillingAccountsOperations : IServiceOperations, IBillingAccountsOperations + internal partial class BillingAccountsOperations : Microsoft.Rest.IServiceOperations, IBillingAccountsOperations { /// /// Initializes a new instance of the BillingAccountsOperations class. @@ -36,13 +24,13 @@ internal partial class BillingAccountsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingAccountsOperations(BillingManagementClient client) + internal BillingAccountsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -52,7 +40,6 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// Lists the billing accounts that a user has access to. - /// /// /// /// May be used to expand the soldTo, invoice sections and billing profiles. @@ -63,13 +50,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -78,30 +65,37 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -112,25 +106,24 @@ internal BillingAccountsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -142,50 +135,51 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -195,9 +189,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -208,28 +203,31 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a billing account by its ID. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -243,13 +241,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -258,36 +256,44 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -298,25 +304,24 @@ internal BillingAccountsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -328,50 +333,51 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -381,9 +387,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -394,25 +401,29 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the properties of a billing account. Currently, displayName and /// address can be updated. The operation is supported only for billing @@ -426,23 +437,22 @@ internal BillingAccountsOperations(BillingManagementClient client) /// operation. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -453,13 +463,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -468,60 +478,66 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermission", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermission", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -533,50 +549,51 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -586,9 +603,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -599,25 +617,29 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the properties of a billing account. Currently, displayName and /// address can be updated. The operation is supported only for billing @@ -636,13 +658,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -651,65 +673,71 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -721,56 +749,57 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -780,9 +809,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -793,28 +823,31 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing accounts that a user has access to. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -825,13 +858,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -840,51 +873,54 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -896,50 +932,51 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -949,9 +986,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -962,30 +1000,33 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -996,13 +1037,13 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1011,51 +1052,54 @@ internal BillingAccountsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermissionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermissionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1067,50 +1111,51 @@ internal BillingAccountsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1120,9 +1165,10 @@ internal BillingAccountsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1133,24 +1179,28 @@ internal BillingAccountsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs index 077b97c61b0e..9eaadf9a5c8e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs @@ -1,311 +1,269 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingAccountsOperations. + /// Extension methods for BillingAccountsOperations /// public static partial class BillingAccountsOperationsExtensions { - /// - /// Lists the billing accounts that a user has access to. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// - public static IPage List(this IBillingAccountsOperations operations, string expand = default(string)) - { - return operations.ListAsync(expand).GetAwaiter().GetResult(); - } - - /// - /// Lists the billing accounts that a user has access to. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IBillingAccountsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a billing account by its ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// - public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) - { - return operations.GetAsync(billingAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// Gets a billing account by its ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the soldTo, invoice sections and billing profiles. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing account - /// operation. - /// - public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) - { - return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); - } + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static Microsoft.Rest.Azure.IPage List(this IBillingAccountsOperations operations, string expand = default(string)) + { + return ((IBillingAccountsOperations)operations).ListAsync(expand).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing account - /// operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBillingAccountsOperations operations, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Gets a billing account by its ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IBillingAccountsOperations)operations).GetAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static IPage ListInvoiceSectionsByCreateSubscriptionPermission(this IBillingAccountsOperations operations, string billingAccountName) + /// + /// Gets a billing account by its ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return ((IBillingAccountsOperations)operations).UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(this IBillingAccountsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListInvoiceSectionsByCreateSubscriptionPermission(this IBillingAccountsOperations operations, string billingAccountName) + { + return ((IBillingAccountsOperations)operations).ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing account - /// operation. - /// - public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(this IBillingAccountsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return ((IBillingAccountsOperations)operations).BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing account - /// operation. - /// - /// - /// The cancellation token. - /// - public static async Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return ((IBillingAccountsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing accounts that a user has access to. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IBillingAccountsOperations operations, string nextPageLink) + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBillingAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListInvoiceSectionsByCreateSubscriptionPermissionNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return ((IBillingAccountsOperations)operations).ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing accounts that a user has access to. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IBillingAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(this IBillingAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListInvoiceSectionsByCreateSubscriptionPermissionNext(this IBillingAccountsOperations operations, string nextPageLink) - { - return operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(this IBillingAccountsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs index 6792e2b31610..95f6a815db88 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs @@ -1,171 +1,141 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Serialization; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; /// /// Billing client provides access to billing resources for Azure /// subscriptions. /// - public partial class BillingManagementClient : ServiceClient, IBillingManagementClient, IAzureClient + public partial class BillingManagementClient : Microsoft.Rest.ServiceClient, IBillingManagementClient, IAzureClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } - /// /// Gets or sets json serialization settings. /// - public JsonSerializerSettings SerializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Credentials needed for the client to connect to Azure. /// - public ServiceClientCredentials Credentials { get; private set; } - - /// - /// The version of the API to be used with the client request. The current - /// version is 2020-05-01. - /// - public string ApiVersion { get; private set; } + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } /// /// The ID that uniquely identifies an Azure subscription. /// - public string SubscriptionId { get; set; } + public string SubscriptionId { get; set;} /// /// The preferred language for the response. /// - public string AcceptLanguage { get; set; } + public string AcceptLanguage { get; set;} /// - /// The retry timeout in seconds for Long Running Operations. Default value is - /// 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. /// - public int? LongRunningOperationRetryTimeout { get; set; } + public int? LongRunningOperationRetryTimeout { get; set;} /// - /// 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. + /// 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. /// - public bool? GenerateClientRequestId { get; set; } + public bool? GenerateClientRequestId { get; set;} /// - /// Gets the IBillingAccountsOperations. + /// Gets the IBillingAccountsOperations /// public virtual IBillingAccountsOperations BillingAccounts { get; private set; } - /// - /// Gets the IAddressOperations. + /// Gets the IAddressOperations /// public virtual IAddressOperations Address { get; private set; } - /// - /// Gets the IAvailableBalancesOperations. + /// Gets the IAvailableBalancesOperations /// public virtual IAvailableBalancesOperations AvailableBalances { get; private set; } - /// - /// Gets the IInstructionsOperations. + /// Gets the IInstructionsOperations /// public virtual IInstructionsOperations Instructions { get; private set; } - /// - /// Gets the IBillingProfilesOperations. + /// Gets the IBillingProfilesOperations /// public virtual IBillingProfilesOperations BillingProfiles { get; private set; } - /// - /// Gets the ICustomersOperations. + /// Gets the ICustomersOperations /// public virtual ICustomersOperations Customers { get; private set; } - /// - /// Gets the IInvoiceSectionsOperations. + /// Gets the IInvoiceSectionsOperations /// public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; } - /// - /// Gets the IBillingPermissionsOperations. + /// Gets the IBillingPermissionsOperations /// public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } - /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IBillingSubscriptionsOperations /// public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } - /// - /// Gets the IProductsOperations. + /// Gets the IProductsOperations /// public virtual IProductsOperations Products { get; private set; } - /// - /// Gets the IInvoicesOperations. + /// Gets the IInvoicesOperations /// public virtual IInvoicesOperations Invoices { get; private set; } - /// - /// Gets the ITransactionsOperations. + /// Gets the ITransactionsOperations /// public virtual ITransactionsOperations Transactions { get; private set; } - /// - /// Gets the IPoliciesOperations. + /// Gets the IPoliciesOperations /// public virtual IPoliciesOperations Policies { get; private set; } - /// - /// Gets the IBillingPropertyOperations. + /// Gets the IBillingPropertyOperations /// public virtual IBillingPropertyOperations BillingProperty { get; private set; } - /// - /// Gets the IOperations. + /// Gets the IOperations /// public virtual IOperations Operations { get; private set; } - /// - /// Gets the IBillingRoleDefinitionsOperations. + /// Gets the IBillingRoleDefinitionsOperations /// public virtual IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; private set; } - /// - /// Gets the IBillingRoleAssignmentsOperations. + /// Gets the IBillingRoleAssignmentsOperations /// public virtual IBillingRoleAssignmentsOperations BillingRoleAssignments { get; private set; } - /// - /// Gets the IAgreementsOperations. + /// Gets the IAgreementsOperations /// public virtual IAgreementsOperations Agreements { get; private set; } - + /// + /// Gets the IEnrollmentAccountsOperations + /// + public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } + /// + /// Gets the IBillingPeriodsOperations + /// + public virtual IBillingPeriodsOperations BillingPeriods { get; private set; } /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -174,24 +144,22 @@ public partial class BillingManagementClient : ServiceClient /// /// True: will dispose the provided httpClient on calling BillingManagementClient.Dispose(). False: will not dispose provided httpClient - protected BillingManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + protected BillingManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the BillingManagementClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected BillingManagementClient(params DelegatingHandler[] handlers) : base(handlers) + protected BillingManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) { - Initialize(); + this.Initialize(); } - /// - /// Initializes a new instance of the BillingManagementClient class. + /// Initializes a new instance of the BillingManagementClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -199,11 +167,10 @@ protected BillingManagementClient(params DelegatingHandler[] handlers) : base(ha /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected BillingManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected BillingManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -216,15 +183,14 @@ protected BillingManagementClient(HttpClientHandler rootHandler, params Delegati /// /// Thrown when a required parameter is null /// - protected BillingManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected BillingManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -240,15 +206,15 @@ protected BillingManagementClient(System.Uri baseUri, params DelegatingHandler[] /// /// Thrown when a required parameter is null /// - protected BillingManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected BillingManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -261,23 +227,23 @@ protected BillingManagementClient(System.Uri baseUri, HttpClientHandler rootHand /// /// Thrown when a required parameter is null /// - public BillingManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the BillingManagementClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -288,23 +254,23 @@ public BillingManagementClient(ServiceClientCredentials credentials, params Dele /// /// Thrown when a required parameter is null /// - public BillingManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the BillingManagementClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -316,26 +282,26 @@ public BillingManagementClient(ServiceClientCredentials credentials, HttpClient /// /// Thrown when a required parameter is null /// - public BillingManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the BillingManagementClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -344,7 +310,7 @@ public BillingManagementClient(ServiceClientCredentials credentials, HttpClientH /// /// Thrown when a required parameter is null /// - public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public BillingManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -354,33 +320,30 @@ public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials cred { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the BillingManagementClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// /// /// Thrown when a required parameter is null /// - public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public BillingManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -390,75 +353,77 @@ public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials cred { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); + /// /// Initializes client properties. /// private void Initialize() { - BillingAccounts = new BillingAccountsOperations(this); - Address = new AddressOperations(this); - AvailableBalances = new AvailableBalancesOperations(this); - Instructions = new InstructionsOperations(this); - BillingProfiles = new BillingProfilesOperations(this); - Customers = new CustomersOperations(this); - InvoiceSections = new InvoiceSectionsOperations(this); - BillingPermissions = new BillingPermissionsOperations(this); - BillingSubscriptions = new BillingSubscriptionsOperations(this); - Products = new ProductsOperations(this); - Invoices = new InvoicesOperations(this); - Transactions = new TransactionsOperations(this); - Policies = new PoliciesOperations(this); - BillingProperty = new BillingPropertyOperations(this); - Operations = new Operations(this); - BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); - BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); - Agreements = new AgreementsOperations(this); - BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-05-01"; - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings + this.BillingAccounts = new BillingAccountsOperations(this); + this.Address = new AddressOperations(this); + this.AvailableBalances = new AvailableBalancesOperations(this); + this.Instructions = new InstructionsOperations(this); + this.BillingProfiles = new BillingProfilesOperations(this); + this.Customers = new CustomersOperations(this); + this.InvoiceSections = new InvoiceSectionsOperations(this); + this.BillingPermissions = new BillingPermissionsOperations(this); + this.BillingSubscriptions = new BillingSubscriptionsOperations(this); + this.Products = new ProductsOperations(this); + this.Invoices = new InvoicesOperations(this); + this.Transactions = new TransactionsOperations(this); + this.Policies = new PoliciesOperations(this); + this.BillingProperty = new BillingPropertyOperations(this); + this.Operations = new Operations(this); + this.BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); + this.BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); + this.Agreements = new AgreementsOperations(this); + this.EnrollmentAccounts = new EnrollmentAccountsOperations(this); + this.BillingPeriods = new BillingPeriodsOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings = new JsonSerializerSettings + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; CustomInitialize(); - DeserializationSettings.Converters.Add(new TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs new file mode 100644 index 000000000000..f8409a2c5419 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs @@ -0,0 +1,650 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPeriodsOperations operations. + /// + internal partial class BillingPeriodsOperations : Microsoft.Rest.IServiceOperations, IBillingPeriodsOperations + { + /// + /// Initializes a new instance of the BillingPeriodsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPeriodsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// 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'. + /// + /// + /// 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. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + + + if (top != null) + { + if (top > 100) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "top", 100); + } + if (top < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "top", 1); + } + } + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("top", top); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(top, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// 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. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingPeriodName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (billingPeriodName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingPeriodName"); + } + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingPeriodName", billingPeriodName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{billingPeriodName}", System.Uri.EscapeDataString(billingPeriodName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs new file mode 100644 index 000000000000..cc4ee512f7b1 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs @@ -0,0 +1,155 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for BillingPeriodsOperations + /// + public static partial class BillingPeriodsOperationsExtensions + { + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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'. + /// + /// + /// 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. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + public static Microsoft.Rest.Azure.IPage List(this IBillingPeriodsOperations operations, string filter = default(string), string skiptoken = default(string), int? top = default(int?)) + { + return ((IBillingPeriodsOperations)operations).ListAsync(filter, skiptoken, top).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// 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'. + /// + /// + /// 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. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBillingPeriodsOperations operations, string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, skiptoken, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a BillingPeriod resource. + /// + public static BillingPeriod Get(this IBillingPeriodsOperations operations, string billingPeriodName) + { + return ((IBillingPeriodsOperations)operations).GetAsync(billingPeriodName).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingPeriodsOperations operations, string billingPeriodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingPeriodName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBillingPeriodsOperations operations, string nextPageLink) + { + return ((IBillingPeriodsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBillingPeriodsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs index 69e92624c14a..f6f8957e98c4 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingPermissionsOperations operations. /// - internal partial class BillingPermissionsOperations : IServiceOperations, IBillingPermissionsOperations + internal partial class BillingPermissionsOperations : Microsoft.Rest.IServiceOperations, IBillingPermissionsOperations { /// /// Initializes a new instance of the BillingPermissionsOperations class. @@ -36,13 +24,13 @@ internal partial class BillingPermissionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingPermissionsOperations(BillingManagementClient client) + internal BillingPermissionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -52,7 +40,6 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// Lists the billing permissions the caller has for a customer. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -66,13 +53,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -81,66 +68,73 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -152,50 +146,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -205,9 +200,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -218,28 +214,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on a billing account. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -250,13 +249,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -265,60 +264,66 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -330,50 +335,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -383,9 +389,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -396,28 +403,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on an invoice section. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -434,13 +444,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -449,72 +459,80 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -526,50 +544,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -579,9 +598,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -592,28 +612,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on a billing profile. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -627,13 +650,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -642,66 +665,73 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -713,50 +743,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -766,9 +797,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -779,28 +811,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has for a customer. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -811,13 +846,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -826,51 +861,54 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -882,50 +920,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -935,9 +974,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -948,28 +988,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on a billing account. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -980,13 +1023,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -995,51 +1038,54 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1051,50 +1097,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1104,9 +1151,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1117,28 +1165,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on an invoice section. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1149,13 +1200,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1164,51 +1215,54 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionsNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionsNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1220,50 +1274,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1273,9 +1328,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1286,28 +1342,31 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the billing permissions the caller has on a billing profile. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1318,13 +1377,13 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1333,51 +1392,54 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1389,50 +1451,51 @@ internal BillingPermissionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1442,9 +1505,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1455,24 +1519,28 @@ internal BillingPermissionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs index 11e6740a5193..a7f469491752 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs @@ -1,337 +1,304 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingPermissionsOperations. + /// Extension methods for BillingPermissionsOperations /// public static partial class BillingPermissionsOperationsExtensions { - /// - /// Lists the billing permissions the caller has for a customer. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - public static IPage ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) - { - return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); - } + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) + { + return ((IBillingPermissionsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has for a customer. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingPermissionsOperations operations, string billingAccountName) + { + return ((IBillingPermissionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static IPage ListByBillingAccount(this IBillingPermissionsOperations operations, string billingAccountName) + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingPermissionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingPermissionsOperations)operations).ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IBillingPermissionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingPermissionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on an invoice section. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - public static IPage ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on an invoice section. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on a billing profile. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName) + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionsNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByInvoiceSectionsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has on a billing profile. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionsNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the billing permissions the caller has for a customer. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByCustomerNext(this IBillingPermissionsOperations operations, string nextPageLink) + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists the billing permissions the caller has for a customer. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the billing permissions the caller has on a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IBillingPermissionsOperations operations, string nextPageLink) - { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the billing permissions the caller has on a billing account. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the billing permissions the caller has on an invoice section. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceSectionsNext(this IBillingPermissionsOperations operations, string nextPageLink) - { - return operations.ListByInvoiceSectionsNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the billing permissions the caller has on an invoice section. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionsNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the billing permissions the caller has on a billing profile. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IBillingPermissionsOperations operations, string nextPageLink) - { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the billing permissions the caller has on a billing profile. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs index f0b4b805d750..71d33a45e258 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingProfilesOperations operations. /// - internal partial class BillingProfilesOperations : IServiceOperations, IBillingProfilesOperations + internal partial class BillingProfilesOperations : Microsoft.Rest.IServiceOperations, IBillingProfilesOperations { /// /// Initializes a new instance of the BillingProfilesOperations class. @@ -36,13 +24,13 @@ internal partial class BillingProfilesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingProfilesOperations(BillingManagementClient client) + internal BillingProfilesOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal BillingProfilesOperations(BillingManagementClient client) /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -68,13 +55,13 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,36 +70,44 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -123,25 +118,24 @@ internal BillingProfilesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -153,50 +147,51 @@ internal BillingProfilesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -206,9 +201,10 @@ internal BillingProfilesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -219,30 +215,33 @@ internal BillingProfilesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a billing profile by its ID. The operation is supported for billing /// accounts with agreement type Microsoft Customer Agreement or Microsoft /// Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -259,13 +258,13 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -274,42 +273,51 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -320,25 +328,24 @@ internal BillingProfilesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -350,50 +357,51 @@ internal BillingProfilesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -403,9 +411,10 @@ internal BillingProfilesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -416,25 +425,29 @@ internal BillingProfilesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Creates or updates a billing profile. The operation is supported for /// billing accounts with agreement type Microsoft Customer Agreement or @@ -450,16 +463,16 @@ internal BillingProfilesOperations(BillingManagementClient client) /// The new or updated billing profile. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -482,13 +495,13 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -497,75 +510,82 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (billingAccountName == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - if (billingProfileName == null) + if (parameters != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + parameters.Validate(); } - if (parameters == null) + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (parameters != null) + + if (billingProfileName == null) { - parameters.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -577,56 +597,57 @@ internal BillingProfilesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -636,9 +657,10 @@ internal BillingProfilesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -649,43 +671,46 @@ internal BillingProfilesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -696,13 +721,13 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -711,51 +736,54 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -767,50 +795,51 @@ internal BillingProfilesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -820,9 +849,10 @@ internal BillingProfilesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -833,24 +863,28 @@ internal BillingProfilesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs index c83e977d70be..02aa89243b84 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs @@ -1,263 +1,231 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingProfilesOperations. + /// Extension methods for BillingProfilesOperations /// public static partial class BillingProfilesOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the invoice sections. - /// - public static IPage ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) - { - return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// May be used to expand the invoice sections. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// May be used to expand the invoice sections. - /// - public static BillingProfile Get(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string)) - { - return operations.GetAsync(billingAccountName, billingProfileName, expand).GetAwaiter().GetResult(); - } - - /// - /// Gets a billing profile by its ID. The operation is supported for billing - /// accounts with agreement type Microsoft Customer Agreement or Microsoft - /// Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// May be used to expand the invoice sections. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IBillingProfilesOperations)operations).ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } - /// - /// Creates or updates a billing profile. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The new or updated billing profile. - /// - public static BillingProfile CreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + public static BillingProfile Get(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string)) + { + return ((IBillingProfilesOperations)operations).GetAsync(billingAccountName, billingProfileName, expand).GetAwaiter().GetResult(); + } - /// - /// Creates or updates a billing profile. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The new or updated billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, expand, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static BillingProfile CreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return ((IBillingProfilesOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } - /// - /// Creates or updates a billing profile. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The new or updated billing profile. - /// - public static BillingProfile BeginCreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static BillingProfile BeginCreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return ((IBillingProfilesOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } - /// - /// Creates or updates a billing profile. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The new or updated billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingProfilesOperations operations, string nextPageLink) + { + return ((IBillingProfilesOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IBillingProfilesOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingProfilesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IBillingProfilesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs index 60f4773dc9d0..217e08f6d83c 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingPropertyOperations operations. /// - internal partial class BillingPropertyOperations : IServiceOperations, IBillingPropertyOperations + internal partial class BillingPropertyOperations : Microsoft.Rest.IServiceOperations, IBillingPropertyOperations { /// /// Initializes a new instance of the BillingPropertyOperations class. @@ -36,13 +24,13 @@ internal partial class BillingPropertyOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingPropertyOperations(BillingManagementClient client) + internal BillingPropertyOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -53,7 +41,6 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// Get the billing properties for a subscription. This operation is not /// supported for billing accounts with agreement type Enterprise Agreement. - /// /// /// /// Headers that will be added to request. @@ -61,13 +48,13 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -76,59 +63,65 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ApiVersion == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -140,50 +133,51 @@ internal BillingPropertyOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -193,9 +187,10 @@ internal BillingPropertyOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -206,25 +201,29 @@ internal BillingPropertyOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the billing property of a subscription. Currently, cost center can /// be updated. The operation is supported only for billing accounts with @@ -239,13 +238,13 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -254,65 +253,71 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ApiVersion == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; BillingProperty parameters = new BillingProperty(); - if (costCenter != null) + if(costCenter != null) { parameters.CostCenter = costCenter; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -324,56 +329,57 @@ internal BillingPropertyOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -383,9 +389,10 @@ internal BillingPropertyOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -396,24 +403,28 @@ internal BillingPropertyOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs index c1495f26a1ac..456b786519e2 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs @@ -1,95 +1,76 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingPropertyOperations. + /// Extension methods for BillingPropertyOperations /// public static partial class BillingPropertyOperationsExtensions { - /// - /// Get the billing properties for a subscription. This operation is not - /// supported for billing accounts with agreement type Enterprise Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - public static BillingProperty Get(this IBillingPropertyOperations operations) - { - return operations.GetAsync().GetAwaiter().GetResult(); - } + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// The operations group for this extension method. + /// + public static BillingProperty Get(this IBillingPropertyOperations operations) + { + return ((IBillingPropertyOperations)operations).GetAsync().GetAwaiter().GetResult(); + } - /// - /// Get the billing properties for a subscription. This operation is not - /// supported for billing accounts with agreement type Enterprise Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBillingPropertyOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingPropertyOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + public static BillingProperty Update(this IBillingPropertyOperations operations, string costCenter = default(string)) + { + return ((IBillingPropertyOperations)operations).UpdateAsync(costCenter).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cost center applied to the subscription. - /// - public static BillingProperty Update(this IBillingPropertyOperations operations, string costCenter = default(string)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingPropertyOperations operations, string costCenter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(costCenter, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(costCenter).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cost center applied to the subscription. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IBillingPropertyOperations operations, string costCenter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(costCenter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs index 96b79c9460a9..71f970b97d1d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingRoleAssignmentsOperations operations. /// - internal partial class BillingRoleAssignmentsOperations : IServiceOperations, IBillingRoleAssignmentsOperations + internal partial class BillingRoleAssignmentsOperations : Microsoft.Rest.IServiceOperations, IBillingRoleAssignmentsOperations { /// /// Initializes a new instance of the BillingRoleAssignmentsOperations class. @@ -36,13 +24,13 @@ internal partial class BillingRoleAssignmentsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingRoleAssignmentsOperations(BillingManagementClient client) + internal BillingRoleAssignmentsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -68,13 +55,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,66 +70,73 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -154,50 +148,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -207,9 +202,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -220,25 +216,29 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a role assignment for the caller on a billing account. The /// operation is supported for billing accounts with agreement type Microsoft @@ -256,13 +256,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -271,66 +271,73 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -342,50 +349,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -395,9 +403,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -408,30 +417,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a role assignment for the caller on an invoice section. The operation /// is supported for billing accounts with agreement type Microsoft Customer /// Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -451,13 +463,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -466,78 +478,87 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -549,50 +570,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -602,9 +624,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -615,25 +638,29 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a role assignment for the caller on an invoice section. The /// operation is supported for billing accounts with agreement type Microsoft @@ -657,13 +684,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -672,78 +699,87 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -755,50 +791,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -808,9 +845,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -821,30 +859,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -861,13 +902,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -876,72 +917,80 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -953,50 +1002,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1006,9 +1056,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1019,25 +1070,29 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Deletes a role assignment for the caller on a billing profile. The /// operation is supported for billing accounts with agreement type Microsoft @@ -1058,13 +1113,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1073,72 +1128,80 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (billingRoleAssignmentName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1150,50 +1213,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1203,9 +1267,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1216,30 +1281,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1250,13 +1318,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1265,60 +1333,66 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1330,50 +1404,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1383,9 +1458,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1396,30 +1472,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the role assignments for the caller on an invoice section. The /// operation is supported for billing accounts with agreement type Microsoft /// Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1436,13 +1515,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1451,72 +1530,80 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1528,50 +1615,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1581,9 +1669,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1594,30 +1683,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the role assignments for the caller on a billing profile. The /// operation is supported for billing accounts with agreement type Microsoft /// Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1631,13 +1723,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1646,66 +1738,73 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1717,50 +1816,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1770,9 +1870,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1783,30 +1884,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1817,13 +1921,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1832,51 +1936,54 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1888,50 +1995,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1941,9 +2049,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1954,30 +2063,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the role assignments for the caller on an invoice section. The /// operation is supported for billing accounts with agreement type Microsoft /// Customer Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1988,13 +2100,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2003,51 +2115,54 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2059,50 +2174,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2112,9 +2228,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2125,30 +2242,33 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the role assignments for the caller on a billing profile. The /// operation is supported for billing accounts with agreement type Microsoft /// Customer Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2159,13 +2279,13 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2174,51 +2294,54 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2230,50 +2353,51 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2283,9 +2407,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2296,24 +2421,28 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs index 48c8e80f6279..56ed16eac072 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs @@ -1,589 +1,550 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingRoleAssignmentsOperations. + /// Extension methods for BillingRoleAssignmentsOperations /// public static partial class BillingRoleAssignmentsOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) - { - return operations.GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task GetByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - return operations.DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// Gets a role assignment for the caller on an invoice section. The operation - /// is supported for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// Gets a role assignment for the caller on an invoice section. The operation - /// is supported for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// Deletes a role assignment for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - return operations.DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } - /// - /// Deletes a role assignment for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - return operations.DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static IPage ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - public static IPage ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); - } - - /// - /// Lists the role assignments for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } - - /// - /// Lists the role assignments for the caller on a billing profile. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceSectionNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the role assignments for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the role assignments for the caller on a billing profile. The - /// operation is supported for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs index bf753c9e6b5c..81ad3b431df7 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingRoleDefinitionsOperations operations. /// - internal partial class BillingRoleDefinitionsOperations : IServiceOperations, IBillingRoleDefinitionsOperations + internal partial class BillingRoleDefinitionsOperations : Microsoft.Rest.IServiceOperations, IBillingRoleDefinitionsOperations { /// /// Initializes a new instance of the BillingRoleDefinitionsOperations class. @@ -36,13 +24,13 @@ internal partial class BillingRoleDefinitionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingRoleDefinitionsOperations(BillingManagementClient client) + internal BillingRoleDefinitionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -68,13 +55,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,66 +70,73 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingRoleDefinitionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -154,50 +148,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -207,9 +202,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -220,30 +216,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the definition for a role on an invoice section. The operation is /// supported only for billing accounts with agreement type Microsoft Customer /// Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -263,13 +262,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -278,78 +277,87 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + if (billingRoleDefinitionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -361,50 +369,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -414,9 +423,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -427,30 +437,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -467,13 +480,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -482,72 +495,80 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (billingRoleDefinitionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -559,50 +580,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -612,9 +634,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -625,30 +648,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -659,13 +685,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -674,60 +700,66 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -739,50 +771,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -792,9 +825,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -805,30 +839,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -845,13 +882,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -860,72 +897,80 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -937,50 +982,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -990,9 +1036,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1003,30 +1050,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1040,13 +1090,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1055,66 +1105,73 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1126,50 +1183,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1179,9 +1237,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1192,30 +1251,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1226,13 +1288,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1241,51 +1303,54 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1297,50 +1362,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1350,9 +1416,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1363,30 +1430,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1397,13 +1467,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1412,51 +1482,54 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1468,50 +1541,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1521,9 +1595,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1534,30 +1609,33 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1568,13 +1646,13 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1583,51 +1661,54 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1639,50 +1720,51 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1692,9 +1774,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1705,24 +1788,28 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs index 4191352dd36f..24b40eee97e3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs @@ -1,439 +1,403 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingRoleDefinitionsOperations. + /// Extension methods for BillingRoleDefinitionsOperations /// public static partial class BillingRoleDefinitionsOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) - { - return operations.GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - /// - /// The cancellation token. - /// - public static async Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) - { - return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); - } - - /// - /// Gets the definition for a role on an invoice section. The operation is - /// supported only for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - /// - /// The cancellation token. - /// - public static async Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) - { - return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies a role definition. - /// - /// - /// The cancellation token. - /// - public static async Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static IPage ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) - { - return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); - } + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - public static IPage ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IBillingRoleDefinitionsOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceSectionNext(this IBillingRoleDefinitionsOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) - { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs index 017230326095..3a603c24855c 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// BillingSubscriptionsOperations operations. /// - internal partial class BillingSubscriptionsOperations : IServiceOperations, IBillingSubscriptionsOperations + internal partial class BillingSubscriptionsOperations : Microsoft.Rest.IServiceOperations, IBillingSubscriptionsOperations { /// /// Initializes a new instance of the BillingSubscriptionsOperations class. @@ -36,13 +24,13 @@ internal partial class BillingSubscriptionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BillingSubscriptionsOperations(BillingManagementClient client) + internal BillingSubscriptionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -53,7 +41,6 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// Lists the subscriptions for a customer. The operation is supported only for /// billing accounts with agreement type Microsoft Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -67,13 +54,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -82,66 +69,73 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -153,50 +147,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -206,9 +201,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -219,30 +215,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the subscriptions for a billing account. The operation is supported /// for billing accounts with agreement type Microsoft Customer Agreement or /// Microsoft Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -253,13 +252,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -268,60 +267,66 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -333,50 +338,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -386,9 +392,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -399,30 +406,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -436,13 +446,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -451,66 +461,73 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -522,50 +539,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -575,9 +593,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -588,30 +607,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the subscriptions that are billed to an invoice section. The /// operation is supported only for billing accounts with agreement type /// Microsoft Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -628,13 +650,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -643,72 +665,80 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -720,50 +750,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -773,9 +804,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -786,30 +818,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a subscription by its ID. The operation is supported for billing /// accounts with agreement type Microsoft Customer Agreement and Microsoft /// Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -820,13 +855,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -835,65 +870,72 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (Client.ApiVersion == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -905,50 +947,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -958,9 +1001,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -971,25 +1015,29 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the properties of a billing subscription. Currently, cost center /// can be updated. The operation is supported only for billing accounts with @@ -1008,13 +1056,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1023,70 +1071,77 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (Client.SubscriptionId == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - if (Client.ApiVersion == null) + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (parameters == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1098,56 +1153,57 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1157,9 +1213,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1170,31 +1227,34 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Moves a subscription's charges to a new invoice section. The new invoice + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1203,23 +1263,22 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// The destination invoice section id. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Validates if a subscription's charges can be moved to a new invoice + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1233,13 +1292,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1248,75 +1307,78 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (destinationInvoiceSectionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "destinationInvoiceSectionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); - if (destinationInvoiceSectionId != null) + if(destinationInvoiceSectionId != null) { parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1328,56 +1390,57 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1387,9 +1450,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1400,31 +1464,34 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Moves a subscription's charges to a new invoice section. The new invoice + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1438,13 +1505,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1453,75 +1520,78 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (destinationInvoiceSectionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "destinationInvoiceSectionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + + string apiVersion = "2020-05-01"; TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); - if (destinationInvoiceSectionId != null) + if(destinationInvoiceSectionId != null) { parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginMove", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginMove", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1533,56 +1603,57 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1592,9 +1663,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1605,42 +1677,45 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the subscriptions for a customer. The operation is supported only for /// billing accounts with agreement type Microsoft Partner Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1651,13 +1726,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1666,51 +1741,54 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1722,50 +1800,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1775,9 +1854,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1788,30 +1868,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the subscriptions for a billing account. The operation is supported /// for billing accounts with agreement type Microsoft Customer Agreement or /// Microsoft Partner Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1822,13 +1905,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1837,51 +1920,54 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1893,50 +1979,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1946,9 +2033,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1959,30 +2047,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1993,13 +2084,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2008,51 +2099,54 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2064,50 +2158,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2117,9 +2212,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2130,30 +2226,33 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the subscriptions that are billed to an invoice section. The /// operation is supported only for billing accounts with agreement type /// Microsoft Customer Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2164,13 +2263,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2179,51 +2278,54 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2235,50 +2337,51 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2288,9 +2391,10 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2301,24 +2405,28 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs index a1527cd534ec..cd0363f7f05f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -1,593 +1,521 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for BillingSubscriptionsOperations. + /// Extension methods for BillingSubscriptionsOperations /// public static partial class BillingSubscriptionsOperationsExtensions { - /// - /// Lists the subscriptions for a customer. The operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - public static IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) - { - return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); - } - - /// - /// Lists the subscriptions for a customer. The operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) - { - return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); - } - - /// - /// Lists the subscriptions for a billing account. The operation is supported - /// for billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - public static IPage ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); - } - - /// - /// Lists the subscriptions that are billed to an invoice section. The - /// operation is supported only for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a subscription by its ID. The operation is supported for billing - /// accounts with agreement type Microsoft Customer Agreement and Microsoft - /// Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName) - { - return operations.GetAsync(billingAccountName).GetAwaiter().GetResult(); - } - - /// - /// Gets a subscription by its ID. The operation is supported for billing - /// accounts with agreement type Microsoft Customer Agreement and Microsoft - /// Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) + { + return ((IBillingSubscriptionsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing subscription - /// operation. - /// - public static BillingSubscription Update(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters) + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Request parameters that are provided to the update billing subscription - /// operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - return operations.MoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingSubscriptionsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - /// - /// The cancellation token. - /// - public static async Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return ((IBillingSubscriptionsOperations)operations).GetAsync(billingAccountName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ValidateMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Update(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters) + { + return ((IBillingSubscriptionsOperations)operations).UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - /// - /// The cancellation token. - /// - public static async Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return ((IBillingSubscriptionsOperations)operations).MoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return ((IBillingSubscriptionsOperations)operations).ValidateMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The destination invoice section id. - /// - /// - /// The cancellation token. - /// - public static async Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + { + return ((IBillingSubscriptionsOperations)operations).BeginMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } - /// - /// Lists the subscriptions for a customer. The operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the subscriptions for a customer. The operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the subscriptions for a billing account. The operation is supported - /// for billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the subscriptions for a billing account. The operation is supported - /// for billing accounts with agreement type Microsoft Customer Agreement or - /// Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IBillingSubscriptionsOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceSectionNext(this IBillingSubscriptionsOperations operations, string nextPageLink) - { - return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the subscriptions that are billed to an invoice section. The - /// operation is supported only for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs index 5469cab8ec66..cebe2432f220 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// CustomersOperations operations. /// - internal partial class CustomersOperations : IServiceOperations, ICustomersOperations + internal partial class CustomersOperations : Microsoft.Rest.IServiceOperations, ICustomersOperations { /// /// Initializes a new instance of the CustomersOperations class. @@ -36,13 +24,13 @@ internal partial class CustomersOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal CustomersOperations(BillingManagementClient client) + internal CustomersOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal CustomersOperations(BillingManagementClient client) /// Lists the customers that are billed to a billing profile. The operation is /// supported only for billing accounts with agreement type Microsoft Partner /// Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -75,13 +62,13 @@ internal CustomersOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -90,43 +77,53 @@ internal CustomersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("search", search); tracingParameters.Add("filter", filter); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (search != null) { @@ -141,25 +138,24 @@ internal CustomersOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -171,50 +167,51 @@ internal CustomersOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -224,9 +221,10 @@ internal CustomersOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -237,30 +235,33 @@ internal CustomersOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the customers that are billed to a billing account. The operation is /// supported only for billing accounts with agreement type Microsoft Partner /// Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -278,13 +279,13 @@ internal CustomersOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -293,37 +294,46 @@ internal CustomersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("search", search); tracingParameters.Add("filter", filter); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (search != null) { @@ -338,25 +348,24 @@ internal CustomersOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -368,50 +377,51 @@ internal CustomersOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -421,9 +431,10 @@ internal CustomersOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -434,29 +445,32 @@ internal CustomersOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a customer by its ID. The operation is supported only for billing /// accounts with agreement type Microsoft Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -473,13 +487,13 @@ internal CustomersOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -488,42 +502,51 @@ internal CustomersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); tracingParameters.Add("expand", expand); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (expand != null) { @@ -534,25 +557,24 @@ internal CustomersOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -564,50 +586,51 @@ internal CustomersOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -617,9 +640,10 @@ internal CustomersOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -630,30 +654,33 @@ internal CustomersOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the customers that are billed to a billing profile. The operation is /// supported only for billing accounts with agreement type Microsoft Partner /// Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -664,13 +691,13 @@ internal CustomersOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -679,51 +706,54 @@ internal CustomersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -735,50 +765,51 @@ internal CustomersOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -788,9 +819,10 @@ internal CustomersOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -801,30 +833,33 @@ internal CustomersOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the customers that are billed to a billing account. The operation is /// supported only for billing accounts with agreement type Microsoft Partner /// Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -835,13 +870,13 @@ internal CustomersOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -850,51 +885,54 @@ internal CustomersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -906,50 +944,51 @@ internal CustomersOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -959,9 +998,10 @@ internal CustomersOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -972,24 +1012,28 @@ internal CustomersOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs index feace61fe227..452aebfb8362 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs @@ -1,269 +1,245 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for CustomersOperations. + /// Extension methods for CustomersOperations /// public static partial class CustomersOperationsExtensions { - /// - /// Lists the customers that are billed to a billing profile. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Used for searching customers by their name. Any customer with name - /// containing the search text will be included in the response - /// - /// - /// May be used to filter the list of customers. - /// - public static IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string)) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, search, filter).GetAwaiter().GetResult(); - } - - /// - /// Lists the customers that are billed to a billing profile. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Used for searching customers by their name. Any customer with name - /// containing the search text will be included in the response - /// - /// - /// May be used to filter the list of customers. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, search, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Used for searching customers by their name. Any customer with name - /// containing the search text will be included in the response - /// - /// - /// May be used to filter the list of customers. - /// - public static IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string)) - { - return operations.ListByBillingAccountAsync(billingAccountName, search, filter).GetAwaiter().GetResult(); - } - - /// - /// Lists the customers that are billed to a billing account. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// Used for searching customers by their name. Any customer with name - /// containing the search text will be included in the response - /// - /// - /// May be used to filter the list of customers. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, search, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string)) + { + return ((ICustomersOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, search, filter).GetAwaiter().GetResult(); + } - /// - /// Gets a customer by its ID. The operation is supported only for billing - /// accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// May be used to expand enabledAzurePlans and resellers - /// - public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, search, filter, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string)) + { + return ((ICustomersOperations)operations).ListByBillingAccountAsync(billingAccountName, search, filter).GetAwaiter().GetResult(); + } - /// - /// Gets a customer by its ID. The operation is supported only for billing - /// accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// May be used to expand enabledAzurePlans and resellers - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, search, filter, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + { + return ((ICustomersOperations)operations).GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + } - /// - /// Lists the customers that are billed to a billing profile. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + { + return ((ICustomersOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the customers that are billed to a billing profile. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this ICustomersOperations operations, string nextPageLink) + { + return ((ICustomersOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the customers that are billed to a billing account. The operation is - /// supported only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this ICustomersOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs new file mode 100644 index 000000000000..6d7e060fddac --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs @@ -0,0 +1,587 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// EnrollmentAccountsOperations operations. + /// + internal partial class EnrollmentAccountsOperations : Microsoft.Rest.IServiceOperations, IEnrollmentAccountsOperations + { + /// + /// Initializes a new instance of the EnrollmentAccountsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnrollmentAccountsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a enrollment account by name. + /// + /// + /// Enrollment Account name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs new file mode 100644 index 000000000000..53f005d9edd5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for EnrollmentAccountsOperations + /// + public static partial class EnrollmentAccountsOperationsExtensions + { + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IEnrollmentAccountsOperations operations) + { + return ((IEnrollmentAccountsOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IEnrollmentAccountsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a enrollment account by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Enrollment Account name. + /// + public static EnrollmentAccountSummary Get(this IEnrollmentAccountsOperations operations, string name) + { + return ((IEnrollmentAccountsOperations)operations).GetAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Gets a enrollment account by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Enrollment Account name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IEnrollmentAccountsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IEnrollmentAccountsOperations operations, string nextPageLink) + { + return ((IEnrollmentAccountsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IEnrollmentAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs index bdce96e8c9b8..f342356b39a5 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// AddressOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IAddressOperations { /// - /// Validates an address. Use the operation to validate an address - /// before using it as soldTo or a billTo address. - /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. /// + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// /// + /// /// /// /// The headers that will be added to request. @@ -36,15 +30,13 @@ public partial interface IAddressOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ValidateWithHttpMessagesAsync(AddressDetails address, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs index cc4316dacee9..9fc82a9cb1ac 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// AgreementsOperations operations. @@ -25,8 +15,10 @@ public partial interface IAgreementsOperations { /// /// Lists the agreements for a billing account. - /// /// + /// + /// Lists the agreements for a billing account. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -39,20 +31,20 @@ public partial interface IAgreementsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets an agreement by ID. - /// /// + /// + /// Gets an agreement by ID. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -68,20 +60,20 @@ public partial interface IAgreementsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the agreements for a billing account. - /// /// + /// + /// Lists the agreements for a billing account. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -91,15 +83,13 @@ public partial interface IAgreementsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs index 4bb7400fb5b3..0994578947ba 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// AvailableBalancesOperations operations. @@ -24,12 +14,17 @@ namespace Microsoft.Azure.Management.Billing public partial interface IAvailableBalancesOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -42,15 +37,13 @@ public partial interface IAvailableBalancesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs index b20fbe01ba4e..d198a1a10dd7 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingAccountsOperations operations. @@ -25,11 +15,12 @@ public partial interface IBillingAccountsOperations { /// /// Lists the billing accounts that a user has access to. - /// /// + /// + /// Lists the billing accounts that a user has access to. + /// /// - /// May be used to expand the soldTo, invoice sections and billing - /// profiles. + /// May be used to expand the soldTo, invoice sections and billing profiles. /// /// /// The headers that will be added to request. @@ -37,26 +28,25 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets a billing account by its ID. - /// /// + /// + /// Gets a billing account by its ID. + /// /// /// The ID that uniquely identifies a billing account. /// /// - /// May be used to expand the soldTo, invoice sections and billing - /// profiles. + /// May be used to expand the soldTo, invoice sections and billing profiles. /// /// /// The headers that will be added to request. @@ -64,21 +54,24 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -92,22 +85,24 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -117,21 +112,24 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -145,20 +143,20 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing accounts that a user has access to. - /// /// + /// + /// Lists the billing accounts that a user has access to. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -168,22 +166,24 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -193,15 +193,13 @@ public partial interface IBillingAccountsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs index 03374ac78766..57b24aab88ef 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs @@ -1,25 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; /// /// Billing client provides access to billing resources for Azure - /// subscriptions. + /// subscriptions. /// - public partial interface IBillingManagementClient : System.IDisposable + public partial interface IBillingManagementClient : System.IDisposable { /// /// The base URI of the service. @@ -29,137 +23,145 @@ public partial interface IBillingManagementClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - JsonSerializerSettings SerializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - JsonSerializerSettings DeserializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - ServiceClientCredentials Credentials { get; } + Microsoft.Rest.ServiceClientCredentials Credentials { get;} - /// - /// The version of the API to be used with the client request. The - /// current version is 2020-05-01. - /// - string ApiVersion { get; } /// /// The ID that uniquely identifies an Azure subscription. /// - string SubscriptionId { get; set; } + string SubscriptionId { get; set;} + /// /// The preferred language for the response. /// - string AcceptLanguage { get; set; } + string AcceptLanguage { get; set;} + /// /// The retry timeout in seconds for Long Running Operations. Default - /// value is 30. + /// /// value is 30. /// - int? LongRunningOperationRetryTimeout { get; set; } + int? LongRunningOperationRetryTimeout { get; set;} + /// /// 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. + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. /// - bool? GenerateClientRequestId { get; set; } + bool? GenerateClientRequestId { get; set;} /// - /// Gets the IBillingAccountsOperations. + /// Gets the IBillingAccountsOperations /// IBillingAccountsOperations BillingAccounts { get; } /// - /// Gets the IAddressOperations. + /// Gets the IAddressOperations /// IAddressOperations Address { get; } /// - /// Gets the IAvailableBalancesOperations. + /// Gets the IAvailableBalancesOperations /// IAvailableBalancesOperations AvailableBalances { get; } /// - /// Gets the IInstructionsOperations. + /// Gets the IInstructionsOperations /// IInstructionsOperations Instructions { get; } /// - /// Gets the IBillingProfilesOperations. + /// Gets the IBillingProfilesOperations /// IBillingProfilesOperations BillingProfiles { get; } /// - /// Gets the ICustomersOperations. + /// Gets the ICustomersOperations /// ICustomersOperations Customers { get; } /// - /// Gets the IInvoiceSectionsOperations. + /// Gets the IInvoiceSectionsOperations /// IInvoiceSectionsOperations InvoiceSections { get; } /// - /// Gets the IBillingPermissionsOperations. + /// Gets the IBillingPermissionsOperations /// IBillingPermissionsOperations BillingPermissions { get; } /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IBillingSubscriptionsOperations /// IBillingSubscriptionsOperations BillingSubscriptions { get; } /// - /// Gets the IProductsOperations. + /// Gets the IProductsOperations /// IProductsOperations Products { get; } /// - /// Gets the IInvoicesOperations. + /// Gets the IInvoicesOperations /// IInvoicesOperations Invoices { get; } /// - /// Gets the ITransactionsOperations. + /// Gets the ITransactionsOperations /// ITransactionsOperations Transactions { get; } /// - /// Gets the IPoliciesOperations. + /// Gets the IPoliciesOperations /// IPoliciesOperations Policies { get; } /// - /// Gets the IBillingPropertyOperations. + /// Gets the IBillingPropertyOperations /// IBillingPropertyOperations BillingProperty { get; } /// - /// Gets the IOperations. + /// Gets the IOperations /// IOperations Operations { get; } /// - /// Gets the IBillingRoleDefinitionsOperations. + /// Gets the IBillingRoleDefinitionsOperations /// IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; } /// - /// Gets the IBillingRoleAssignmentsOperations. + /// Gets the IBillingRoleAssignmentsOperations /// IBillingRoleAssignmentsOperations BillingRoleAssignments { get; } /// - /// Gets the IAgreementsOperations. + /// Gets the IAgreementsOperations /// IAgreementsOperations Agreements { get; } + /// + /// Gets the IEnrollmentAccountsOperations + /// + IEnrollmentAccountsOperations EnrollmentAccounts { get; } + + /// + /// Gets the IBillingPeriodsOperations + /// + IBillingPeriodsOperations BillingPeriods { get; } + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs new file mode 100644 index 000000000000..56ac242bf84d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs @@ -0,0 +1,114 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPeriodsOperations operations. + /// + public partial interface IBillingPeriodsOperations + { + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// 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'. + /// + /// + /// 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. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingPeriodName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs index 12dcf5666b33..187ccff3aa05 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingPermissionsOperations operations. @@ -25,8 +15,10 @@ public partial interface IBillingPermissionsOperations { /// /// Lists the billing permissions the caller has for a customer. - /// /// + /// + /// Lists the billing permissions the caller has for a customer. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -39,20 +31,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on a billing account. - /// /// + /// + /// Lists the billing permissions the caller has on a billing account. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -62,20 +54,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on an invoice section. - /// /// + /// + /// Lists the billing permissions the caller has on an invoice section. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -91,20 +83,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on a billing profile. - /// /// + /// + /// Lists the billing permissions the caller has on a billing profile. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -117,20 +109,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has for a customer. - /// /// + /// + /// Lists the billing permissions the caller has for a customer. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -140,20 +132,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on a billing account. - /// /// + /// + /// Lists the billing permissions the caller has on a billing account. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -163,20 +155,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on an invoice section. - /// /// + /// + /// Lists the billing permissions the caller has on an invoice section. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -186,20 +178,20 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the billing permissions the caller has on a billing profile. - /// /// + /// + /// Lists the billing permissions the caller has on a billing profile. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -209,15 +201,13 @@ public partial interface IBillingPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs index ebb48861f5f2..c68695a3a2a4 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingProfilesOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingProfilesOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,22 +35,24 @@ public partial interface IBillingProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a billing profile by its ID. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement - /// or Microsoft Partner Agreement. - /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. /// + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -72,21 +68,24 @@ public partial interface IBillingProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates or updates a billing profile. The operation is supported - /// for billing accounts with agreement type Microsoft Customer - /// Agreement or Microsoft Partner Agreement. + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. /// + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -102,21 +101,24 @@ public partial interface IBillingProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates or updates a billing profile. The operation is supported - /// for billing accounts with agreement type Microsoft Customer - /// Agreement or Microsoft Partner Agreement. + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. /// + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -132,22 +134,24 @@ public partial interface IBillingProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -157,15 +161,13 @@ public partial interface IBillingProfilesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs index b8cc5b1c212f..a33a9442a94d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingPropertyOperations operations. @@ -24,32 +14,37 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingPropertyOperations { /// - /// Get the billing properties for a subscription. This operation is - /// not supported for billing accounts with agreement type Enterprise - /// Agreement. - /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. /// + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. + /// 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. /// + /// + /// 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. + /// /// /// The cost center applied to the subscription. /// @@ -59,15 +54,13 @@ public partial interface IBillingPropertyOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs index 694bccf30013..3e053b42fc2a 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingRoleAssignmentsOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingRoleAssignmentsOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,21 +35,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -68,22 +65,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a role assignment for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. /// + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -102,21 +101,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Deletes a role assignment for the caller on an invoice section. The - /// operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. /// + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -135,22 +137,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -166,21 +170,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -196,22 +203,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -221,22 +230,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the role assignments for the caller on an invoice section. - /// The operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. /// + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -252,22 +263,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the role assignments for the caller on a billing profile. The - /// operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. /// + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -280,22 +293,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -305,22 +320,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the role assignments for the caller on an invoice section. - /// The operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. /// + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -330,22 +347,24 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the role assignments for the caller on a billing profile. The - /// operation is supported for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. /// + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -355,15 +374,13 @@ public partial interface IBillingRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs index 5e57e22c27af..df1c6a0af4bc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingRoleDefinitionsOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingRoleDefinitionsOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,22 +35,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets the definition for a role on an invoice section. The operation - /// is supported only for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. /// + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -75,22 +71,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -106,22 +104,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -131,22 +131,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -162,22 +164,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -190,22 +194,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -215,22 +221,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -240,22 +248,24 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// 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. - /// + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -265,15 +275,13 @@ public partial interface IBillingRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs index 5994c28e7d14..b2353ff249df 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// BillingSubscriptionsOperations operations. @@ -24,11 +14,13 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingSubscriptionsOperations { /// - /// Lists the subscriptions for a customer. The operation is supported - /// only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. /// + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,22 +33,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the subscriptions for a billing account. The operation is - /// supported for billing accounts with agreement type Microsoft - /// Customer Agreement or Microsoft Partner Agreement. - /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. /// + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -66,22 +60,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -94,22 +90,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the subscriptions that are billed to an invoice section. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Customer Agreement. - /// + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. /// + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -125,22 +123,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a subscription by its ID. The operation is supported for - /// billing accounts with agreement type Microsoft Customer Agreement - /// and Microsoft Partner Agreement. - /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. /// + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -150,27 +150,30 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// /// - /// Request parameters that are provided to the update billing - /// subscription operation. + /// Request parameters that are provided to the update billing subscription + /// operation. /// /// /// The headers that will be added to request. @@ -178,23 +181,26 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -207,22 +213,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -235,23 +243,26 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -264,22 +275,22 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the subscriptions for a customer. The operation is supported - /// only for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. /// + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -289,22 +300,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the subscriptions for a billing account. The operation is - /// supported for billing accounts with agreement type Microsoft - /// Customer Agreement or Microsoft Partner Agreement. - /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. /// + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -314,22 +327,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -339,22 +354,24 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the subscriptions that are billed to an invoice section. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Customer Agreement. - /// + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. /// + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -364,15 +381,13 @@ public partial interface IBillingSubscriptionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs index a35aebad63e1..7c1effa82d06 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// CustomersOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface ICustomersOperations { /// - /// Lists the customers that are billed to a billing profile. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Partner Agreement. - /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. /// + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -48,22 +42,24 @@ public partial interface ICustomersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the customers that are billed to a billing account. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Partner Agreement. - /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. /// + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -80,21 +76,22 @@ public partial interface ICustomersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a customer by its ID. The operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. /// + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -110,22 +107,24 @@ public partial interface ICustomersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the customers that are billed to a billing profile. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Partner Agreement. - /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. /// + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -135,22 +134,24 @@ public partial interface ICustomersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the customers that are billed to a billing account. The - /// operation is supported only for billing accounts with agreement - /// type Microsoft Partner Agreement. - /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. /// + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -160,15 +161,13 @@ public partial interface ICustomersOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs new file mode 100644 index 000000000000..42f80bd6d16e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// EnrollmentAccountsOperations operations. + /// + public partial interface IEnrollmentAccountsOperations + { + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a enrollment account by name. + /// + /// + /// Gets a enrollment account by name. + /// + /// + /// Enrollment Account name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs index 6f1f8810d35e..bb112f5336a2 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// InstructionsOperations operations. @@ -25,8 +15,10 @@ public partial interface IInstructionsOperations { /// /// Lists the instructions by billing profile id. - /// /// + /// + /// Lists the instructions by billing profile id. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -39,21 +31,22 @@ public partial interface IInstructionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get the instruction by name. These are custom billing instructions - /// and are only applicable for certain customers. - /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. /// + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -69,20 +62,22 @@ public partial interface IInstructionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates or updates an instruction. These are custom billing - /// instructions and are only applicable for certain customers. + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. /// + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -101,20 +96,20 @@ public partial interface IInstructionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the instructions by billing profile id. - /// /// + /// + /// Lists the instructions by billing profile id. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -124,15 +119,13 @@ public partial interface IInstructionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs index 2c31ee4b50ca..ce2d3e0e20a3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// InvoiceSectionsOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IInvoiceSectionsOperations { /// - /// Lists the invoice sections that a user has access to. The operation - /// is supported only for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. /// + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,22 +35,22 @@ public partial interface IInvoiceSectionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets an invoice section by its ID. The operation is supported only - /// for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. /// + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -72,21 +66,22 @@ public partial interface IInvoiceSectionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates or updates an invoice section. The operation is supported - /// only for billing accounts with agreement type Microsoft Customer - /// Agreement. + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. /// + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -108,21 +103,22 @@ public partial interface IInvoiceSectionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Creates or updates an invoice section. The operation is supported - /// only for billing accounts with agreement type Microsoft Customer - /// Agreement. + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. /// + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -144,22 +140,24 @@ public partial interface IInvoiceSectionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the invoice sections that a user has access to. The operation - /// is supported only for billing accounts with agreement type - /// Microsoft Customer Agreement. - /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. /// + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -169,15 +167,13 @@ public partial interface IInvoiceSectionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs index f5e65474be40..9a557b28134d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// InvoicesOperations operations. @@ -24,18 +14,21 @@ namespace Microsoft.Azure.Management.Billing public partial interface IInvoicesOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// /// - /// The start date to fetch the invoices. The date should be specified - /// in MM-DD-YYYY format. + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. /// /// /// The end date to fetch the invoices. The date should be specified in @@ -47,23 +40,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -71,8 +65,8 @@ public partial interface IInvoicesOperations /// The ID that uniquely identifies a billing profile. /// /// - /// The start date to fetch the invoices. The date should be specified - /// in MM-DD-YYYY format. + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. /// /// /// The end date to fetch the invoices. The date should be specified in @@ -84,22 +78,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -112,22 +108,22 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets an invoice by ID. The operation is supported for billing - /// accounts with agreement type Microsoft Partner Agreement or - /// Microsoft Customer Agreement. - /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies an invoice. /// @@ -137,22 +133,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a URL to download an invoice. The operation is supported for - /// billing accounts with agreement type Microsoft Partner Agreement or - /// Microsoft Customer Agreement. - /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. /// + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -168,20 +166,20 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the invoices for a subscription. - /// /// + /// + /// Lists the invoices for a subscription. + /// /// /// Invoice period start date. /// @@ -194,20 +192,20 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets an invoice by subscription ID and invoice ID. - /// /// + /// + /// Gets an invoice by subscription ID and invoice ID. + /// /// /// The ID that uniquely identifies an invoice. /// @@ -217,20 +215,20 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets a URL to download an invoice. - /// /// + /// + /// Gets a URL to download an invoice. + /// /// /// The ID that uniquely identifies an invoice. /// @@ -243,22 +241,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a URL to download an invoice. The operation is supported for - /// billing accounts with agreement type Microsoft Partner Agreement or - /// Microsoft Customer Agreement. - /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. /// + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -274,20 +274,20 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Gets a URL to download an invoice. - /// /// + /// + /// Gets a URL to download an invoice. + /// /// /// The ID that uniquely identifies an invoice. /// @@ -300,23 +300,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -326,23 +327,24 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -352,20 +354,20 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the invoices for a subscription. - /// /// + /// + /// Lists the invoices for a subscription. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -375,15 +377,13 @@ public partial interface IInvoicesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs index ecace1e9febc..f1d3f4feade8 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// Operations operations. @@ -25,28 +15,30 @@ public partial interface IOperations { /// /// Lists the available billing REST API operations. - /// /// + /// + /// Lists the available billing REST API operations. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists the available billing REST API operations. - /// /// + /// + /// Lists the available billing REST API operations. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -56,15 +48,13 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs index b0772a689ab0..98701444ff88 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// PoliciesOperations operations. @@ -24,11 +14,13 @@ namespace Microsoft.Azure.Management.Billing public partial interface IPoliciesOperations { /// - /// Lists the policies for a billing profile. This operation is - /// supported only for billing accounts with agreement type Microsoft - /// Customer Agreement. - /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. /// + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,21 +33,22 @@ public partial interface IPoliciesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates the policies for a billing profile. This operation is - /// supported only for billing accounts with agreement type Microsoft - /// Customer Agreement. + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. /// + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -63,8 +56,7 @@ public partial interface IPoliciesOperations /// The ID that uniquely identifies a billing profile. /// /// - /// Request parameters that are provided to the update policies - /// operation. + /// Request parameters that are provided to the update policies operation. /// /// /// The headers that will be added to request. @@ -72,22 +64,22 @@ public partial interface IPoliciesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the policies for a customer. This operation is supported only - /// for billing accounts with agreement type Microsoft Partner - /// Agreement. - /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. /// + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -100,21 +92,22 @@ public partial interface IPoliciesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Updates the policies for a customer. This operation is supported - /// only for billing accounts with agreement type Microsoft Partner - /// Agreement. + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. /// + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -122,9 +115,8 @@ public partial interface IPoliciesOperations /// The ID that uniquely identifies a customer. /// /// - /// 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' + /// The policy that controls whether the users in customer's organization can + /// view charges at pay-as-you-go prices. /// /// /// The headers that will be added to request. @@ -132,15 +124,13 @@ public partial interface IPoliciesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs index aa5cf73e8598..736c1fdb13c8 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// ProductsOperations operations. @@ -24,11 +14,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IProductsOperations { /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -41,31 +35,32 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// /// - /// 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 (:). + /// 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 (:). /// /// /// The headers that will be added to request. @@ -73,23 +68,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -97,10 +93,10 @@ public partial interface IProductsOperations /// The ID that uniquely identifies a billing profile. /// /// - /// 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 (:). + /// 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 (:). /// /// /// The headers that will be added to request. @@ -108,22 +104,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -134,10 +132,10 @@ public partial interface IProductsOperations /// The ID that uniquely identifies an invoice section. /// /// - /// 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 (:). + /// 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 (:). /// /// /// The headers that will be added to request. @@ -145,21 +143,22 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets a product by ID. The operation is supported only for billing - /// accounts with agreement type Microsoft Customer Agreement. - /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. /// + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -172,21 +171,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -194,8 +196,7 @@ public partial interface IProductsOperations /// The ID that uniquely identifies a product. /// /// - /// Request parameters that are provided to the update product - /// operation. + /// Request parameters that are provided to the update product operation. /// /// /// The headers that will be added to request. @@ -203,24 +204,28 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -236,23 +241,26 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -268,22 +276,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -293,23 +303,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -319,23 +330,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -345,22 +357,24 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. - /// + /// 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. /// + /// + /// 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. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -370,15 +384,13 @@ public partial interface IProductsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs index 4f8e8eff7811..e5511f4f6166 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// /// TransactionsOperations operations. @@ -24,10 +14,13 @@ namespace Microsoft.Azure.Management.Billing public partial interface ITransactionsOperations { /// - /// Lists the transactions for an invoice. Transactions include - /// purchases, refunds and Azure usage charges. - /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. /// + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// /// /// The ID that uniquely identifies a billing account. /// @@ -40,21 +33,22 @@ public partial interface ITransactionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Lists the transactions for an invoice. Transactions include - /// purchases, refunds and Azure usage charges. - /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. /// + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -64,15 +58,13 @@ public partial interface ITransactionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs index 8d35a98a3884..4901a73d7b7b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// InstructionsOperations operations. /// - internal partial class InstructionsOperations : IServiceOperations, IInstructionsOperations + internal partial class InstructionsOperations : Microsoft.Rest.IServiceOperations, IInstructionsOperations { /// /// Initializes a new instance of the InstructionsOperations class. @@ -36,13 +24,13 @@ internal partial class InstructionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal InstructionsOperations(BillingManagementClient client) + internal InstructionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -52,7 +40,6 @@ internal InstructionsOperations(BillingManagementClient client) /// /// Lists the instructions by billing profile id. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -66,13 +53,13 @@ internal InstructionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -81,66 +68,73 @@ internal InstructionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -152,50 +146,51 @@ internal InstructionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -205,9 +200,10 @@ internal InstructionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -218,29 +214,32 @@ internal InstructionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get the instruction by name. These are custom billing instructions and are /// only applicable for certain customers. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -257,13 +256,13 @@ internal InstructionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -272,72 +271,80 @@ internal InstructionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (instructionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "instructionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "instructionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("instructionName", instructionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -349,50 +356,51 @@ internal InstructionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -402,9 +410,10 @@ internal InstructionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -415,25 +424,29 @@ internal InstructionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Creates or updates an instruction. These are custom billing instructions /// and are only applicable for certain customers. @@ -456,13 +469,13 @@ internal InstructionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -471,81 +484,86 @@ internal InstructionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (instructionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "instructionName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "instructionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("instructionName", instructionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -557,56 +575,57 @@ internal InstructionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -616,9 +635,10 @@ internal InstructionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -629,28 +649,31 @@ internal InstructionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the instructions by billing profile id. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -661,13 +684,13 @@ internal InstructionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -676,51 +699,54 @@ internal InstructionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -732,50 +758,51 @@ internal InstructionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -785,9 +812,10 @@ internal InstructionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -798,24 +826,28 @@ internal InstructionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs index 449f73587cc0..3cda8a3d522e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs @@ -1,207 +1,182 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for InstructionsOperations. + /// Extension methods for InstructionsOperations /// public static partial class InstructionsOperationsExtensions { - /// - /// Lists the instructions by billing profile id. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IInstructionsOperations operations, string billingAccountName, string billingProfileName) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInstructionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IInstructionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// Lists the instructions by billing profile id. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + public static Instruction Get(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName) + { + return ((IInstructionsOperations)operations).GetAsync(billingAccountName, billingProfileName, instructionName).GetAwaiter().GetResult(); + } - /// - /// Get the instruction by name. These are custom billing instructions and are - /// only applicable for certain customers. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Instruction Name. - /// - public static Instruction Get(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName) + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(billingAccountName, billingProfileName, instructionName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + public static Instruction Put(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters) + { + return ((IInstructionsOperations)operations).PutAsync(billingAccountName, billingProfileName, instructionName, parameters).GetAwaiter().GetResult(); + } - /// - /// Get the instruction by name. These are custom billing instructions and are - /// only applicable for certain customers. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Instruction Name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task PutAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInstructionsOperations operations, string nextPageLink) + { + return ((IInstructionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an instruction. These are custom billing instructions - /// and are only applicable for certain customers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Instruction Name. - /// - /// - /// The new instruction. - /// - public static Instruction Put(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters) + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInstructionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.PutAsync(billingAccountName, billingProfileName, instructionName, parameters).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Creates or updates an instruction. These are custom billing instructions - /// and are only applicable for certain customers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Instruction Name. - /// - /// - /// The new instruction. - /// - /// - /// The cancellation token. - /// - public static async Task PutAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PutWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the instructions by billing profile id. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IInstructionsOperations operations, string nextPageLink) - { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the instructions by billing profile id. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IInstructionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs index 3000576e7780..a97fe811c0ab 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// InvoiceSectionsOperations operations. /// - internal partial class InvoiceSectionsOperations : IServiceOperations, IInvoiceSectionsOperations + internal partial class InvoiceSectionsOperations : Microsoft.Rest.IServiceOperations, IInvoiceSectionsOperations { /// /// Initializes a new instance of the InvoiceSectionsOperations class. @@ -36,13 +24,13 @@ internal partial class InvoiceSectionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal InvoiceSectionsOperations(BillingManagementClient client) + internal InvoiceSectionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// Lists the invoice sections that a user has access to. The operation is /// supported only for billing accounts with agreement type Microsoft Customer /// Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -68,13 +55,13 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,66 +70,73 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -154,50 +148,51 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -207,9 +202,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -220,29 +216,32 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets an invoice section by its ID. The operation is supported only for /// billing accounts with agreement type Microsoft Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -259,13 +258,13 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -274,72 +273,80 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -351,50 +358,51 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -404,9 +412,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -417,25 +426,29 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Creates or updates an invoice section. The operation is supported only for /// billing accounts with agreement type Microsoft Customer Agreement. @@ -456,16 +469,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// Dictionary of metadata associated with the invoice section. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -493,13 +506,13 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -508,79 +521,87 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + string apiVersion = "2020-05-01"; InvoiceSection parameters = new InvoiceSection(); - if (displayName != null || labels != null) + if(displayName != null||labels != null) { parameters.DisplayName = displayName; parameters.Labels = labels; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -592,56 +613,57 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -651,9 +673,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -664,43 +687,46 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the invoice sections that a user has access to. The operation is /// supported only for billing accounts with agreement type Microsoft Customer /// Agreement. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -711,13 +737,13 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -726,51 +752,54 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -782,50 +811,51 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -835,9 +865,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -848,24 +879,28 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs index f737203cbeb1..ae03f551ad12 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs @@ -1,283 +1,237 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for InvoiceSectionsOperations. + /// Extension methods for InvoiceSectionsOperations /// public static partial class InvoiceSectionsOperationsExtensions { - /// - /// Lists the invoice sections that a user has access to. The operation is - /// supported only for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static IPage ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } - - /// - /// Lists the invoice sections that a user has access to. The operation is - /// supported only for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets an invoice section by its ID. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) - { - return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); - } - - /// - /// Gets an invoice section by its ID. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IInvoiceSectionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an invoice section. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. - /// - public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary)) + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - return operations.CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IInvoiceSectionsOperations)operations).GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an invoice section. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary)) + { + return ((IInvoiceSectionsOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an invoice section. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. - /// - public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary)) + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary)) + { + return ((IInvoiceSectionsOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + } - /// - /// Creates or updates an invoice section. The operation is supported only for - /// billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), IDictionary labels = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInvoiceSectionsOperations operations, string nextPageLink) + { + return ((IInvoiceSectionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the invoice sections that a user has access to. The operation is - /// supported only for billing accounts with agreement type Microsoft Customer - /// Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IInvoiceSectionsOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInvoiceSectionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IInvoiceSectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs index 23bb29215f1d..a8d87658d0e8 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// InvoicesOperations operations. /// - internal partial class InvoicesOperations : IServiceOperations, IInvoicesOperations + internal partial class InvoicesOperations : Microsoft.Rest.IServiceOperations, IInvoicesOperations { /// /// Initializes a new instance of the InvoicesOperations class. @@ -36,13 +24,13 @@ internal partial class InvoicesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal InvoicesOperations(BillingManagementClient client) + internal InvoicesOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -54,7 +42,6 @@ internal InvoicesOperations(BillingManagementClient client) /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -73,13 +60,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -88,45 +75,54 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (periodStartDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); } + if (periodEndDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("periodStartDate", periodStartDate); tracingParameters.Add("periodEndDate", periodEndDate); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (periodStartDate != null) { @@ -141,25 +137,24 @@ internal InvoicesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -171,50 +166,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -224,9 +220,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -237,30 +234,33 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -282,13 +282,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -297,51 +297,61 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (periodStartDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); } + if (periodEndDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("periodStartDate", periodStartDate); tracingParameters.Add("periodEndDate", periodEndDate); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (periodStartDate != null) { @@ -356,25 +366,24 @@ internal InvoicesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -386,50 +395,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -439,9 +449,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -452,30 +463,33 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -489,13 +503,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -504,66 +518,73 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("invoiceName", invoiceName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -575,50 +596,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -628,9 +650,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -641,29 +664,32 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets an invoice by ID. The operation is supported for billing accounts with /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// /// /// /// The ID that uniquely identifies an invoice. @@ -674,13 +700,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -689,60 +715,66 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("invoiceName", invoiceName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}").ToString(); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -754,50 +786,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -807,9 +840,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -820,30 +854,33 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a URL to download an invoice. The operation is supported for billing /// accounts with agreement type Microsoft Partner Agreement or Microsoft /// Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -855,21 +892,20 @@ internal InvoicesOperations(BillingManagementClient client) /// Download token with document source and document ID. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Lists the invoices for a subscription. - /// /// /// /// Invoice period start date. @@ -883,13 +919,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -898,41 +934,50 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (periodStartDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodStartDate"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); } + if (periodEndDate == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "periodEndDate"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("periodStartDate", periodStartDate); tracingParameters.Add("periodEndDate", periodEndDate); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (periodStartDate != null) { _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); @@ -941,34 +986,33 @@ internal InvoicesOperations(BillingManagementClient client) { _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -980,50 +1024,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1033,9 +1078,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1046,28 +1092,31 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets an invoice by subscription ID and invoice ID. - /// /// /// /// The ID that uniquely identifies an invoice. @@ -1078,13 +1127,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1093,65 +1142,72 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetBySubscriptionAndInvoiceId", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetBySubscriptionAndInvoiceId", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1163,50 +1219,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1216,9 +1273,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1229,28 +1287,31 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a URL to download an invoice. - /// /// /// /// The ID that uniquely identifies an invoice. @@ -1259,23 +1320,22 @@ internal InvoicesOperations(BillingManagementClient client) /// Download token with document source and document ID. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Gets a URL to download an invoice. The operation is supported for billing /// accounts with agreement type Microsoft Partner Agreement or Microsoft /// Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1292,13 +1352,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1307,46 +1367,55 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + if (downloadToken == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "downloadToken"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "downloadToken"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("invoiceName", invoiceName); tracingParameters.Add("downloadToken", downloadToken); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadInvoice", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadInvoice", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (downloadToken != null) { @@ -1357,25 +1426,24 @@ internal InvoicesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1387,50 +1455,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1440,9 +1509,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1453,41 +1523,44 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a URL to download an invoice. - /// /// /// /// The ID that uniquely identifies an invoice. @@ -1501,13 +1574,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1516,45 +1589,54 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + if (downloadToken == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "downloadToken"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "downloadToken"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("invoiceName", invoiceName); tracingParameters.Add("downloadToken", downloadToken); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadBillingSubscriptionInvoice", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadBillingSubscriptionInvoice", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (downloadToken != null) { @@ -1565,25 +1647,24 @@ internal InvoicesOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1595,50 +1676,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1648,9 +1730,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1661,43 +1744,46 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1708,13 +1794,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1723,51 +1809,54 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1779,50 +1868,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1832,9 +1922,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1845,30 +1936,33 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1879,13 +1973,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1894,51 +1988,54 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1950,50 +2047,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2003,9 +2101,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2016,28 +2115,31 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the invoices for a subscription. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2048,13 +2150,13 @@ internal InvoicesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2063,51 +2165,54 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscriptionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscriptionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2119,50 +2224,51 @@ internal InvoicesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2172,9 +2278,10 @@ internal InvoicesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2185,24 +2292,28 @@ internal InvoicesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs index 51e787b272ca..365810e84ae9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs @@ -1,609 +1,561 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for InvoicesOperations. + /// Extension methods for InvoicesOperations /// public static partial class InvoicesOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The start date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The end date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - public static IPage ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) - { - return operations.ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The start date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The end date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The start date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The end date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - public static IPage ListByBillingProfile(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) - { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The start date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The end date to fetch the invoices. The date should be specified in - /// MM-DD-YYYY format. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string invoiceName) - { - return operations.GetAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets an invoice by ID. The operation is supported for billing accounts with - /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - public static Invoice GetById(this IInvoicesOperations operations, string invoiceName) - { - return operations.GetByIdAsync(invoiceName).GetAwaiter().GetResult(); - } - - /// - /// Gets an invoice by ID. The operation is supported for billing accounts with - /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// The cancellation token. - /// - public static async Task GetByIdAsync(this IInvoicesOperations operations, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - public static DownloadUrl DownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) - { - return operations.DownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); - } - - /// - /// Gets a URL to download an invoice. The operation is supported for billing - /// accounts with agreement type Microsoft Partner Agreement or Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - /// - /// The cancellation token. - /// - public static async Task DownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } - /// - /// Lists the invoices for a subscription. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// Invoice period start date. - /// - /// - /// Invoice period end date. - /// - public static IPage ListByBillingSubscription(this IInvoicesOperations operations, string periodStartDate, string periodEndDate) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingSubscriptionAsync(periodStartDate, periodEndDate).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } - /// - /// Lists the invoices for a subscription. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// Invoice period start date. - /// - /// - /// Invoice period end date. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingSubscriptionAsync(this IInvoicesOperations operations, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingSubscriptionWithHttpMessagesAsync(periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string invoiceName) + { + return ((IInvoicesOperations)operations).GetAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } - /// - /// Gets an invoice by subscription ID and invoice ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - public static Invoice GetBySubscriptionAndInvoiceId(this IInvoicesOperations operations, string invoiceName) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetBySubscriptionAndInvoiceIdAsync(invoiceName).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetById(this IInvoicesOperations operations, string invoiceName) + { + return ((IInvoicesOperations)operations).GetByIdAsync(invoiceName).GetAwaiter().GetResult(); + } - /// - /// Gets an invoice by subscription ID and invoice ID. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// The cancellation token. - /// - public static async Task GetBySubscriptionAndInvoiceIdAsync(this IInvoicesOperations operations, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByIdAsync(this IInvoicesOperations operations, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).DownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - public static DownloadUrl DownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) { - return operations.DownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingSubscription(this IInvoicesOperations operations, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingSubscriptionAsync(periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - /// - /// The cancellation token. - /// - public static async Task DownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingSubscriptionAsync(this IInvoicesOperations operations, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionWithHttpMessagesAsync(periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetBySubscriptionAndInvoiceId(this IInvoicesOperations operations, string invoiceName) + { + return ((IInvoicesOperations)operations).GetBySubscriptionAndInvoiceIdAsync(invoiceName).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. The operation is supported for billing - /// accounts with agreement type Microsoft Partner Agreement or Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - public static DownloadUrl BeginDownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetBySubscriptionAndInvoiceIdAsync(this IInvoicesOperations operations, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).DownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. The operation is supported for billing - /// accounts with agreement type Microsoft Partner Agreement or Microsoft - /// Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).BeginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - public static DownloadUrl BeginDownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) { - return operations.BeginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).BeginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } - /// - /// Gets a URL to download an invoice. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// Download token with document source and document ID. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IInvoicesOperations operations, string 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingSubscriptionNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IInvoicesOperations operations, string nextPageLink) + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingSubscriptionNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the invoices for a subscription. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingSubscriptionNext(this IInvoicesOperations operations, string nextPageLink) - { - return operations.ListByBillingSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the invoices for a subscription. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingSubscriptionNextAsync(this IInvoicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs index a6257a0c5c3d..80b47a16c015 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AcceptanceMode. /// + + public static class AcceptanceMode { public const string ClickToAccept = "ClickToAccept"; public const string ESignEmbedded = "ESignEmbedded"; public const string ESignOffline = "ESignOffline"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs index 51802b73f8b7..a9972d361747 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AccountStatus. /// + + public static class AccountStatus { public const string Active = "Active"; @@ -24,4 +21,4 @@ public static class AccountStatus public const string Extended = "Extended"; public const string Terminated = "Terminated"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs index 39da7284d44c..71fed383dcab 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AccountType. /// + + public static class AccountType { public const string Enterprise = "Enterprise"; public const string Individual = "Individual"; public const string Partner = "Partner"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs index be2312fb279b..4ad9892a6b37 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -30,35 +23,61 @@ public AddressDetails() /// /// Initializes a new instance of the AddressDetails class. /// - /// Address line 1. - /// Country code uses ISO2, 2-digit - /// format. - /// First name. - /// Last name. - /// Company name. - /// Address line 2. - /// Address line 3. - /// Address city. - /// Address district. - /// Address region. - /// Postal code. - /// Email address. - /// Phone number. + + /// First name. + /// + + /// Last name. + /// + + /// Company name. + /// + + /// Address line 1. + /// + + /// Address line 2. + /// + + /// Address line 3. + /// + + /// Address city. + /// + + /// Address district. + /// + + /// Address region. + /// + + /// Country code uses ISO2, 2-digit format. + /// + + /// Postal code. + /// + + /// Email address. + /// + + /// Phone number. + /// public AddressDetails(string addressLine1, string country, string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string district = default(string), string region = default(string), string postalCode = default(string), string email = default(string), string phoneNumber = default(string)) + { - FirstName = firstName; - LastName = lastName; - CompanyName = companyName; - AddressLine1 = addressLine1; - AddressLine2 = addressLine2; - AddressLine3 = addressLine3; - City = city; - District = district; - Region = region; - Country = country; - PostalCode = postalCode; - Email = email; - PhoneNumber = phoneNumber; + this.FirstName = firstName; + this.LastName = lastName; + this.CompanyName = companyName; + this.AddressLine1 = addressLine1; + this.AddressLine2 = addressLine2; + this.AddressLine3 = addressLine3; + this.City = city; + this.District = district; + this.Region = region; + this.Country = country; + this.PostalCode = postalCode; + this.Email = email; + this.PhoneNumber = phoneNumber; CustomInit(); } @@ -67,100 +86,113 @@ public AddressDetails() /// partial void CustomInit(); + /// /// Gets or sets first name. /// - [JsonProperty(PropertyName = "firstName")] - public string FirstName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "firstName")] + public string FirstName {get; set; } /// /// Gets or sets last name. /// - [JsonProperty(PropertyName = "lastName")] - public string LastName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "lastName")] + public string LastName {get; set; } /// /// Gets or sets company name. /// - [JsonProperty(PropertyName = "companyName")] - public string CompanyName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "companyName")] + public string CompanyName {get; set; } /// /// Gets or sets address line 1. /// - [JsonProperty(PropertyName = "addressLine1")] - public string AddressLine1 { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine1")] + public string AddressLine1 {get; set; } /// /// Gets or sets address line 2. /// - [JsonProperty(PropertyName = "addressLine2")] - public string AddressLine2 { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine2")] + public string AddressLine2 {get; set; } /// /// Gets or sets address line 3. /// - [JsonProperty(PropertyName = "addressLine3")] - public string AddressLine3 { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine3")] + public string AddressLine3 {get; set; } /// /// Gets or sets address city. /// - [JsonProperty(PropertyName = "city")] - public string City { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "city")] + public string City {get; set; } /// /// Gets or sets address district. /// - [JsonProperty(PropertyName = "district")] - public string District { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "district")] + public string District {get; set; } /// /// Gets or sets address region. /// - [JsonProperty(PropertyName = "region")] - public string Region { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "region")] + public string Region {get; set; } /// /// Gets or sets country code uses ISO2, 2-digit format. /// - [JsonProperty(PropertyName = "country")] - public string Country { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "country")] + public string Country {get; set; } /// /// Gets or sets postal code. /// - [JsonProperty(PropertyName = "postalCode")] - public string PostalCode { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "postalCode")] + public string PostalCode {get; set; } /// /// Gets or sets email address. /// - [JsonProperty(PropertyName = "email")] - public string Email { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "email")] + public string Email {get; set; } /// /// Gets or sets phone number. /// - [JsonProperty(PropertyName = "phoneNumber")] - public string PhoneNumber { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "phoneNumber")] + public string PhoneNumber {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (AddressLine1 == null) + if (this.AddressLine1 == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "AddressLine1"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AddressLine1"); } - if (Country == null) + if (this.Country == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Country"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Country"); } + + + + + + + + + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs index 41d215933e7e..55db79d0380b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AddressValidationStatus. /// + + public static class AddressValidationStatus { public const string Valid = "Valid"; public const string Invalid = "Invalid"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs index ef8b3b47aa74..782bc5017f58 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An agreement. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Agreement : Resource { /// @@ -34,34 +24,48 @@ public Agreement() /// /// Initializes a new instance of the Agreement class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The URL to download the - /// agreement. - /// The category of the agreement signed by a - /// customer. Possible values include: 'MicrosoftCustomerAgreement', - /// 'AffiliatePurchaseTerms', 'Other' - /// The mode of acceptance for an - /// agreement. Possible values include: 'ClickToAccept', - /// 'ESignEmbedded', 'ESignOffline' - /// The date from which the agreement is - /// effective. - /// The date when the agreement - /// expires. - /// The list of participants that - /// participates in acceptance of an agreement. - /// The current status of the agreement. - public Agreement(string id = default(string), string name = default(string), string type = default(string), string agreementLink = default(string), string category = default(string), string acceptanceMode = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), IList participants = default(IList), string status = default(string)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The category of the agreement signed by a customer. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + + /// The mode of acceptance for an agreement. + /// Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + + /// The URL to download the agreement. + /// + + /// The date from which the agreement is effective. + /// + + /// The date when the agreement expires. + /// + + /// The list of participants that participates in acceptance of an agreement. + /// + + /// The current status of the agreement. + /// + public Agreement(string id = default(string), string name = default(string), string type = default(string), string category = default(string), string acceptanceMode = default(string), string agreementLink = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), System.Collections.Generic.IList participants = default(System.Collections.Generic.IList), string status = default(string)) + + : base(id, name, type) { - AgreementLink = agreementLink; - Category = category; - AcceptanceMode = acceptanceMode; - EffectiveDate = effectiveDate; - ExpirationDate = expirationDate; - Participants = participants; - Status = status; + this.Category = category; + this.AcceptanceMode = acceptanceMode; + this.AgreementLink = agreementLink; + this.EffectiveDate = effectiveDate; + this.ExpirationDate = expirationDate; + this.Participants = participants; + this.Status = status; CustomInit(); } @@ -70,51 +74,48 @@ public Agreement() /// partial void CustomInit(); + /// - /// Gets the URL to download the agreement. + /// Gets the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other' /// - [JsonProperty(PropertyName = "properties.agreementLink")] - public string AgreementLink { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.category")] + public string Category {get; private set; } /// - /// Gets the category of the agreement signed by a customer. Possible - /// values include: 'MicrosoftCustomerAgreement', - /// 'AffiliatePurchaseTerms', 'Other' + /// Gets the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' /// - [JsonProperty(PropertyName = "properties.category")] - public string Category { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.acceptanceMode")] + public string AcceptanceMode {get; private set; } /// - /// Gets the mode of acceptance for an agreement. Possible values - /// include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + /// Gets the URL to download the agreement. /// - [JsonProperty(PropertyName = "properties.acceptanceMode")] - public string AcceptanceMode { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementLink")] + public string AgreementLink {get; private set; } /// /// Gets the date from which the agreement is effective. /// - [JsonProperty(PropertyName = "properties.effectiveDate")] - public System.DateTime? EffectiveDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.effectiveDate")] + public System.DateTime? EffectiveDate {get; private set; } /// /// Gets the date when the agreement expires. /// - [JsonProperty(PropertyName = "properties.expirationDate")] - public System.DateTime? ExpirationDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; private set; } /// - /// Gets or sets the list of participants that participates in - /// acceptance of an agreement. + /// Gets or sets the list of participants that participates in acceptance of an + /// agreement. /// - [JsonProperty(PropertyName = "properties.participants")] - public IList Participants { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.participants")] + public System.Collections.Generic.IList Participants {get; set; } /// /// Gets the current status of the agreement. /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs new file mode 100644 index 000000000000..84c5ef08adc9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs @@ -0,0 +1,110 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an agreement. + /// + public partial class AgreementProperties + { + /// + /// Initializes a new instance of the AgreementProperties class. + /// + public AgreementProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgreementProperties class. + /// + + /// The URL to download the agreement. + /// + + /// The category of the agreement signed by a customer. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + + /// The mode of acceptance for an agreement. + /// Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + + /// The date from which the agreement is effective. + /// + + /// The date when the agreement expires. + /// + + /// The list of participants that participates in acceptance of an agreement. + /// + + /// The current status of the agreement. + /// + public AgreementProperties(string agreementLink = default(string), string category = default(string), string acceptanceMode = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), System.Collections.Generic.IList participants = default(System.Collections.Generic.IList), string status = default(string)) + + { + this.AgreementLink = agreementLink; + this.Category = category; + this.AcceptanceMode = acceptanceMode; + this.EffectiveDate = effectiveDate; + this.ExpirationDate = expirationDate; + this.Participants = participants; + this.Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the URL to download the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "agreementLink")] + public string AgreementLink {get; private set; } + + /// + /// Gets the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; private set; } + + /// + /// Gets the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "acceptanceMode")] + public string AcceptanceMode {get; private set; } + + /// + /// Gets the date from which the agreement is effective. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "effectiveDate")] + public System.DateTime? EffectiveDate {get; private set; } + + /// + /// Gets the date when the agreement expires. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; private set; } + + /// + /// Gets or sets the list of participants that participates in acceptance of an + /// agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "participants")] + public System.Collections.Generic.IList Participants {get; set; } + + /// + /// Gets the current status of the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs index 97f72f610539..76c8a8aca831 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AgreementType. /// + + public static class AgreementType { public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; @@ -21,4 +18,4 @@ public static class AgreementType public const string MicrosoftOnlineServicesProgram = "MicrosoftOnlineServicesProgram"; public const string MicrosoftPartnerAgreement = "MicrosoftPartnerAgreement"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs index 9dde6d59e280..e7b71406842d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public Amount() /// /// Initializes a new instance of the Amount class. /// - /// The currency for the amount value. - /// Amount value. + + /// The currency for the amount value. + /// + + /// Amount value. + /// public Amount(string currency = default(string), double? value = default(double?)) + { - Currency = currency; - Value = value; + this.Currency = currency; + this.Value = value; CustomInit(); } @@ -43,17 +42,17 @@ public Amount() /// partial void CustomInit(); + /// /// Gets the currency for the amount value. /// - [JsonProperty(PropertyName = "currency")] - public string Currency { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } /// /// Gets or sets amount value. /// - [JsonProperty(PropertyName = "value")] - public double? Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public double? Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs index 34af34329611..9fc6652a2c8a 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for AutoRenew. /// + + public static class AutoRenew { public const string Off = "Off"; public const string On = "On"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs index b2955e2d9d1a..f6a5e193feb9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs @@ -1,25 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// - /// The latest Azure credit balance. This is the balance available for pay - /// now. + /// The latest Azure credit balance. This is the balance available for pay now. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class AvailableBalance : Resource { /// @@ -33,14 +24,23 @@ public AvailableBalance() /// /// Initializes a new instance of the AvailableBalance class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// Balance amount. + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Balance amount. + /// public AvailableBalance(string id = default(string), string name = default(string), string type = default(string), Amount amount = default(Amount)) - : base(id, name, type) + + : base(id, name, type) { - Amount = amount; + this.Amount = amount; CustomInit(); } @@ -49,11 +49,11 @@ public AvailableBalance() /// partial void CustomInit(); + /// /// Gets balance amount. /// - [JsonProperty(PropertyName = "properties.amount")] - public Amount Amount { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amount")] + public Amount Amount {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs new file mode 100644 index 000000000000..c2981aae2c6f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of available balance. + /// + public partial class AvailableBalanceProperties + { + /// + /// Initializes a new instance of the AvailableBalanceProperties class. + /// + public AvailableBalanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableBalanceProperties class. + /// + + /// Balance amount. + /// + public AvailableBalanceProperties(Amount amount = default(Amount)) + + { + this.Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets balance amount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public Amount Amount {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs index 3e89d33d93e9..c8633281d444 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public AzurePlan() /// /// Initializes a new instance of the AzurePlan class. /// - /// The sku id. - /// The sku description. + + /// The sku id. + /// + + /// The sku description. + /// public AzurePlan(string skuId = default(string), string skuDescription = default(string)) + { - SkuId = skuId; - SkuDescription = skuDescription; + this.SkuId = skuId; + this.SkuDescription = skuDescription; CustomInit(); } @@ -43,17 +42,17 @@ public AzurePlan() /// partial void CustomInit(); + /// /// Gets or sets the sku id. /// - [JsonProperty(PropertyName = "skuId")] - public string SkuId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; set; } /// /// Gets the sku description. /// - [JsonProperty(PropertyName = "skuDescription")] - public string SkuDescription { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs index d6f75c453bd2..82b1eb796aec 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A billing account. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingAccount : Resource { /// @@ -34,46 +24,65 @@ public BillingAccount() /// /// Initializes a new instance of the BillingAccount class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The billing account name. - /// The address of the individual or organization - /// that is responsible for the billing account. - /// The type of agreement. Possible values - /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', - /// 'MicrosoftOnlineServicesProgram', - /// 'MicrosoftPartnerAgreement' - /// The type of customer. Possible values - /// include: 'Enterprise', 'Individual', 'Partner' - /// The current status of the billing - /// account. Possible values include: 'Active', 'Deleted', 'Disabled', - /// 'Expired', 'Transferred', 'Extended', 'Terminated' - /// The billing profiles associated with - /// the billing account. By default this is not populated, unless it's - /// specified in $expand. - /// The details about the associated - /// legacy enrollment. By default this is not populated, unless it's - /// specified in $expand. - /// The departments associated to the - /// enrollment. - /// The accounts associated to the - /// enrollment. - /// Indicates whether user has read access - /// to the billing account. - public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), Enrollment enrollmentDetails = default(Enrollment), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + + : base(id, name, type) { - DisplayName = displayName; - SoldTo = soldTo; - AgreementType = agreementType; - AccountType = accountType; - AccountStatus = accountStatus; - BillingProfiles = billingProfiles; - EnrollmentDetails = enrollmentDetails; - Departments = departments; - EnrollmentAccounts = enrollmentAccounts; - HasReadAccess = hasReadAccess; + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.EnrollmentDetails = enrollmentDetails; + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.BillingProfiles = billingProfiles; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; CustomInit(); } @@ -82,87 +91,89 @@ public BillingAccount() /// partial void CustomInit(); + /// - /// Gets or sets the billing account name. + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType {get; private set; } /// - /// Gets or sets the address of the individual or organization that is - /// responsible for the billing account. + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' /// - [JsonProperty(PropertyName = "properties.soldTo")] - public AddressDetails SoldTo { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountType")] + public string AccountType {get; private set; } /// - /// Gets the type of agreement. Possible values include: - /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', - /// 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' /// - [JsonProperty(PropertyName = "properties.agreementType")] - public string AgreementType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus {get; private set; } /// - /// Gets the type of customer. Possible values include: 'Enterprise', - /// 'Individual', 'Partner' + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.accountType")] - public string AccountType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } /// - /// Gets the current status of the billing account. Possible values - /// include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', - /// 'Extended', 'Terminated' + /// Gets or sets the billing account name. /// - [JsonProperty(PropertyName = "properties.accountStatus")] - public string AccountStatus { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the billing profiles associated with the billing - /// account. By default this is not populated, unless it's specified in - /// $expand. + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. /// - [JsonProperty(PropertyName = "properties.billingProfiles")] - public BillingProfilesOnExpand BillingProfiles { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo {get; set; } /// - /// Gets the details about the associated legacy enrollment. By default - /// this is not populated, unless it's specified in $expand. + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.enrollmentDetails")] - public Enrollment EnrollmentDetails { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } /// /// Gets or sets the departments associated to the enrollment. /// - [JsonProperty(PropertyName = "properties.departments")] - public IList Departments { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departments")] + public System.Collections.Generic.IList Departments {get; set; } /// /// Gets or sets the accounts associated to the enrollment. /// - [JsonProperty(PropertyName = "properties.enrollmentAccounts")] - public IList EnrollmentAccounts { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } /// /// Gets indicates whether user has read access to the billing account. /// - [JsonProperty(PropertyName = "properties.hasReadAccess")] - public bool? HasReadAccess { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (SoldTo != null) + + + + + + if (this.SoldTo != null) { - SoldTo.Validate(); + this.SoldTo.Validate(); } + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs new file mode 100644 index 000000000000..90fec600b466 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs @@ -0,0 +1,168 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing account. + /// + public partial class BillingAccountProperties + { + /// + /// Initializes a new instance of the BillingAccountProperties class. + /// + public BillingAccountProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountProperties class. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccountProperties(string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + + { + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.BillingProfiles = billingProfiles; + this.EnrollmentDetails = enrollmentDetails; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the billing account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "soldTo")] + public AddressDetails SoldTo {get; set; } + + /// + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "agreementType")] + public string AgreementType {get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountType")] + public string AccountType {get; private set; } + + /// + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountStatus")] + public string AccountStatus {get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "departments")] + public System.Collections.Generic.IList Departments {get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasReadAccess")] + public bool? HasReadAccess {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.SoldTo != null) + { + this.SoldTo.Validate(); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs index 597cbbfc8e58..efeffb65c6a2 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs @@ -1,31 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// The request properties of the billing account that can be updated. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingAccountUpdateRequest { /// - /// Initializes a new instance of the BillingAccountUpdateRequest - /// class. + /// Initializes a new instance of the BillingAccountUpdateRequest class. /// public BillingAccountUpdateRequest() { @@ -33,45 +22,57 @@ public BillingAccountUpdateRequest() } /// - /// Initializes a new instance of the BillingAccountUpdateRequest - /// class. + /// Initializes a new instance of the BillingAccountUpdateRequest class. /// - /// The billing account name. - /// The address of the individual or organization - /// that is responsible for the billing account. - /// The type of agreement. Possible values - /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', - /// 'MicrosoftOnlineServicesProgram', - /// 'MicrosoftPartnerAgreement' - /// The type of customer. Possible values - /// include: 'Enterprise', 'Individual', 'Partner' - /// The current status of the billing - /// account. Possible values include: 'Active', 'Deleted', 'Disabled', - /// 'Expired', 'Transferred', 'Extended', 'Terminated' - /// The billing profiles associated with - /// the billing account. By default this is not populated, unless it's - /// specified in $expand. - /// The details about the associated - /// legacy enrollment. By default this is not populated, unless it's - /// specified in $expand. - /// The departments associated to the - /// enrollment. - /// The accounts associated to the - /// enrollment. - /// Indicates whether user has read access - /// to the billing account. - public BillingAccountUpdateRequest(string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccountUpdateRequest(string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), Enrollment enrollmentDetails = default(Enrollment), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + { - DisplayName = displayName; - SoldTo = soldTo; - AgreementType = agreementType; - AccountType = accountType; - AccountStatus = accountStatus; - BillingProfiles = billingProfiles; - EnrollmentDetails = enrollmentDetails; - Departments = departments; - EnrollmentAccounts = enrollmentAccounts; - HasReadAccess = hasReadAccess; + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.EnrollmentDetails = enrollmentDetails; + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.BillingProfiles = billingProfiles; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; CustomInit(); } @@ -80,87 +81,89 @@ public BillingAccountUpdateRequest() /// partial void CustomInit(); + /// - /// Gets or sets the billing account name. + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType {get; private set; } /// - /// Gets or sets the address of the individual or organization that is - /// responsible for the billing account. + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' /// - [JsonProperty(PropertyName = "properties.soldTo")] - public AddressDetails SoldTo { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountType")] + public string AccountType {get; private set; } /// - /// Gets the type of agreement. Possible values include: - /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', - /// 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' /// - [JsonProperty(PropertyName = "properties.agreementType")] - public string AgreementType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus {get; private set; } /// - /// Gets the type of customer. Possible values include: 'Enterprise', - /// 'Individual', 'Partner' + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.accountType")] - public string AccountType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } /// - /// Gets the current status of the billing account. Possible values - /// include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', - /// 'Extended', 'Terminated' + /// Gets or sets the billing account name. /// - [JsonProperty(PropertyName = "properties.accountStatus")] - public string AccountStatus { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the billing profiles associated with the billing - /// account. By default this is not populated, unless it's specified in - /// $expand. + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. /// - [JsonProperty(PropertyName = "properties.billingProfiles")] - public BillingProfilesOnExpand BillingProfiles { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo {get; set; } /// - /// Gets the details about the associated legacy enrollment. By default - /// this is not populated, unless it's specified in $expand. + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.enrollmentDetails")] - public Enrollment EnrollmentDetails { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } /// /// Gets or sets the departments associated to the enrollment. /// - [JsonProperty(PropertyName = "properties.departments")] - public IList Departments { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departments")] + public System.Collections.Generic.IList Departments {get; set; } /// /// Gets or sets the accounts associated to the enrollment. /// - [JsonProperty(PropertyName = "properties.enrollmentAccounts")] - public IList EnrollmentAccounts { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } /// /// Gets indicates whether user has read access to the billing account. /// - [JsonProperty(PropertyName = "properties.hasReadAccess")] - public bool? HasReadAccess { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (SoldTo != null) + + + + + + if (this.SoldTo != null) { - SoldTo.Validate(); + this.SoldTo.Validate(); } + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs index 35679ba0e15e..57018bf676c6 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for BillingFrequency. /// + + public static class BillingFrequency { public const string OneTime = "OneTime"; public const string Monthly = "Monthly"; public const string UsageBased = "UsageBased"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs new file mode 100644 index 000000000000..09c8869239d5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing period resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingPeriod : Resource + { + /// + /// Initializes a new instance of the BillingPeriod class. + /// + public BillingPeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPeriod class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The start of the date range covered by the billing period. + /// + + /// The end of the date range covered by the billing period. + /// + + /// Array of invoice ids that associated with. + /// + public BillingPeriod(string id = default(string), string name = default(string), string type = default(string), System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), System.Collections.Generic.IList invoiceIds = default(System.Collections.Generic.IList)) + + : base(id, name, type) + { + this.BillingPeriodStartDate = billingPeriodStartDate; + this.BillingPeriodEndDate = billingPeriodEndDate; + this.InvoiceIds = invoiceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the start of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate {get; private set; } + + /// + /// Gets the end of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate {get; private set; } + + /// + /// Gets array of invoice ids that associated with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceIds")] + public System.Collections.Generic.IList InvoiceIds {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs new file mode 100644 index 000000000000..b7dbe7f38856 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing period. + /// + public partial class BillingPeriodProperties + { + /// + /// Initializes a new instance of the BillingPeriodProperties class. + /// + public BillingPeriodProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPeriodProperties class. + /// + + /// The start of the date range covered by the billing period. + /// + + /// The end of the date range covered by the billing period. + /// + + /// Array of invoice ids that associated with. + /// + public BillingPeriodProperties(System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), System.Collections.Generic.IList invoiceIds = default(System.Collections.Generic.IList)) + + { + this.BillingPeriodStartDate = billingPeriodStartDate; + this.BillingPeriodEndDate = billingPeriodEndDate; + this.InvoiceIds = invoiceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the start of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate {get; private set; } + + /// + /// Gets the end of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate {get; private set; } + + /// + /// Gets array of invoice ids that associated with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceIds")] + public System.Collections.Generic.IList InvoiceIds {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs index 4a5ad7ec7b9c..d8e909e0a716 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs @@ -1,29 +1,20 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The set of allowed action and not allowed actions a caller has on a - /// billing account + /// The set of allowed action and not allowed actions a caller has on a billing + /// account /// public partial class BillingPermissionsProperties { /// - /// Initializes a new instance of the BillingPermissionsProperties - /// class. + /// Initializes a new instance of the BillingPermissionsProperties class. /// public BillingPermissionsProperties() { @@ -31,17 +22,19 @@ public BillingPermissionsProperties() } /// - /// Initializes a new instance of the BillingPermissionsProperties - /// class. + /// Initializes a new instance of the BillingPermissionsProperties class. /// - /// The set of actions that the caller is allowed - /// to perform. - /// The set of actions that the caller is not - /// allowed to perform. - public BillingPermissionsProperties(IList actions = default(IList), IList notActions = default(IList)) + + /// The set of actions that the caller is allowed to perform. + /// + + /// The set of actions that the caller is not allowed to perform. + /// + public BillingPermissionsProperties(System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.Collections.Generic.IList notActions = default(System.Collections.Generic.IList)) + { - Actions = actions; - NotActions = notActions; + this.Actions = actions; + this.NotActions = notActions; CustomInit(); } @@ -50,17 +43,17 @@ public BillingPermissionsProperties() /// partial void CustomInit(); + /// /// Gets the set of actions that the caller is allowed to perform. /// - [JsonProperty(PropertyName = "actions")] - public IList Actions { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "actions")] + public System.Collections.Generic.IList Actions {get; private set; } /// /// Gets the set of actions that the caller is not allowed to perform. /// - [JsonProperty(PropertyName = "notActions")] - public IList NotActions { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "notActions")] + public System.Collections.Generic.IList NotActions {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs index 35a438a6a3d6..2563a60874be 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A billing profile. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingProfile : Resource { /// @@ -34,51 +24,75 @@ public BillingProfile() /// /// Initializes a new instance of the BillingProfile class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the billing profile. - /// The purchase order name that will appear on - /// the invoices generated for the billing profile. - /// Billing address. - /// Flag controlling whether the - /// invoices for the billing profile are sent through email. - /// The day of the month when the invoice for - /// the billing profile is generated. - /// The currency in which the charges for the - /// billing profile are billed. - /// Information about the enabled azure - /// plans. - /// The invoice sections associated to - /// the billing profile. By default this is not populated, unless it's - /// specified in $expand. - /// Indicates whether user has read access - /// to the billing profile. - /// The system generated unique identifier for a - /// billing profile. - /// The status of the billing profile. Possible - /// values include: 'Active', 'Disabled', 'Warned' - /// Reason for the specified billing - /// profile status. Possible values include: 'PastDue', - /// 'SpendingLimitReached', 'SpendingLimitExpired' + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + /// The billing profile spending limit. - /// Possible values include: 'Off', 'On' - public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzurePlans = default(IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string), string spendingLimit = default(string)) - : base(id, name, type) + /// Possible values include: 'Off', 'On' + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// Billing address. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// The day of the month when the invoice for the billing profile is generated. + /// + + /// The currency in which the charges for the billing profile are billed. + /// + + /// Information about the enabled azure plans. + /// + + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. + /// + + /// Indicates whether user has read access to the billing profile. + /// + + /// The system generated unique identifier for a billing profile. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string spendingLimit = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string)) + + : base(id, name, type) { - DisplayName = displayName; - PoNumber = poNumber; - BillTo = billTo; - InvoiceEmailOptIn = invoiceEmailOptIn; - InvoiceDay = invoiceDay; - Currency = currency; - EnabledAzurePlans = enabledAzurePlans; - InvoiceSections = invoiceSections; - HasReadAccess = hasReadAccess; - SystemId = systemId; - Status = status; - StatusReasonCode = statusReasonCode; - SpendingLimit = spendingLimit; + this.SpendingLimit = spendingLimit; + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.InvoiceDay = invoiceDay; + this.Currency = currency; + this.EnabledAzurePlans = enabledAzurePlans; + this.InvoiceSections = invoiceSections; + this.HasReadAccess = hasReadAccess; + this.SystemId = systemId; + this.Status = status; + this.StatusReasonCode = statusReasonCode; CustomInit(); } @@ -87,106 +101,109 @@ public BillingProfile() /// partial void CustomInit(); + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.spendingLimit")] + public string SpendingLimit {get; private set; } + /// /// Gets or sets the name of the billing profile. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the purchase order name that will appear on the - /// invoices generated for the billing profile. + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. /// - [JsonProperty(PropertyName = "properties.poNumber")] - public string PoNumber { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.poNumber")] + public string PoNumber {get; set; } /// /// Gets or sets billing address. /// - [JsonProperty(PropertyName = "properties.billTo")] - public AddressDetails BillTo { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billTo")] + public AddressDetails BillTo {get; set; } /// - /// Gets or sets flag controlling whether the invoices for the billing - /// profile are sent through email. + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. /// - [JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] - public bool? InvoiceEmailOptIn { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } /// - /// Gets the day of the month when the invoice for the billing profile - /// is generated. + /// Gets the day of the month when the invoice for the billing profile is + /// generated. /// - [JsonProperty(PropertyName = "properties.invoiceDay")] - public int? InvoiceDay { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceDay")] + public int? InvoiceDay {get; private set; } /// - /// Gets the currency in which the charges for the billing profile are - /// billed. + /// Gets the currency in which the charges for the billing profile are billed. /// - [JsonProperty(PropertyName = "properties.currency")] - public string Currency { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currency")] + public string Currency {get; private set; } /// /// Gets or sets information about the enabled azure plans. /// - [JsonProperty(PropertyName = "properties.enabledAzurePlans")] - public IList EnabledAzurePlans { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } /// - /// Gets or sets the invoice sections associated to the billing - /// profile. By default this is not populated, unless it's specified in - /// $expand. + /// Gets or sets the invoice sections associated to the billing profile. By + /// default this is not populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.invoiceSections")] - public InvoiceSectionsOnExpand InvoiceSections { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSections")] + public InvoiceSectionsOnExpand InvoiceSections {get; set; } /// /// Gets indicates whether user has read access to the billing profile. /// - [JsonProperty(PropertyName = "properties.hasReadAccess")] - public bool? HasReadAccess { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } /// /// Gets the system generated unique identifier for a billing profile. /// - [JsonProperty(PropertyName = "properties.systemId")] - public string SystemId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.systemId")] + public string SystemId {get; private set; } /// - /// Gets the status of the billing profile. Possible values include: - /// 'Active', 'Disabled', 'Warned' + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } /// - /// Gets reason for the specified billing profile status. Possible - /// values include: 'PastDue', 'SpendingLimitReached', - /// 'SpendingLimitExpired' + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' /// - [JsonProperty(PropertyName = "properties.statusReasonCode")] - public string StatusReasonCode { get; private set; } - - /// - /// Gets the billing profile spending limit. Possible values include: - /// 'Off', 'On' - /// - [JsonProperty(PropertyName = "properties.spendingLimit")] - public string SpendingLimit { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.statusReasonCode")] + public string StatusReasonCode {get; private set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (BillTo != null) + + + + if (this.BillTo != null) { - BillTo.Validate(); + this.BillTo.Validate(); } + + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs index c3fb140c6d40..4dd4c7e1795b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class BillingProfileCreationRequest { /// - /// Initializes a new instance of the BillingProfileCreationRequest - /// class. + /// Initializes a new instance of the BillingProfileCreationRequest class. /// public BillingProfileCreationRequest() { @@ -30,25 +21,34 @@ public BillingProfileCreationRequest() } /// - /// Initializes a new instance of the BillingProfileCreationRequest - /// class. + /// Initializes a new instance of the BillingProfileCreationRequest class. /// - /// The name of the billing profile. - /// The purchase order name that will appear on - /// the invoices generated for the billing profile. - /// The address of the individual or organization - /// that is responsible for the billing profile. - /// Flag controlling whether the - /// invoices for the billing profile are sent through email. - /// Enabled azure plans for the billing - /// profile. - public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), IList enabledAzurePlans = default(IList)) + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// The address of the individual or organization that is responsible for the + /// billing profile. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// Enabled azure plans for the billing profile. + /// + public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList)) + { - DisplayName = displayName; - PoNumber = poNumber; - BillTo = billTo; - InvoiceEmailOptIn = invoiceEmailOptIn; - EnabledAzurePlans = enabledAzurePlans; + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.EnabledAzurePlans = enabledAzurePlans; CustomInit(); } @@ -57,51 +57,54 @@ public BillingProfileCreationRequest() /// partial void CustomInit(); + /// /// Gets or sets the name of the billing profile. /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets the purchase order name that will appear on the - /// invoices generated for the billing profile. + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. /// - [JsonProperty(PropertyName = "poNumber")] - public string PoNumber { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "poNumber")] + public string PoNumber {get; set; } /// /// Gets or sets the address of the individual or organization that is /// responsible for the billing profile. /// - [JsonProperty(PropertyName = "billTo")] - public AddressDetails BillTo { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billTo")] + public AddressDetails BillTo {get; set; } /// - /// Gets or sets flag controlling whether the invoices for the billing - /// profile are sent through email. + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. /// - [JsonProperty(PropertyName = "invoiceEmailOptIn")] - public bool? InvoiceEmailOptIn { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } /// /// Gets or sets enabled azure plans for the billing profile. /// - [JsonProperty(PropertyName = "enabledAzurePlans")] - public IList EnabledAzurePlans { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (BillTo != null) + + + if (this.BillTo != null) { - BillTo.Validate(); + this.BillTo.Validate(); } + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs new file mode 100644 index 000000000000..2ce02c5cad6c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs @@ -0,0 +1,198 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing profile. + /// + public partial class BillingProfileProperties + { + /// + /// Initializes a new instance of the BillingProfileProperties class. + /// + public BillingProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileProperties class. + /// + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// Billing address. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// The day of the month when the invoice for the billing profile is generated. + /// + + /// The currency in which the charges for the billing profile are billed. + /// + + /// Information about the enabled azure plans. + /// + + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. + /// + + /// Indicates whether user has read access to the billing profile. + /// + + /// The system generated unique identifier for a billing profile. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + public BillingProfileProperties(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string), string spendingLimit = default(string)) + + { + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.InvoiceDay = invoiceDay; + this.Currency = currency; + this.EnabledAzurePlans = enabledAzurePlans; + this.InvoiceSections = invoiceSections; + this.HasReadAccess = hasReadAccess; + this.SystemId = systemId; + this.Status = status; + this.StatusReasonCode = statusReasonCode; + this.SpendingLimit = spendingLimit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poNumber")] + public string PoNumber {get; set; } + + /// + /// Gets or sets billing address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billTo")] + public AddressDetails BillTo {get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } + + /// + /// Gets the day of the month when the invoice for the billing profile is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceDay")] + public int? InvoiceDay {get; private set; } + + /// + /// Gets the currency in which the charges for the billing profile are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } + + /// + /// Gets or sets information about the enabled azure plans. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the invoice sections associated to the billing profile. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSections")] + public InvoiceSectionsOnExpand InvoiceSections {get; set; } + + /// + /// Gets indicates whether user has read access to the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasReadAccess")] + public bool? HasReadAccess {get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "systemId")] + public string SystemId {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statusReasonCode")] + public string StatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "spendingLimit")] + public string SpendingLimit {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.BillTo != null) + { + this.BillTo.Validate(); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs index e4902a4b87d7..1bfa2c41e1bb 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for BillingProfileSpendingLimit. /// + + public static class BillingProfileSpendingLimit { public const string Off = "Off"; public const string On = "On"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs index 673be9a7afec..a90388196f19 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for BillingProfileStatus. /// + + public static class BillingProfileStatus { public const string Active = "Active"; public const string Disabled = "Disabled"; public const string Warned = "Warned"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs index 40a646bebc07..30bb6892ad08 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for BillingProfileStatusReasonCode. /// + + public static class BillingProfileStatusReasonCode { public const string PastDue = "PastDue"; public const string SpendingLimitReached = "SpendingLimitReached"; public const string SpendingLimitExpired = "SpendingLimitExpired"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs index d9b7bfb5e74a..13a461155994 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for CreateOrUpdate operation. - /// public partial class BillingProfilesCreateOrUpdateHeaders { /// - /// Initializes a new instance of the - /// BillingProfilesCreateOrUpdateHeaders class. + /// Initializes a new instance of the BillingProfilesCreateOrUpdateHeaders class. /// public BillingProfilesCreateOrUpdateHeaders() { @@ -28,17 +18,19 @@ public BillingProfilesCreateOrUpdateHeaders() } /// - /// Initializes a new instance of the - /// BillingProfilesCreateOrUpdateHeaders class. + /// Initializes a new instance of the BillingProfilesCreateOrUpdateHeaders class. /// - /// Location URI to poll for result - /// Recommended time to wait before making - /// another request to check the status of the operation. The time is - /// specified in seconds. + + /// + /// + + /// + /// public BillingProfilesCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -47,19 +39,17 @@ public BillingProfilesCreateOrUpdateHeaders() /// partial void CustomInit(); + /// - /// Gets or sets location URI to poll for result + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets recommended time to wait before making another request - /// to check the status of the operation. The time is specified in - /// seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs index 76c7d5e48715..6f10d9f23b94 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs @@ -1,23 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The billing profiles associated with the billing account. By default - /// this is not populated, unless it's specified in $expand. + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. /// public partial class BillingProfilesOnExpand { @@ -32,16 +24,19 @@ public BillingProfilesOnExpand() /// /// Initializes a new instance of the BillingProfilesOnExpand class. /// - /// 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. - /// The billing profiles associated with the - /// billing account. - public BillingProfilesOnExpand(bool? hasMoreResults = default(bool?), IList value = default(IList)) + + /// 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. + /// + + /// The billing profiles associated with the billing account. + /// + public BillingProfilesOnExpand(bool? hasMoreResults = default(bool?), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + { - HasMoreResults = hasMoreResults; - Value = value; + this.HasMoreResults = hasMoreResults; + this.Value = value; CustomInit(); } @@ -50,21 +45,19 @@ public BillingProfilesOnExpand() /// partial void CustomInit(); + /// - /// Gets 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. + /// Gets 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(PropertyName = "hasMoreResults")] - public bool? HasMoreResults { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "hasMoreResults")] + public bool? HasMoreResults {get; private set; } /// - /// Gets or sets the billing profiles associated with the billing - /// account. + /// Gets or sets the billing profiles associated with the billing account. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs index 1c0f99b42182..6488d3e9a8bc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// A billing property. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingProperty : Resource { /// @@ -32,65 +24,88 @@ public BillingProperty() /// /// Initializes a new instance of the BillingProperty class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The email - /// address on which the account admin gets all Azure - /// notifications. - /// The Azure AD tenant ID of the billing - /// account for the subscription. - /// The ID of the billing account to - /// which the subscription is billed. - /// The name of the billing - /// account to which the subscription is billed. - /// The ID of the billing profile to - /// which the subscription is billed. - /// The name of the billing - /// profile to which the subscription is billed. - /// The status of the billing - /// profile. Possible values include: 'Active', 'Disabled', - /// 'Warned' - /// Reason for the - /// specified billing profile status. Possible values include: - /// 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' - /// The billing profile - /// spending limit. Possible values include: 'Off', 'On' - /// The cost center applied to the - /// subscription. - /// The ID of the invoice section to - /// which the subscription is billed. - /// The name of the invoice - /// section to which the subscription is billed. - /// Indicates whether user is the account - /// admin. - /// The product ID of the Azure plan. - /// The product name of the Azure - /// plan. - /// The sku ID of the Azure plan for the - /// subscription. - /// The sku description of the Azure plan - /// for the subscription. + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The email address on which the account admin gets all Azure notifications. + /// + + /// The Azure AD tenant ID of the billing account for the subscription. + /// + + /// The ID of the billing account to which the subscription is billed. + /// + + /// The name of the billing account to which the subscription is billed. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The cost center applied to the subscription. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Indicates whether user is the account admin. + /// + + /// The product ID of the Azure plan. + /// + + /// The product name of the Azure plan. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string accountAdminNotificationEmailAddress = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), bool? isAccountAdmin = default(bool?), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) - : base(id, name, type) + + : base(id, name, type) { - AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; - BillingTenantId = billingTenantId; - BillingAccountId = billingAccountId; - BillingAccountDisplayName = billingAccountDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - BillingProfileStatus = billingProfileStatus; - BillingProfileStatusReasonCode = billingProfileStatusReasonCode; - BillingProfileSpendingLimit = billingProfileSpendingLimit; - CostCenter = costCenter; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - IsAccountAdmin = isAccountAdmin; - ProductId = productId; - ProductName = productName; - SkuId = skuId; - SkuDescription = skuDescription; + this.AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; + this.BillingTenantId = billingTenantId; + this.BillingAccountId = billingAccountId; + this.BillingAccountDisplayName = billingAccountDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.CostCenter = costCenter; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.IsAccountAdmin = isAccountAdmin; + this.ProductId = productId; + this.ProductName = productName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; CustomInit(); } @@ -99,119 +114,108 @@ public BillingProperty() /// partial void CustomInit(); + /// /// Gets the email address on which the account admin gets all Azure /// notifications. /// - [JsonProperty(PropertyName = "properties.accountAdminNotificationEmailAddress")] - public string AccountAdminNotificationEmailAddress { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountAdminNotificationEmailAddress")] + public string AccountAdminNotificationEmailAddress {get; private set; } /// - /// Gets the Azure AD tenant ID of the billing account for the - /// subscription. + /// Gets the Azure AD tenant ID of the billing account for the subscription. /// - [JsonProperty(PropertyName = "properties.billingTenantId")] - public string BillingTenantId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingTenantId")] + public string BillingTenantId {get; private set; } /// - /// Gets the ID of the billing account to which the subscription is - /// billed. + /// Gets the ID of the billing account to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingAccountId")] - public string BillingAccountId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId {get; private set; } /// - /// Gets the name of the billing account to which the subscription is - /// billed. + /// Gets the name of the billing account to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingAccountDisplayName")] - public string BillingAccountDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingAccountDisplayName")] + public string BillingAccountDisplayName {get; private set; } /// - /// Gets the ID of the billing profile to which the subscription is - /// billed. + /// Gets the ID of the billing profile to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// - /// Gets the name of the billing profile to which the subscription is - /// billed. + /// Gets the name of the billing profile to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// - /// Gets the status of the billing profile. Possible values include: - /// 'Active', 'Disabled', 'Warned' + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' /// - [JsonProperty(PropertyName = "properties.billingProfileStatus")] - public string BillingProfileStatus { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileStatus")] + public string BillingProfileStatus {get; private set; } /// - /// Gets reason for the specified billing profile status. Possible - /// values include: 'PastDue', 'SpendingLimitReached', - /// 'SpendingLimitExpired' + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' /// - [JsonProperty(PropertyName = "properties.billingProfileStatusReasonCode")] - public string BillingProfileStatusReasonCode { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } /// - /// Gets the billing profile spending limit. Possible values include: - /// 'Off', 'On' + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' /// - [JsonProperty(PropertyName = "properties.billingProfileSpendingLimit")] - public string BillingProfileSpendingLimit { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } /// /// Gets or sets the cost center applied to the subscription. /// - [JsonProperty(PropertyName = "properties.costCenter")] - public string CostCenter { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } /// - /// Gets the ID of the invoice section to which the subscription is - /// billed. + /// Gets the ID of the invoice section to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionId")] - public string InvoiceSectionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } /// - /// Gets the name of the invoice section to which the subscription is - /// billed. + /// Gets the name of the invoice section to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] - public string InvoiceSectionDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } /// /// Gets indicates whether user is the account admin. /// - [JsonProperty(PropertyName = "properties.isAccountAdmin")] - public bool? IsAccountAdmin { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAccountAdmin")] + public bool? IsAccountAdmin {get; private set; } /// /// Gets the product ID of the Azure plan. /// - [JsonProperty(PropertyName = "properties.productId")] - public string ProductId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productId")] + public string ProductId {get; private set; } /// /// Gets the product name of the Azure plan. /// - [JsonProperty(PropertyName = "properties.productName")] - public string ProductName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productName")] + public string ProductName {get; private set; } /// /// Gets the sku ID of the Azure plan for the subscription. /// - [JsonProperty(PropertyName = "properties.skuId")] - public string SkuId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; private set; } /// /// Gets the sku description of the Azure plan for the subscription. /// - [JsonProperty(PropertyName = "properties.skuDescription")] - public string SkuDescription { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs new file mode 100644 index 000000000000..72a81ddfa3ab --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs @@ -0,0 +1,210 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The billing property. + /// + public partial class BillingPropertyProperties + { + /// + /// Initializes a new instance of the BillingPropertyProperties class. + /// + public BillingPropertyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPropertyProperties class. + /// + + /// The email address on which the account admin gets all Azure notifications. + /// + + /// The Azure AD tenant ID of the billing account for the subscription. + /// + + /// The ID of the billing account to which the subscription is billed. + /// + + /// The name of the billing account to which the subscription is billed. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The cost center applied to the subscription. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Indicates whether user is the account admin. + /// + + /// The product ID of the Azure plan. + /// + + /// The product name of the Azure plan. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingPropertyProperties(string accountAdminNotificationEmailAddress = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), bool? isAccountAdmin = default(bool?), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + + { + this.AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; + this.BillingTenantId = billingTenantId; + this.BillingAccountId = billingAccountId; + this.BillingAccountDisplayName = billingAccountDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.CostCenter = costCenter; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.IsAccountAdmin = isAccountAdmin; + this.ProductId = productId; + this.ProductName = productName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the email address on which the account admin gets all Azure + /// notifications. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountAdminNotificationEmailAddress")] + public string AccountAdminNotificationEmailAddress {get; private set; } + + /// + /// Gets the Azure AD tenant ID of the billing account for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingTenantId")] + public string BillingTenantId {get; private set; } + + /// + /// Gets the ID of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingAccountId")] + public string BillingAccountId {get; private set; } + + /// + /// Gets the name of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingAccountDisplayName")] + public string BillingAccountDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatus")] + public string BillingProfileStatus {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets indicates whether user is the account admin. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAccountAdmin")] + public bool? IsAccountAdmin {get; private set; } + + /// + /// Gets the product ID of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productId")] + public string ProductId {get; private set; } + + /// + /// Gets the product name of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productName")] + public string ProductName {get; private set; } + + /// + /// Gets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs index bf9622e9c451..23d74ef05b22 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// The role assignment /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingRoleAssignment : Resource { /// @@ -32,42 +24,59 @@ public BillingRoleAssignment() /// /// Initializes a new instance of the BillingRoleAssignment class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The date the role assignment was - /// created. - /// The tenant Id of the user - /// who created the role assignment. - /// The principal Id of the user who - /// created the role assignment. - /// The email address of the - /// user who created the role assignment. - /// The principal id of the user to whom the - /// role was assigned. - /// The principal tenant id of the user - /// to whom the role was assigned. - /// The ID of the role - /// definition. - /// The scope at which the role was - /// assigned. - /// The authentication - /// type. - /// The email address of the - /// user. + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The date the role assignment was created. + /// + + /// The tenant Id of the user who created the role assignment. + /// + + /// The principal Id of the user who created the role assignment. + /// + + /// The email address of the user who created the role assignment. + /// + + /// The principal id of the user to whom the role was assigned. + /// + + /// The principal tenant id of the user to whom the role was assigned. + /// + + /// The ID of the role definition. + /// + + /// The scope at which the role was assigned. + /// + + /// The authentication type. + /// + + /// The email address of the user. + /// public BillingRoleAssignment(string id = default(string), string name = default(string), string type = default(string), string createdOn = default(string), string createdByPrincipalTenantId = default(string), string createdByPrincipalId = default(string), string createdByUserEmailAddress = default(string), string principalId = default(string), string principalTenantId = default(string), string roleDefinitionId = default(string), string scope = default(string), string userAuthenticationType = default(string), string userEmailAddress = default(string)) - : base(id, name, type) + + : base(id, name, type) { - CreatedOn = createdOn; - CreatedByPrincipalTenantId = createdByPrincipalTenantId; - CreatedByPrincipalId = createdByPrincipalId; - CreatedByUserEmailAddress = createdByUserEmailAddress; - PrincipalId = principalId; - PrincipalTenantId = principalTenantId; - RoleDefinitionId = roleDefinitionId; - Scope = scope; - UserAuthenticationType = userAuthenticationType; - UserEmailAddress = userEmailAddress; + this.CreatedOn = createdOn; + this.CreatedByPrincipalTenantId = createdByPrincipalTenantId; + this.CreatedByPrincipalId = createdByPrincipalId; + this.CreatedByUserEmailAddress = createdByUserEmailAddress; + this.PrincipalId = principalId; + this.PrincipalTenantId = principalTenantId; + this.RoleDefinitionId = roleDefinitionId; + this.Scope = scope; + this.UserAuthenticationType = userAuthenticationType; + this.UserEmailAddress = userEmailAddress; CustomInit(); } @@ -76,67 +85,66 @@ public BillingRoleAssignment() /// partial void CustomInit(); + /// /// Gets the date the role assignment was created. /// - [JsonProperty(PropertyName = "properties.createdOn")] - public string CreatedOn { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdOn")] + public string CreatedOn {get; private set; } /// /// Gets the tenant Id of the user who created the role assignment. /// - [JsonProperty(PropertyName = "properties.createdByPrincipalTenantId")] - public string CreatedByPrincipalTenantId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByPrincipalTenantId")] + public string CreatedByPrincipalTenantId {get; private set; } /// /// Gets the principal Id of the user who created the role assignment. /// - [JsonProperty(PropertyName = "properties.createdByPrincipalId")] - public string CreatedByPrincipalId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByPrincipalId")] + public string CreatedByPrincipalId {get; private set; } /// /// Gets the email address of the user who created the role assignment. /// - [JsonProperty(PropertyName = "properties.createdByUserEmailAddress")] - public string CreatedByUserEmailAddress { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserEmailAddress")] + public string CreatedByUserEmailAddress {get; private set; } /// - /// Gets or sets the principal id of the user to whom the role was - /// assigned. + /// Gets or sets the principal id of the user to whom the role was assigned. /// - [JsonProperty(PropertyName = "properties.principalId")] - public string PrincipalId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId {get; set; } /// - /// Gets or sets the principal tenant id of the user to whom the role - /// was assigned. + /// Gets or sets the principal tenant id of the user to whom the role was + /// assigned. /// - [JsonProperty(PropertyName = "properties.principalTenantId")] - public string PrincipalTenantId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalTenantId")] + public string PrincipalTenantId {get; set; } /// /// Gets or sets the ID of the role definition. /// - [JsonProperty(PropertyName = "properties.roleDefinitionId")] - public string RoleDefinitionId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleDefinitionId")] + public string RoleDefinitionId {get; set; } /// /// Gets the scope at which the role was assigned. /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")] + public string Scope {get; private set; } /// /// Gets or sets the authentication type. /// - [JsonProperty(PropertyName = "properties.userAuthenticationType")] - public string UserAuthenticationType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userAuthenticationType")] + public string UserAuthenticationType {get; set; } /// /// Gets or sets the email address of the user. /// - [JsonProperty(PropertyName = "properties.userEmailAddress")] - public string UserEmailAddress { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userEmailAddress")] + public string UserEmailAddress {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs new file mode 100644 index 000000000000..5d43f49b5e2e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the role assignment. + /// + public partial class BillingRoleAssignmentProperties + { + /// + /// Initializes a new instance of the BillingRoleAssignmentProperties class. + /// + public BillingRoleAssignmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleAssignmentProperties class. + /// + + /// The date the role assignment was created. + /// + + /// The tenant Id of the user who created the role assignment. + /// + + /// The principal Id of the user who created the role assignment. + /// + + /// The email address of the user who created the role assignment. + /// + + /// The principal id of the user to whom the role was assigned. + /// + + /// The principal tenant id of the user to whom the role was assigned. + /// + + /// The ID of the role definition. + /// + + /// The scope at which the role was assigned. + /// + + /// The authentication type. + /// + + /// The email address of the user. + /// + public BillingRoleAssignmentProperties(string createdOn = default(string), string createdByPrincipalTenantId = default(string), string createdByPrincipalId = default(string), string createdByUserEmailAddress = default(string), string principalId = default(string), string principalTenantId = default(string), string roleDefinitionId = default(string), string scope = default(string), string userAuthenticationType = default(string), string userEmailAddress = default(string)) + + { + this.CreatedOn = createdOn; + this.CreatedByPrincipalTenantId = createdByPrincipalTenantId; + this.CreatedByPrincipalId = createdByPrincipalId; + this.CreatedByUserEmailAddress = createdByUserEmailAddress; + this.PrincipalId = principalId; + this.PrincipalTenantId = principalTenantId; + this.RoleDefinitionId = roleDefinitionId; + this.Scope = scope; + this.UserAuthenticationType = userAuthenticationType; + this.UserEmailAddress = userEmailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the date the role assignment was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdOn")] + public string CreatedOn {get; private set; } + + /// + /// Gets the tenant Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByPrincipalTenantId")] + public string CreatedByPrincipalTenantId {get; private set; } + + /// + /// Gets the principal Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByPrincipalId")] + public string CreatedByPrincipalId {get; private set; } + + /// + /// Gets the email address of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserEmailAddress")] + public string CreatedByUserEmailAddress {get; private set; } + + /// + /// Gets or sets the principal id of the user to whom the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets the principal tenant id of the user to whom the role was + /// assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalTenantId")] + public string PrincipalTenantId {get; set; } + + /// + /// Gets or sets the ID of the role definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId {get; set; } + + /// + /// Gets the scope at which the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scope")] + public string Scope {get; private set; } + + /// + /// Gets or sets the authentication type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAuthenticationType")] + public string UserAuthenticationType {get; set; } + + /// + /// Gets or sets the email address of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userEmailAddress")] + public string UserEmailAddress {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs index 53748e93e72a..193e459f8a93 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// The properties of a role definition. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingRoleDefinition : Resource { /// @@ -34,19 +24,31 @@ public BillingRoleDefinition() /// /// Initializes a new instance of the BillingRoleDefinition class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The role description - /// The billingPermissions the role - /// has - /// The name of the role - public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), IList permissions = default(IList), string roleName = default(string)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The role description + /// + + /// The billingPermissions the role has + /// + + /// The name of the role + /// + public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), string roleName = default(string)) + + : base(id, name, type) { - Description = description; - Permissions = permissions; - RoleName = roleName; + this.Description = description; + this.Permissions = permissions; + this.RoleName = roleName; CustomInit(); } @@ -55,23 +57,23 @@ public BillingRoleDefinition() /// partial void CustomInit(); + /// /// Gets the role description /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } /// /// Gets or sets the billingPermissions the role has /// - [JsonProperty(PropertyName = "properties.permissions")] - public IList Permissions { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.permissions")] + public System.Collections.Generic.IList Permissions {get; set; } /// /// Gets the name of the role /// - [JsonProperty(PropertyName = "properties.roleName")] - public string RoleName { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleName")] + public string RoleName {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs new file mode 100644 index 000000000000..e62c9921a623 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs @@ -0,0 +1,68 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the a role definition. + /// + public partial class BillingRoleDefinitionProperties + { + /// + /// Initializes a new instance of the BillingRoleDefinitionProperties class. + /// + public BillingRoleDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleDefinitionProperties class. + /// + + /// The role description + /// + + /// The billingPermissions the role has + /// + + /// The name of the role + /// + public BillingRoleDefinitionProperties(string description = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), string roleName = default(string)) + + { + this.Description = description; + this.Permissions = permissions; + this.RoleName = roleName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the role description + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets or sets the billingPermissions the role has + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "permissions")] + public System.Collections.Generic.IList Permissions {get; set; } + + /// + /// Gets the name of the role + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "roleName")] + public string RoleName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs index e6b5472658b7..a22ca2b90c1f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// A billing subscription. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class BillingSubscription : Resource { /// @@ -32,56 +24,82 @@ public BillingSubscription() /// /// Initializes a new instance of the BillingSubscription class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the subscription. - /// The ID of the subscription. - /// The current billing status - /// of the subscription. Possible values include: 'Active', 'Inactive', - /// 'Abandoned', 'Deleted', 'Warning' - /// The last month charges. - /// The current month to date - /// charges. - /// The ID of the billing profile to - /// which the subscription is billed. - /// The name of the billing - /// profile to which the subscription is billed. - /// The cost center applied to the - /// subscription. - /// The ID of the customer for whom the - /// subscription was created. The field is applicable only for - /// Microsoft Partner Agreement billing account. - /// The name of the customer for whom - /// the subscription was created. The field is applicable only for - /// Microsoft Partner Agreement billing account. - /// The ID of the invoice section to - /// which the subscription is billed. - /// The name of the invoice - /// section to which the subscription is billed. - /// Reseller for this subscription. - /// The sku ID of the Azure plan for the - /// subscription. - /// The sku description of the Azure plan - /// for the subscription. - public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Reseller for this subscription. + /// + + /// The name of the subscription. + /// + + /// The ID of the subscription. + /// + + /// The current billing status of the subscription. + /// Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', + /// 'Warning' + + /// The last month charges. + /// + + /// The current month to date charges. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The cost center applied to the subscription. + /// + + /// The ID of the customer for whom the subscription was created. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the subscription was created. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), Reseller reseller = default(Reseller), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string skuId = default(string), string skuDescription = default(string)) + + : base(id, name, type) { - DisplayName = displayName; - SubscriptionId = subscriptionId; - SubscriptionBillingStatus = subscriptionBillingStatus; - LastMonthCharges = lastMonthCharges; - MonthToDateCharges = monthToDateCharges; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CostCenter = costCenter; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - Reseller = reseller; - SkuId = skuId; - SkuDescription = skuDescription; + this.Reseller = reseller; + this.DisplayName = displayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionBillingStatus = subscriptionBillingStatus; + this.LastMonthCharges = lastMonthCharges; + this.MonthToDateCharges = monthToDateCharges; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CostCenter = costCenter; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; CustomInit(); } @@ -90,105 +108,97 @@ public BillingSubscription() /// partial void CustomInit(); + + /// + /// Gets reseller for this subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller {get; private set; } + /// /// Gets the name of the subscription. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } /// /// Gets the ID of the subscription. /// - [JsonProperty(PropertyName = "properties.subscriptionId")] - public System.Guid? SubscriptionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public System.Guid? SubscriptionId {get; private set; } /// - /// Gets or sets the current billing status of the subscription. - /// Possible values include: 'Active', 'Inactive', 'Abandoned', - /// 'Deleted', 'Warning' + /// Gets or sets the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning' /// - [JsonProperty(PropertyName = "properties.subscriptionBillingStatus")] - public string SubscriptionBillingStatus { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionBillingStatus")] + public string SubscriptionBillingStatus {get; set; } /// /// Gets the last month charges. /// - [JsonProperty(PropertyName = "properties.lastMonthCharges")] - public Amount LastMonthCharges { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastMonthCharges")] + public Amount LastMonthCharges {get; private set; } /// /// Gets the current month to date charges. /// - [JsonProperty(PropertyName = "properties.monthToDateCharges")] - public Amount MonthToDateCharges { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.monthToDateCharges")] + public Amount MonthToDateCharges {get; private set; } /// - /// Gets the ID of the billing profile to which the subscription is - /// billed. + /// Gets the ID of the billing profile to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// - /// Gets the name of the billing profile to which the subscription is - /// billed. + /// Gets the name of the billing profile to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// /// Gets or sets the cost center applied to the subscription. /// - [JsonProperty(PropertyName = "properties.costCenter")] - public string CostCenter { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } /// - /// Gets the ID of the customer for whom the subscription was created. - /// The field is applicable only for Microsoft Partner Agreement - /// billing account. + /// Gets the ID of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerId")] - public string CustomerId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } /// - /// Gets the name of the customer for whom the subscription was - /// created. The field is applicable only for Microsoft Partner - /// Agreement billing account. + /// Gets the name of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerDisplayName")] - public string CustomerDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } /// - /// Gets the ID of the invoice section to which the subscription is - /// billed. + /// Gets the ID of the invoice section to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionId")] - public string InvoiceSectionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } /// - /// Gets the name of the invoice section to which the subscription is - /// billed. + /// Gets the name of the invoice section to which the subscription is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] - public string InvoiceSectionDisplayName { get; private set; } - - /// - /// Gets reseller for this subscription. - /// - [JsonProperty(PropertyName = "properties.reseller")] - public Reseller Reseller { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } /// /// Gets or sets the sku ID of the Azure plan for the subscription. /// - [JsonProperty(PropertyName = "properties.skuId")] - public string SkuId { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; set; } /// /// Gets the sku description of the Azure plan for the subscription. /// - [JsonProperty(PropertyName = "properties.skuDescription")] - public string SkuDescription { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs new file mode 100644 index 000000000000..c7b03bf5a601 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs @@ -0,0 +1,193 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The billing properties of a subscription. + /// + public partial class BillingSubscriptionProperties + { + /// + /// Initializes a new instance of the BillingSubscriptionProperties class. + /// + public BillingSubscriptionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscriptionProperties class. + /// + + /// The name of the subscription. + /// + + /// The ID of the subscription. + /// + + /// The current billing status of the subscription. + /// Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', + /// 'Warning' + + /// The last month charges. + /// + + /// The current month to date charges. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The cost center applied to the subscription. + /// + + /// The ID of the customer for whom the subscription was created. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the subscription was created. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Reseller for this subscription. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingSubscriptionProperties(string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) + + { + this.DisplayName = displayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionBillingStatus = subscriptionBillingStatus; + this.LastMonthCharges = lastMonthCharges; + this.MonthToDateCharges = monthToDateCharges; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CostCenter = costCenter; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.Reseller = reseller; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the name of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the ID of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public System.Guid? SubscriptionId {get; private set; } + + /// + /// Gets or sets the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionBillingStatus")] + public string SubscriptionBillingStatus {get; set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastMonthCharges")] + public Amount LastMonthCharges {get; private set; } + + /// + /// Gets the current month to date charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "monthToDateCharges")] + public Amount MonthToDateCharges {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets reseller for this subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reseller")] + public Reseller Reseller {get; private set; } + + /// + /// Gets or sets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs index d84197a2d14d..7ce390acb8ae 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for BillingSubscriptionStatusType. /// + + public static class BillingSubscriptionStatusType { public const string Active = "Active"; @@ -22,4 +19,4 @@ public static class BillingSubscriptionStatusType public const string Deleted = "Deleted"; public const string Warning = "Warning"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs index 39f89953b85d..66db29fc08f3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for Move operation. - /// public partial class BillingSubscriptionsMoveHeaders { /// - /// Initializes a new instance of the BillingSubscriptionsMoveHeaders - /// class. + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders class. /// public BillingSubscriptionsMoveHeaders() { @@ -28,17 +18,19 @@ public BillingSubscriptionsMoveHeaders() } /// - /// Initializes a new instance of the BillingSubscriptionsMoveHeaders - /// class. + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders class. /// - /// Location URI to poll for result. - /// Recommended time to wait before making - /// another request to check the status of the operation. The time is - /// specified in seconds. + + /// + /// + + /// + /// public BillingSubscriptionsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -47,19 +39,17 @@ public BillingSubscriptionsMoveHeaders() /// partial void CustomInit(); + /// - /// Gets or sets location URI to poll for result. + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets recommended time to wait before making another request - /// to check the status of the operation. The time is specified in - /// seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs index 210b36aeaec9..5690ba5bc1be 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for Category. /// + + public static class Category { public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; public const string AffiliatePurchaseTerms = "AffiliatePurchaseTerms"; public const string Other = "Other"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs index bf625a111fd0..026eab0ba7ae 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// A partner's customer. + /// A partner's customer. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Customer : Resource { /// @@ -34,26 +24,39 @@ public Customer() /// /// Initializes a new instance of the Customer class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The ID of the billing profile for - /// the invoice section. - /// The name of the billing - /// profile for the invoice section. - /// The name of the customer. - /// Azure plans enabled for the - /// customer. - /// The list of resellers for which an Azure - /// plan is enabled for the customer. - public Customer(string id = default(string), string name = default(string), string type = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), IList enabledAzurePlans = default(IList), IList resellers = default(IList)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The name of the customer. + /// + + /// Azure plans enabled for the customer. + /// + + /// The list of resellers for which an Azure plan is enabled for the customer. + /// + public Customer(string id = default(string), string name = default(string), string type = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), System.Collections.Generic.IList resellers = default(System.Collections.Generic.IList)) + + : base(id, name, type) { - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - DisplayName = displayName; - EnabledAzurePlans = enabledAzurePlans; - Resellers = resellers; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.DisplayName = displayName; + this.EnabledAzurePlans = enabledAzurePlans; + this.Resellers = resellers; CustomInit(); } @@ -62,36 +65,36 @@ public Customer() /// partial void CustomInit(); + /// /// Gets the ID of the billing profile for the invoice section. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// /// Gets the name of the billing profile for the invoice section. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// /// Gets or sets the name of the customer. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// /// Gets or sets azure plans enabled for the customer. /// - [JsonProperty(PropertyName = "properties.enabledAzurePlans")] - public IList EnabledAzurePlans { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } /// - /// Gets or sets the list of resellers for which an Azure plan is - /// enabled for the customer. + /// Gets or sets the list of resellers for which an Azure plan is enabled for + /// the customer. /// - [JsonProperty(PropertyName = "properties.resellers")] - public IList Resellers { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resellers")] + public System.Collections.Generic.IList Resellers {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs index 312bd9f3d5c8..705ac937c598 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// - /// The customer's Policy. + /// The customer's Policy. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class CustomerPolicy : Resource { /// @@ -32,16 +24,24 @@ public CustomerPolicy() /// /// Initializes a new instance of the CustomerPolicy class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// 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' + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// 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' public CustomerPolicy(string id = default(string), string name = default(string), string type = default(string), string viewCharges = default(string)) - : base(id, name, type) + + : base(id, name, type) { - ViewCharges = viewCharges; + this.ViewCharges = viewCharges; CustomInit(); } @@ -50,13 +50,12 @@ public CustomerPolicy() /// partial void CustomInit(); + /// - /// Gets or sets 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' + /// Gets or sets 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(PropertyName = "properties.viewCharges")] - public string ViewCharges { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs new file mode 100644 index 000000000000..f17349933dad --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a customer's policy. + /// + public partial class CustomerPolicyProperties + { + /// + /// Initializes a new instance of the CustomerPolicyProperties class. + /// + public CustomerPolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerPolicyProperties class. + /// + + /// 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' + public CustomerPolicyProperties(string viewCharges = default(string)) + + { + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets 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' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs new file mode 100644 index 000000000000..c1eb16eea6eb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a customer. + /// + public partial class CustomerProperties + { + /// + /// Initializes a new instance of the CustomerProperties class. + /// + public CustomerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerProperties class. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The name of the customer. + /// + + /// Azure plans enabled for the customer. + /// + + /// The list of resellers for which an Azure plan is enabled for the customer. + /// + public CustomerProperties(string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), System.Collections.Generic.IList resellers = default(System.Collections.Generic.IList)) + + { + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.DisplayName = displayName; + this.EnabledAzurePlans = enabledAzurePlans; + this.Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the name of the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets azure plans enabled for the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the list of resellers for which an Azure plan is enabled for + /// the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resellers")] + public System.Collections.Generic.IList Resellers {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs index 6b63c084490c..fa427bb1e6ce 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// A department. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Department : Resource { /// @@ -34,23 +24,36 @@ public Department() /// /// Initializes a new instance of the Department class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the department. - /// The cost center associated with the - /// department. - /// The status of the department. - /// Associated enrollment accounts. By - /// default this is not populated, unless it's specified in - /// $expand. - public Department(string id = default(string), string name = default(string), string type = default(string), string departmentName = default(string), string costCenter = default(string), string status = default(string), IList enrollmentAccounts = default(IList)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The name of the department. + /// + + /// The cost center associated with the department. + /// + + /// The status of the department. + /// + + /// Associated enrollment accounts. By default this is not populated, unless + /// it's specified in $expand. + /// + public Department(string id = default(string), string name = default(string), string type = default(string), string departmentName = default(string), string costCenter = default(string), string status = default(string), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList)) + + : base(id, name, type) { - DepartmentName = departmentName; - CostCenter = costCenter; - Status = status; - EnrollmentAccounts = enrollmentAccounts; + this.DepartmentName = departmentName; + this.CostCenter = costCenter; + this.Status = status; + this.EnrollmentAccounts = enrollmentAccounts; CustomInit(); } @@ -59,30 +62,30 @@ public Department() /// partial void CustomInit(); + /// /// Gets or sets the name of the department. /// - [JsonProperty(PropertyName = "properties.departmentName")] - public string DepartmentName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departmentName")] + public string DepartmentName {get; set; } /// /// Gets or sets the cost center associated with the department. /// - [JsonProperty(PropertyName = "properties.costCenter")] - public string CostCenter { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } /// /// Gets or sets the status of the department. /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// /// Gets or sets associated enrollment accounts. By default this is not - /// populated, unless it's specified in $expand. + /// populated, unless it's specified in $expand. /// - [JsonProperty(PropertyName = "properties.enrollmentAccounts")] - public IList EnrollmentAccounts { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs new file mode 100644 index 000000000000..fa09fbdb0153 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a department. + /// + public partial class DepartmentProperties + { + /// + /// Initializes a new instance of the DepartmentProperties class. + /// + public DepartmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DepartmentProperties class. + /// + + /// The name of the department. + /// + + /// The cost center associated with the department. + /// + + /// The status of the department. + /// + + /// Associated enrollment accounts. By default this is not populated, unless + /// it's specified in $expand. + /// + public DepartmentProperties(string departmentName = default(string), string costCenter = default(string), string status = default(string), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList)) + + { + this.DepartmentName = departmentName; + this.CostCenter = costCenter; + this.Status = status; + this.EnrollmentAccounts = enrollmentAccounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "departmentName")] + public string DepartmentName {get; set; } + + /// + /// Gets or sets the cost center associated with the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the status of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets associated enrollment accounts. By default this is not + /// populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs index 974ab59c7b27..861fbe200216 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,17 +23,21 @@ public Document() /// /// Initializes a new instance of the Document class. /// - /// The type of the document. Possible values - /// include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' - /// Document URL. - /// The source of the document. ENF for Brazil and - /// DRS for rest of the world. Possible values include: 'DRS', - /// 'ENF' + + /// The type of the document. + /// Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' + + /// Document URL. + /// + + /// The source of the document. ENF for Brazil and DRS for rest of the world. + /// Possible values include: 'DRS', 'ENF' public Document(string kind = default(string), string url = default(string), string source = default(string)) + { - Kind = kind; - Url = url; - Source = source; + this.Kind = kind; + this.Url = url; + this.Source = source; CustomInit(); } @@ -48,25 +46,24 @@ public Document() /// partial void CustomInit(); + /// - /// Gets the type of the document. Possible values include: 'Invoice', - /// 'VoidNote', 'TaxReceipt', 'CreditNote' + /// Gets the type of the document. Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; private set; } /// /// Gets document URL. /// - [JsonProperty(PropertyName = "url")] - public string Url { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "url")] + public string Url {get; private set; } /// - /// Gets the source of the document. ENF for Brazil and DRS for rest of - /// the world. Possible values include: 'DRS', 'ENF' + /// Gets the source of the document. ENF for Brazil and DRS for rest of the + /// world. Possible values include: 'DRS', 'ENF' /// - [JsonProperty(PropertyName = "source")] - public string Source { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "source")] + public string Source {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs index 95c505550f6e..4534da8794f7 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for DocumentSource. /// + + public static class DocumentSource { public const string DRS = "DRS"; public const string ENF = "ENF"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs index 1ea4d2a5e778..5a388e1ad083 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for DocumentType. /// + + public static class DocumentType { public const string Invoice = "Invoice"; @@ -21,4 +18,4 @@ public static class DocumentType public const string TaxReceipt = "TaxReceipt"; public const string CreditNote = "CreditNote"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs index 9fe7195f5843..776943465180 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -30,13 +24,17 @@ public DownloadUrl() /// /// Initializes a new instance of the DownloadUrl class. /// - /// The time in UTC when the download URL will - /// expire. - /// The URL to the PDF file. + + /// The time in UTC when the download URL will expire. + /// + + /// The URL to the PDF file. + /// public DownloadUrl(System.DateTime? expiryTime = default(System.DateTime?), string url = default(string)) + { - ExpiryTime = expiryTime; - Url = url; + this.ExpiryTime = expiryTime; + this.Url = url; CustomInit(); } @@ -45,17 +43,17 @@ public DownloadUrl() /// partial void CustomInit(); + /// /// Gets the time in UTC when the download URL will expire. /// - [JsonProperty(PropertyName = "expiryTime")] - public System.DateTime? ExpiryTime { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "expiryTime")] + public System.DateTime? ExpiryTime {get; private set; } /// /// Gets the URL to the PDF file. /// - [JsonProperty(PropertyName = "url")] - public string Url { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "url")] + public string Url {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs index 2a45edbd0101..a79b8f83756f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,30 +23,45 @@ public Enrollment() /// /// Initializes a new instance of the Enrollment class. /// - /// The start date of the enrollment. - /// The end date of the enrollment. - /// The billing currency for the - /// enrollment. - /// The channel type of the enrollment. - /// The policies for Enterprise Agreement - /// enrollments. - /// The language for the enrollment. - /// The country code of the - /// enrollment. - /// The current status of the enrollment. - /// The billing cycle for the - /// enrollment. + + /// The start date of the enrollment. + /// + + /// The end date of the enrollment. + /// + + /// The billing currency for the enrollment. + /// + + /// The channel type of the enrollment. + /// + + /// The policies for Enterprise Agreement enrollments. + /// + + /// The language for the enrollment. + /// + + /// The country code of the enrollment. + /// + + /// The current status of the enrollment. + /// + + /// The billing cycle for the enrollment. + /// public Enrollment(System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string currency = default(string), string channel = default(string), EnrollmentPolicies policies = default(EnrollmentPolicies), string language = default(string), string countryCode = default(string), string status = default(string), string billingCycle = default(string)) + { - StartDate = startDate; - EndDate = endDate; - Currency = currency; - Channel = channel; - Policies = policies; - Language = language; - CountryCode = countryCode; - Status = status; - BillingCycle = billingCycle; + this.StartDate = startDate; + this.EndDate = endDate; + this.Currency = currency; + this.Channel = channel; + this.Policies = policies; + this.Language = language; + this.CountryCode = countryCode; + this.Status = status; + this.BillingCycle = billingCycle; CustomInit(); } @@ -61,59 +70,59 @@ public Enrollment() /// partial void CustomInit(); + /// /// Gets or sets the start date of the enrollment. /// - [JsonProperty(PropertyName = "startDate")] - public System.DateTime? StartDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } /// /// Gets or sets the end date of the enrollment. /// - [JsonProperty(PropertyName = "endDate")] - public System.DateTime? EndDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } /// /// Gets the billing currency for the enrollment. /// - [JsonProperty(PropertyName = "currency")] - public string Currency { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } /// /// Gets the channel type of the enrollment. /// - [JsonProperty(PropertyName = "channel")] - public string Channel { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "channel")] + public string Channel {get; private set; } /// /// Gets the policies for Enterprise Agreement enrollments. /// - [JsonProperty(PropertyName = "policies")] - public EnrollmentPolicies Policies { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "policies")] + public EnrollmentPolicies Policies {get; private set; } /// /// Gets the language for the enrollment. /// - [JsonProperty(PropertyName = "language")] - public string Language { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "language")] + public string Language {get; private set; } /// /// Gets the country code of the enrollment. /// - [JsonProperty(PropertyName = "countryCode")] - public string CountryCode { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "countryCode")] + public string CountryCode {get; private set; } /// /// Gets the current status of the enrollment. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } /// /// Gets the billing cycle for the enrollment. /// - [JsonProperty(PropertyName = "billingCycle")] - public string BillingCycle { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "billingCycle")] + public string BillingCycle {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs index 140c2fb209c5..166721d1486a 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// An enrollment account. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class EnrollmentAccount : Resource { /// @@ -32,32 +24,48 @@ public EnrollmentAccount() /// /// Initializes a new instance of the EnrollmentAccount class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the enrollment - /// account. - /// The cost center associated with the - /// enrollment account. - /// The owner of the enrollment - /// account. - /// The status of the enrollment account. - /// The start date of the enrollment - /// account. - /// The end date of the enrollment - /// account. - /// Associated department. By default this is - /// not populated, unless it's specified in $expand. - public EnrollmentAccount(string id = default(string), string name = default(string), string type = default(string), string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), Department department = default(Department)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Associated department. By default this is not populated, unless it's + /// specified in $expand. + /// + + /// The name of the enrollment account. + /// + + /// The cost center associated with the enrollment account. + /// + + /// The owner of the enrollment account. + /// + + /// The status of the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + public EnrollmentAccount(string id = default(string), string name = default(string), string type = default(string), Department department = default(Department), string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?)) + + : base(id, name, type) { - AccountName = accountName; - CostCenter = costCenter; - AccountOwner = accountOwner; - Status = status; - StartDate = startDate; - EndDate = endDate; - Department = department; + this.Department = department; + this.AccountName = accountName; + this.CostCenter = costCenter; + this.AccountOwner = accountOwner; + this.Status = status; + this.StartDate = startDate; + this.EndDate = endDate; CustomInit(); } @@ -66,49 +74,48 @@ public EnrollmentAccount() /// partial void CustomInit(); + + /// + /// Gets or sets associated department. By default this is not populated, + /// unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.department")] + public Department Department {get; set; } + /// /// Gets or sets the name of the enrollment account. /// - [JsonProperty(PropertyName = "properties.accountName")] - public string AccountName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountName")] + public string AccountName {get; set; } /// - /// Gets or sets the cost center associated with the enrollment - /// account. + /// Gets or sets the cost center associated with the enrollment account. /// - [JsonProperty(PropertyName = "properties.costCenter")] - public string CostCenter { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } /// /// Gets or sets the owner of the enrollment account. /// - [JsonProperty(PropertyName = "properties.accountOwner")] - public string AccountOwner { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountOwner")] + public string AccountOwner {get; set; } /// /// Gets or sets the status of the enrollment account. /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// /// Gets or sets the start date of the enrollment account. /// - [JsonProperty(PropertyName = "properties.startDate")] - public System.DateTime? StartDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate {get; set; } /// /// Gets or sets the end date of the enrollment account. /// - [JsonProperty(PropertyName = "properties.endDate")] - public System.DateTime? EndDate { get; set; } - - /// - /// Gets or sets associated department. By default this is not - /// populated, unless it's specified in $expand. - /// - [JsonProperty(PropertyName = "properties.department")] - public Department Department { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs index 650e0b3eb3b0..5dea5c6bd125 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,20 +23,25 @@ public EnrollmentAccountContext() /// /// Initializes a new instance of the EnrollmentAccountContext class. /// - /// The cost center associated with the - /// enrollment account. - /// The start date of the enrollment - /// account. - /// The end date of the enrollment - /// account. - /// The ID of the enrollment - /// account. + + /// The cost center associated with the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + + /// The ID of the enrollment account. + /// public EnrollmentAccountContext(string costCenter = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string enrollmentAccountName = default(string)) + { - CostCenter = costCenter; - StartDate = startDate; - EndDate = endDate; - EnrollmentAccountName = enrollmentAccountName; + this.CostCenter = costCenter; + this.StartDate = startDate; + this.EndDate = endDate; + this.EnrollmentAccountName = enrollmentAccountName; CustomInit(); } @@ -51,30 +50,29 @@ public EnrollmentAccountContext() /// partial void CustomInit(); + /// - /// Gets or sets the cost center associated with the enrollment - /// account. + /// Gets or sets the cost center associated with the enrollment account. /// - [JsonProperty(PropertyName = "costCenter")] - public string CostCenter { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } /// /// Gets or sets the start date of the enrollment account. /// - [JsonProperty(PropertyName = "startDate")] - public System.DateTime? StartDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } /// /// Gets or sets the end date of the enrollment account. /// - [JsonProperty(PropertyName = "endDate")] - public System.DateTime? EndDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } /// /// Gets or sets the ID of the enrollment account. /// - [JsonProperty(PropertyName = "enrollmentAccountName")] - public string EnrollmentAccountName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccountName")] + public string EnrollmentAccountName {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs new file mode 100644 index 000000000000..a10a83c5327e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs @@ -0,0 +1,110 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an enrollment account. + /// + public partial class EnrollmentAccountProperties + { + /// + /// Initializes a new instance of the EnrollmentAccountProperties class. + /// + public EnrollmentAccountProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountProperties class. + /// + + /// The name of the enrollment account. + /// + + /// The cost center associated with the enrollment account. + /// + + /// The owner of the enrollment account. + /// + + /// The status of the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + + /// Associated department. By default this is not populated, unless it's + /// specified in $expand. + /// + public EnrollmentAccountProperties(string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), Department department = default(Department)) + + { + this.AccountName = accountName; + this.CostCenter = costCenter; + this.AccountOwner = accountOwner; + this.Status = status; + this.StartDate = startDate; + this.EndDate = endDate; + this.Department = department; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] + public string AccountName {get; set; } + + /// + /// Gets or sets the cost center associated with the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the owner of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountOwner")] + public string AccountOwner {get; set; } + + /// + /// Gets or sets the status of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } + + /// + /// Gets or sets associated department. By default this is not populated, + /// unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "department")] + public Department Department {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs new file mode 100644 index 000000000000..499a57819d12 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An enrollment account resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class EnrollmentAccountSummary : Resource + { + /// + /// Initializes a new instance of the EnrollmentAccountSummary class. + /// + public EnrollmentAccountSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountSummary class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The account owner's principal name. + /// + public EnrollmentAccountSummary(string id = default(string), string name = default(string), string type = default(string), string principalName = default(string)) + + : base(id, name, type) + { + this.PrincipalName = principalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the account owner's principal name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs new file mode 100644 index 000000000000..d56ee50f83d3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the enrollment account. + /// + public partial class EnrollmentAccountSummaryProperties + { + /// + /// Initializes a new instance of the EnrollmentAccountSummaryProperties class. + /// + public EnrollmentAccountSummaryProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountSummaryProperties class. + /// + + /// The account owner's principal name. + /// + public EnrollmentAccountSummaryProperties(string principalName = default(string)) + + { + this.PrincipalName = principalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the account owner's principal name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs index a01dd23728c3..b409296fba41 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,21 +23,28 @@ public EnrollmentPolicies() /// /// Initializes a new instance of the EnrollmentPolicies class. /// - /// The policy that controls - /// whether Account Owners can view charges. - /// The policy that controls - /// whether Department Administrators can view charges. - /// The policy that controls whether - /// Azure marketplace purchases are allowed in the enrollment. - /// The policy that controls - /// whether Azure reservation purchases are allowed in the - /// enrollment. + + /// The policy that controls whether Account Owners can view charges. + /// + + /// The policy that controls whether Department Administrators can view + /// charges. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed in + /// the enrollment. + /// + + /// The policy that controls whether Azure reservation purchases are allowed in + /// the enrollment. + /// public EnrollmentPolicies(bool? accountOwnerViewCharges = default(bool?), bool? departmentAdminViewCharges = default(bool?), bool? marketplacesEnabled = default(bool?), bool? reservedInstancesEnabled = default(bool?)) + { - AccountOwnerViewCharges = accountOwnerViewCharges; - DepartmentAdminViewCharges = departmentAdminViewCharges; - MarketplacesEnabled = marketplacesEnabled; - ReservedInstancesEnabled = reservedInstancesEnabled; + this.AccountOwnerViewCharges = accountOwnerViewCharges; + this.DepartmentAdminViewCharges = departmentAdminViewCharges; + this.MarketplacesEnabled = marketplacesEnabled; + this.ReservedInstancesEnabled = reservedInstancesEnabled; CustomInit(); } @@ -52,33 +53,32 @@ public EnrollmentPolicies() /// partial void CustomInit(); + /// - /// Gets the policy that controls whether Account Owners can view - /// charges. + /// Gets the policy that controls whether Account Owners can view charges. /// - [JsonProperty(PropertyName = "accountOwnerViewCharges")] - public bool? AccountOwnerViewCharges { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "accountOwnerViewCharges")] + public bool? AccountOwnerViewCharges {get; private set; } /// - /// Gets the policy that controls whether Department Administrators can - /// view charges. + /// Gets the policy that controls whether Department Administrators can view + /// charges. /// - [JsonProperty(PropertyName = "departmentAdminViewCharges")] - public bool? DepartmentAdminViewCharges { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "departmentAdminViewCharges")] + public bool? DepartmentAdminViewCharges {get; private set; } /// - /// Gets the policy that controls whether Azure marketplace purchases - /// are allowed in the enrollment. + /// Gets the policy that controls whether Azure marketplace purchases are + /// allowed in the enrollment. /// - [JsonProperty(PropertyName = "marketplacesEnabled")] - public bool? MarketplacesEnabled { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "marketplacesEnabled")] + public bool? MarketplacesEnabled {get; private set; } /// - /// Gets the policy that controls whether Azure reservation purchases - /// are allowed in the enrollment. + /// Gets the policy that controls whether Azure reservation purchases are + /// allowed in the enrollment. /// - [JsonProperty(PropertyName = "reservedInstancesEnabled")] - public bool? ReservedInstancesEnabled { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "reservedInstancesEnabled")] + public bool? ReservedInstancesEnabled {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs index 2abc90d1ef82..12b69cd1b94b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,15 +23,21 @@ public ErrorDetails() /// /// Initializes a new instance of the ErrorDetails class. /// - /// Error code. - /// Error message indicating why the operation - /// failed. - /// The target of the particular error. + + /// Error code. + /// + + /// Error message indicating why the operation failed. + /// + + /// The target of the particular error. + /// public ErrorDetails(string code = default(string), string message = default(string), string target = default(string)) + { - Code = code; - Message = message; - Target = target; + this.Code = code; + this.Message = message; + this.Target = target; CustomInit(); } @@ -46,23 +46,23 @@ public ErrorDetails() /// partial void CustomInit(); + /// /// Gets error code. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; private set; } /// /// Gets error message indicating why the operation failed. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; private set; } /// /// Gets the target of the particular error. /// - [JsonProperty(PropertyName = "target")] - public string Target { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs index 6c39de5c6789..4f3c56b5d4cd 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -30,10 +24,13 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// The details of the error. + + /// The details of the error. + /// public ErrorResponse(ErrorDetails error = default(ErrorDetails)) + { - Error = error; + this.Error = error; CustomInit(); } @@ -42,11 +39,11 @@ public ErrorResponse() /// partial void CustomInit(); + /// /// Gets or sets the details of the error. /// - [JsonProperty(PropertyName = "error")] - public ErrorDetails Error { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorDetails Error {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs index 9d05048b6e32..4a32f819da4b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs @@ -1,32 +1,25 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; /// - /// Exception thrown for an invalid response with ErrorResponse - /// information. + /// Exception thrown for an invalid response with ErrorResponse information. /// - public partial class ErrorResponseException : RestException + public partial class ErrorResponseException : Microsoft.Rest.RestException { /// /// Gets information about the associated HTTP request. /// - public HttpRequestMessageWrapper Request { get; set; } + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } /// /// Gets information about the associated HTTP response. /// - public HttpResponseMessageWrapper Response { get; set; } + public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; } /// /// Gets or sets the body object. @@ -41,7 +34,7 @@ public ErrorResponseException() } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorResponse class. /// /// The exception message. public ErrorResponseException(string message) @@ -50,7 +43,7 @@ public ErrorResponseException(string message) } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorResponse class. /// /// The exception message. /// Inner exception. @@ -59,4 +52,4 @@ public ErrorResponseException(string message, System.Exception innerException) { } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs index 5fd2787f50e4..2e05f80532d7 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// An instruction. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Instruction : Resource { /// @@ -32,24 +24,35 @@ public Instruction() /// /// Initializes a new instance of the Instruction class. /// - /// The amount budgeted for this billing - /// instruction. - /// The date this billing instruction goes into - /// effect. - /// The date this billing instruction is no - /// longer in effect. - /// Resource Id. - /// Resource name. - /// Resource type. - /// The date this billing instruction was - /// created. - public Instruction(double amount, System.DateTime startDate, System.DateTime endDate, string id = default(string), string name = default(string), string type = default(string), System.DateTime? creationDate = default(System.DateTime?)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The amount budgeted for this billing instruction. + /// + + /// The date this billing instruction goes into effect. + /// + + /// The date this billing instruction is no longer in effect. + /// + + /// The date this billing instruction was created. + /// + public Instruction(string id = default(string), string name = default(string), string type = default(string), double? amount = default(double?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), System.DateTime? creationDate = default(System.DateTime?)) + + : base(id, name, type) { - Amount = amount; - StartDate = startDate; - EndDate = endDate; - CreationDate = creationDate; + this.Amount = amount; + this.StartDate = startDate; + this.EndDate = endDate; + this.CreationDate = creationDate; CustomInit(); } @@ -58,40 +61,29 @@ public Instruction() /// partial void CustomInit(); + /// /// Gets or sets the amount budgeted for this billing instruction. /// - [JsonProperty(PropertyName = "properties.amount")] - public double Amount { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amount")] + public double? Amount {get; set; } /// /// Gets or sets the date this billing instruction goes into effect. /// - [JsonProperty(PropertyName = "properties.startDate")] - public System.DateTime StartDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate {get; set; } /// - /// Gets or sets the date this billing instruction is no longer in - /// effect. + /// Gets or sets the date this billing instruction is no longer in effect. /// - [JsonProperty(PropertyName = "properties.endDate")] - public System.DateTime EndDate { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; set; } /// /// Gets or sets the date this billing instruction was created. /// - [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs new file mode 100644 index 000000000000..cfc4dcf66408 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing instruction used during invoice generation. + /// + public partial class InstructionProperties + { + /// + /// Initializes a new instance of the InstructionProperties class. + /// + public InstructionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstructionProperties class. + /// + + /// The amount budgeted for this billing instruction. + /// + + /// The date this billing instruction goes into effect. + /// + + /// The date this billing instruction is no longer in effect. + /// + + /// The date this billing instruction was created. + /// + public InstructionProperties(double amount, System.DateTime startDate, System.DateTime endDate, System.DateTime? creationDate = default(System.DateTime?)) + + { + this.Amount = amount; + this.StartDate = startDate; + this.EndDate = endDate; + this.CreationDate = creationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the amount budgeted for this billing instruction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public double Amount {get; set; } + + /// + /// Gets or sets the date this billing instruction goes into effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime StartDate {get; set; } + + /// + /// Gets or sets the date this billing instruction is no longer in effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime EndDate {get; set; } + + /// + /// Gets or sets the date this billing instruction was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs index 6d360f88ac10..a940eef5a0f7 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An invoice. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Invoice : Resource { /// @@ -34,81 +24,114 @@ public Invoice() /// /// Initializes a new instance of the Invoice class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The due date for the invoice. - /// The date when the invoice was - /// generated. - /// The current status of the invoice. Possible - /// values include: 'Due', 'OverDue', 'Paid' - /// The amount due as of now. - /// The amount of Azure prepayment - /// applied to the charges. This field is applicable to billing - /// accounts with agreement type Microsoft Customer Agreement. - /// The total charges for the invoice - /// billing period. - /// 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. - /// The amount of free Azure - /// credits applied to the charges. This field is applicable to billing - /// accounts with agreement type Microsoft Customer Agreement. - /// The pre-tax amount due. This field is - /// applicable to billing accounts with agreement type Microsoft - /// Customer Agreement. - /// The amount of tax charged for the billing - /// period. This field is applicable to billing accounts with agreement - /// type Microsoft Customer Agreement. - /// The amount due when the invoice was - /// generated. This field is applicable to billing accounts with - /// agreement type Microsoft Customer Agreement. - /// The start date of the billing - /// period for which the invoice is generated. - /// The end date of the billing - /// period for which the invoice is generated. - /// Invoice type. Possible values include: - /// 'AzureService', 'AzureMarketplace', 'AzureSupport' - /// 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. - /// The ID of the billing profile for - /// which the invoice is generated. - /// The name of the billing - /// profile for which the invoice is generated. - /// An optional purchase order number - /// for the invoice. - /// List of documents available to download - /// such as invoice and tax receipt. - /// List of payments. - /// The ID of the subscription for which - /// the invoice is generated. - public Invoice(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string invoiceType = default(string), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), IList documents = default(IList), IList payments = default(IList), string subscriptionId = default(string)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The amount due as of now. + /// + + /// Invoice type. + /// Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + + /// The due date for the invoice. + /// + + /// The date when the invoice was generated. + /// + + /// The current status of the invoice. + /// Possible values include: 'Due', 'OverDue', 'Paid' + + /// The amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The total charges for the invoice billing period. + /// + + /// 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. + /// + + /// The amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The pre-tax amount due. This field is applicable to billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + + /// The amount of tax charged for the billing period. This field is applicable + /// to billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The amount due when the invoice was generated. This field is applicable to + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The start date of the billing period for which the invoice is generated. + /// + + /// The end date of the billing period for which the invoice is generated. + /// + + /// 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. + /// + + /// The ID of the billing profile for which the invoice is generated. + /// + + /// The name of the billing profile for which the invoice is generated. + /// + + /// An optional purchase order number for the invoice. + /// + + /// List of documents available to download such as invoice and tax receipt. + /// + + /// List of payments. + /// + + /// The ID of the subscription for which the invoice is generated. + /// + public Invoice(string id = default(string), string name = default(string), string type = default(string), Amount amountDue = default(Amount), string invoiceType = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), System.Collections.Generic.IList documents = default(System.Collections.Generic.IList), System.Collections.Generic.IList payments = default(System.Collections.Generic.IList), string subscriptionId = default(string)) + + : base(id, name, type) { - DueDate = dueDate; - InvoiceDate = invoiceDate; - Status = status; - AmountDue = amountDue; - AzurePrepaymentApplied = azurePrepaymentApplied; - BilledAmount = billedAmount; - CreditAmount = creditAmount; - FreeAzureCreditApplied = freeAzureCreditApplied; - SubTotal = subTotal; - TaxAmount = taxAmount; - TotalAmount = totalAmount; - InvoicePeriodStartDate = invoicePeriodStartDate; - InvoicePeriodEndDate = invoicePeriodEndDate; - InvoiceType = invoiceType; - IsMonthlyInvoice = isMonthlyInvoice; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - PurchaseOrderNumber = purchaseOrderNumber; - Documents = documents; - Payments = payments; - SubscriptionId = subscriptionId; + this.AmountDue = amountDue; + this.InvoiceType = invoiceType; + this.DueDate = dueDate; + this.InvoiceDate = invoiceDate; + this.Status = status; + this.AzurePrepaymentApplied = azurePrepaymentApplied; + this.BilledAmount = billedAmount; + this.CreditAmount = creditAmount; + this.FreeAzureCreditApplied = freeAzureCreditApplied; + this.SubTotal = subTotal; + this.TaxAmount = taxAmount; + this.TotalAmount = totalAmount; + this.InvoicePeriodStartDate = invoicePeriodStartDate; + this.InvoicePeriodEndDate = invoicePeriodEndDate; + this.IsMonthlyInvoice = isMonthlyInvoice; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.PurchaseOrderNumber = purchaseOrderNumber; + this.Documents = documents; + this.Payments = payments; + this.SubscriptionId = subscriptionId; CustomInit(); } @@ -117,151 +140,146 @@ public Invoice() /// partial void CustomInit(); + /// - /// Gets the due date for the invoice. + /// Gets the amount due as of now. /// - [JsonProperty(PropertyName = "properties.dueDate")] - public System.DateTime? DueDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amountDue")] + public Amount AmountDue {get; private set; } /// - /// Gets the date when the invoice was generated. + /// Gets invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' /// - [JsonProperty(PropertyName = "properties.invoiceDate")] - public System.DateTime? InvoiceDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceType")] + public string InvoiceType {get; private set; } /// - /// Gets the current status of the invoice. Possible values include: - /// 'Due', 'OverDue', 'Paid' + /// Gets the due date for the invoice. /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dueDate")] + public System.DateTime? DueDate {get; private set; } /// - /// Gets the amount due as of now. + /// Gets the date when the invoice was generated. /// - [JsonProperty(PropertyName = "properties.amountDue")] - public Amount AmountDue { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceDate")] + public System.DateTime? InvoiceDate {get; private set; } /// - /// Gets the amount of Azure prepayment applied to the charges. This - /// field is applicable to billing accounts with agreement type - /// Microsoft Customer Agreement. + /// Gets the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid' /// - [JsonProperty(PropertyName = "properties.azurePrepaymentApplied")] - public Amount AzurePrepaymentApplied { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } /// - /// Gets the total charges for the invoice billing period. + /// Gets the amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. /// - [JsonProperty(PropertyName = "properties.billedAmount")] - public Amount BilledAmount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azurePrepaymentApplied")] + public Amount AzurePrepaymentApplied {get; private set; } /// - /// Gets 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. + /// Gets the total charges for the invoice billing period. /// - [JsonProperty(PropertyName = "properties.creditAmount")] - public Amount CreditAmount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billedAmount")] + public Amount BilledAmount {get; private set; } /// - /// Gets the amount of free Azure credits applied to the charges. This - /// field is applicable to billing accounts with agreement type - /// Microsoft Customer Agreement. + /// Gets 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(PropertyName = "properties.freeAzureCreditApplied")] - public Amount FreeAzureCreditApplied { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creditAmount")] + public Amount CreditAmount {get; private set; } /// - /// Gets the pre-tax amount due. This field is applicable to billing - /// accounts with agreement type Microsoft Customer Agreement. + /// Gets the amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. /// - [JsonProperty(PropertyName = "properties.subTotal")] - public Amount SubTotal { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.freeAzureCreditApplied")] + public Amount FreeAzureCreditApplied {get; private set; } /// - /// Gets the amount of tax charged for the billing period. This field - /// is applicable to billing accounts with agreement type Microsoft - /// Customer Agreement. + /// Gets the pre-tax amount due. This field is applicable to billing accounts + /// with agreement type Microsoft Customer Agreement. /// - [JsonProperty(PropertyName = "properties.taxAmount")] - public Amount TaxAmount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal {get; private set; } /// - /// Gets the amount due when the invoice was generated. This field is - /// applicable to billing accounts with agreement type Microsoft - /// Customer Agreement. + /// Gets the amount of tax charged for the billing period. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. /// - [JsonProperty(PropertyName = "properties.totalAmount")] - public Amount TotalAmount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taxAmount")] + public Amount TaxAmount {get; private set; } /// - /// Gets the start date of the billing period for which the invoice is - /// generated. + /// Gets the amount due when the invoice was generated. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. /// - [JsonProperty(PropertyName = "properties.invoicePeriodStartDate")] - public System.DateTime? InvoicePeriodStartDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.totalAmount")] + public Amount TotalAmount {get; private set; } /// - /// Gets the end date of the billing period for which the invoice is + /// Gets the start date of the billing period for which the invoice is /// generated. /// - [JsonProperty(PropertyName = "properties.invoicePeriodEndDate")] - public System.DateTime? InvoicePeriodEndDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoicePeriodStartDate")] + public System.DateTime? InvoicePeriodStartDate {get; private set; } /// - /// Gets invoice type. Possible values include: 'AzureService', - /// 'AzureMarketplace', 'AzureSupport' + /// Gets the end date of the billing period for which the invoice is generated. /// - [JsonProperty(PropertyName = "properties.invoiceType")] - public string InvoiceType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoicePeriodEndDate")] + public System.DateTime? InvoicePeriodEndDate {get; private set; } /// - /// Gets 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. + /// Gets 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(PropertyName = "properties.isMonthlyInvoice")] - public bool? IsMonthlyInvoice { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isMonthlyInvoice")] + public bool? IsMonthlyInvoice {get; private set; } /// - /// Gets the ID of the billing profile for which the invoice is - /// generated. + /// Gets the ID of the billing profile for which the invoice is generated. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// - /// Gets the name of the billing profile for which the invoice is - /// generated. + /// Gets the name of the billing profile for which the invoice is generated. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// /// Gets an optional purchase order number for the invoice. /// - [JsonProperty(PropertyName = "properties.purchaseOrderNumber")] - public string PurchaseOrderNumber { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.purchaseOrderNumber")] + public string PurchaseOrderNumber {get; private set; } /// - /// Gets list of documents available to download such as invoice and - /// tax receipt. + /// Gets list of documents available to download such as invoice and tax + /// receipt. /// - [JsonProperty(PropertyName = "properties.documents")] - public IList Documents { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.documents")] + public System.Collections.Generic.IList Documents {get; private set; } /// /// Gets list of payments. /// - [JsonProperty(PropertyName = "properties.payments")] - public IList Payments { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.payments")] + public System.Collections.Generic.IList Payments {get; private set; } /// /// Gets the ID of the subscription for which the invoice is generated. /// - [JsonProperty(PropertyName = "properties.subscriptionId")] - public string SubscriptionId { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs new file mode 100644 index 000000000000..ea0f453cfb43 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs @@ -0,0 +1,274 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the invoice. + /// + public partial class InvoiceProperties + { + /// + /// Initializes a new instance of the InvoiceProperties class. + /// + public InvoiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceProperties class. + /// + + /// The due date for the invoice. + /// + + /// The date when the invoice was generated. + /// + + /// The current status of the invoice. + /// Possible values include: 'Due', 'OverDue', 'Paid' + + /// The amount due as of now. + /// + + /// The amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The total charges for the invoice billing period. + /// + + /// 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. + /// + + /// The amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The pre-tax amount due. This field is applicable to billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + + /// The amount of tax charged for the billing period. This field is applicable + /// to billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The amount due when the invoice was generated. This field is applicable to + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The start date of the billing period for which the invoice is generated. + /// + + /// The end date of the billing period for which the invoice is generated. + /// + + /// Invoice type. + /// Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + + /// 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. + /// + + /// The ID of the billing profile for which the invoice is generated. + /// + + /// The name of the billing profile for which the invoice is generated. + /// + + /// An optional purchase order number for the invoice. + /// + + /// List of documents available to download such as invoice and tax receipt. + /// + + /// List of payments. + /// + + /// The ID of the subscription for which the invoice is generated. + /// + public InvoiceProperties(System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string invoiceType = default(string), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), System.Collections.Generic.IList documents = default(System.Collections.Generic.IList), System.Collections.Generic.IList payments = default(System.Collections.Generic.IList), string subscriptionId = default(string)) + + { + this.DueDate = dueDate; + this.InvoiceDate = invoiceDate; + this.Status = status; + this.AmountDue = amountDue; + this.AzurePrepaymentApplied = azurePrepaymentApplied; + this.BilledAmount = billedAmount; + this.CreditAmount = creditAmount; + this.FreeAzureCreditApplied = freeAzureCreditApplied; + this.SubTotal = subTotal; + this.TaxAmount = taxAmount; + this.TotalAmount = totalAmount; + this.InvoicePeriodStartDate = invoicePeriodStartDate; + this.InvoicePeriodEndDate = invoicePeriodEndDate; + this.InvoiceType = invoiceType; + this.IsMonthlyInvoice = isMonthlyInvoice; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.PurchaseOrderNumber = purchaseOrderNumber; + this.Documents = documents; + this.Payments = payments; + this.SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the due date for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dueDate")] + public System.DateTime? DueDate {get; private set; } + + /// + /// Gets the date when the invoice was generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceDate")] + public System.DateTime? InvoiceDate {get; private set; } + + /// + /// Gets the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets the amount due as of now. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amountDue")] + public Amount AmountDue {get; private set; } + + /// + /// Gets the amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azurePrepaymentApplied")] + public Amount AzurePrepaymentApplied {get; private set; } + + /// + /// Gets the total charges for the invoice billing period. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billedAmount")] + public Amount BilledAmount {get; private set; } + + /// + /// Gets 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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creditAmount")] + public Amount CreditAmount {get; private set; } + + /// + /// Gets the amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "freeAzureCreditApplied")] + public Amount FreeAzureCreditApplied {get; private set; } + + /// + /// Gets the pre-tax amount due. This field is applicable to billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the amount of tax charged for the billing period. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taxAmount")] + public Amount TaxAmount {get; private set; } + + /// + /// Gets the amount due when the invoice was generated. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "totalAmount")] + public Amount TotalAmount {get; private set; } + + /// + /// Gets the start date of the billing period for which the invoice is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoicePeriodStartDate")] + public System.DateTime? InvoicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the billing period for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoicePeriodEndDate")] + public System.DateTime? InvoicePeriodEndDate {get; private set; } + + /// + /// Gets invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceType")] + public string InvoiceType {get; private set; } + + /// + /// Gets 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. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMonthlyInvoice")] + public bool? IsMonthlyInvoice {get; private set; } + + /// + /// Gets the ID of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets an optional purchase order number for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "purchaseOrderNumber")] + public string PurchaseOrderNumber {get; private set; } + + /// + /// Gets list of documents available to download such as invoice and tax + /// receipt. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "documents")] + public System.Collections.Generic.IList Documents {get; private set; } + + /// + /// Gets list of payments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "payments")] + public System.Collections.Generic.IList Payments {get; private set; } + + /// + /// Gets the ID of the subscription for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs index 1a7aaac35a84..76531f1fd1ba 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// An invoice section. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class InvoiceSection : Resource { /// @@ -34,20 +24,31 @@ public InvoiceSection() /// /// Initializes a new instance of the InvoiceSection class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The name of the invoice section. - /// Dictionary of metadata associated with the - /// invoice section. - /// The system generated unique identifier for - /// an invoice section. - public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IDictionary labels = default(IDictionary), string systemId = default(string)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The name of the invoice section. + /// + + /// Dictionary of metadata associated with the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), string systemId = default(string)) + + : base(id, name, type) { - DisplayName = displayName; - Labels = labels; - SystemId = systemId; + this.DisplayName = displayName; + this.Labels = labels; + this.SystemId = systemId; CustomInit(); } @@ -56,24 +57,23 @@ public InvoiceSection() /// partial void CustomInit(); + /// /// Gets or sets the name of the invoice section. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } /// - /// Gets or sets dictionary of metadata associated with the invoice - /// section. + /// Gets or sets dictionary of metadata associated with the invoice section. /// - [JsonProperty(PropertyName = "properties.labels")] - public IDictionary Labels { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labels")] + public System.Collections.Generic.IDictionary Labels {get; set; } /// /// Gets the system generated unique identifier for an invoice section. /// - [JsonProperty(PropertyName = "properties.systemId")] - public string SystemId { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.systemId")] + public string SystemId {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs index aabc5101d2f2..9ac947af68dc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class InvoiceSectionCreationRequest { /// - /// Initializes a new instance of the InvoiceSectionCreationRequest - /// class. + /// Initializes a new instance of the InvoiceSectionCreationRequest class. /// public InvoiceSectionCreationRequest() { @@ -28,13 +21,15 @@ public InvoiceSectionCreationRequest() } /// - /// Initializes a new instance of the InvoiceSectionCreationRequest - /// class. + /// Initializes a new instance of the InvoiceSectionCreationRequest class. /// - /// The name of the invoice section. + + /// The name of the invoice section. + /// public InvoiceSectionCreationRequest(string displayName = default(string)) + { - DisplayName = displayName; + this.DisplayName = displayName; CustomInit(); } @@ -43,11 +38,11 @@ public InvoiceSectionCreationRequest() /// partial void CustomInit(); + /// /// Gets or sets the name of the invoice section. /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs new file mode 100644 index 000000000000..f18f9af0a9cc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs @@ -0,0 +1,68 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an invoice section. + /// + public partial class InvoiceSectionProperties + { + /// + /// Initializes a new instance of the InvoiceSectionProperties class. + /// + public InvoiceSectionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionProperties class. + /// + + /// The name of the invoice section. + /// + + /// Dictionary of metadata associated with the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + public InvoiceSectionProperties(string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), string systemId = default(string)) + + { + this.DisplayName = displayName; + this.Labels = labels; + this.SystemId = systemId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets dictionary of metadata associated with the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labels")] + public System.Collections.Generic.IDictionary Labels {get; set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "systemId")] + public string SystemId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs index 3d02822f8b68..31c2d4359911 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -21,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class InvoiceSectionWithCreateSubPermission { /// - /// Initializes a new instance of the - /// InvoiceSectionWithCreateSubPermission class. + /// Initializes a new instance of the InvoiceSectionWithCreateSubPermission class. /// public InvoiceSectionWithCreateSubPermission() { @@ -30,43 +21,52 @@ public InvoiceSectionWithCreateSubPermission() } /// - /// Initializes a new instance of the - /// InvoiceSectionWithCreateSubPermission class. + /// Initializes a new instance of the InvoiceSectionWithCreateSubPermission class. /// - /// The ID of the invoice - /// section. - /// The name of the invoice - /// section. - /// The system generated unique - /// identifier for an invoice section. - /// The ID of the billing profile for - /// the invoice section. - /// The name of the billing - /// profile for the invoice section. - /// The status of the billing - /// profile. Possible values include: 'Active', 'Disabled', - /// 'Warned' - /// Reason for the - /// specified billing profile status. Possible values include: - /// 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' - /// The billing profile - /// spending limit. Possible values include: 'Off', 'On' - /// The system generated unique - /// identifier for a billing profile. - /// Enabled azure plans for the - /// associated billing profile. - public InvoiceSectionWithCreateSubPermission(string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string invoiceSectionSystemId = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string billingProfileSystemId = default(string), IList enabledAzurePlans = default(IList)) + + /// The ID of the invoice section. + /// + + /// The name of the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The system generated unique identifier for a billing profile. + /// + + /// Enabled azure plans for the associated billing profile. + /// + public InvoiceSectionWithCreateSubPermission(string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string invoiceSectionSystemId = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string billingProfileSystemId = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList)) + { - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - InvoiceSectionSystemId = invoiceSectionSystemId; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - BillingProfileStatus = billingProfileStatus; - BillingProfileStatusReasonCode = billingProfileStatusReasonCode; - BillingProfileSpendingLimit = billingProfileSpendingLimit; - BillingProfileSystemId = billingProfileSystemId; - EnabledAzurePlans = enabledAzurePlans; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.InvoiceSectionSystemId = invoiceSectionSystemId; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.BillingProfileSystemId = billingProfileSystemId; + this.EnabledAzurePlans = enabledAzurePlans; CustomInit(); } @@ -75,70 +75,65 @@ public InvoiceSectionWithCreateSubPermission() /// partial void CustomInit(); + /// /// Gets the ID of the invoice section. /// - [JsonProperty(PropertyName = "invoiceSectionId")] - public string InvoiceSectionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } /// /// Gets the name of the invoice section. /// - [JsonProperty(PropertyName = "invoiceSectionDisplayName")] - public string InvoiceSectionDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } /// /// Gets the system generated unique identifier for an invoice section. /// - [JsonProperty(PropertyName = "invoiceSectionSystemId")] - public string InvoiceSectionSystemId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionSystemId")] + public string InvoiceSectionSystemId {get; private set; } /// /// Gets the ID of the billing profile for the invoice section. /// - [JsonProperty(PropertyName = "billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } /// /// Gets the name of the billing profile for the invoice section. /// - [JsonProperty(PropertyName = "billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// - /// Gets the status of the billing profile. Possible values include: - /// 'Active', 'Disabled', 'Warned' + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' /// - [JsonProperty(PropertyName = "billingProfileStatus")] - public string BillingProfileStatus { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatus")] + public string BillingProfileStatus {get; private set; } /// - /// Gets reason for the specified billing profile status. Possible - /// values include: 'PastDue', 'SpendingLimitReached', - /// 'SpendingLimitExpired' + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' /// - [JsonProperty(PropertyName = "billingProfileStatusReasonCode")] - public string BillingProfileStatusReasonCode { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } /// - /// Gets the billing profile spending limit. Possible values include: - /// 'Off', 'On' + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' /// - [JsonProperty(PropertyName = "billingProfileSpendingLimit")] - public string BillingProfileSpendingLimit { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } /// /// Gets the system generated unique identifier for a billing profile. /// - [JsonProperty(PropertyName = "billingProfileSystemId")] - public string BillingProfileSystemId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSystemId")] + public string BillingProfileSystemId {get; private set; } /// - /// Gets or sets enabled azure plans for the associated billing - /// profile. + /// Gets or sets enabled azure plans for the associated billing profile. /// - [JsonProperty(PropertyName = "enabledAzurePlans")] - public IList EnabledAzurePlans { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs index 28621c7ef62f..a089b3c1970f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for CreateOrUpdate operation. - /// public partial class InvoiceSectionsCreateOrUpdateHeaders { /// - /// Initializes a new instance of the - /// InvoiceSectionsCreateOrUpdateHeaders class. + /// Initializes a new instance of the InvoiceSectionsCreateOrUpdateHeaders class. /// public InvoiceSectionsCreateOrUpdateHeaders() { @@ -28,17 +18,19 @@ public InvoiceSectionsCreateOrUpdateHeaders() } /// - /// Initializes a new instance of the - /// InvoiceSectionsCreateOrUpdateHeaders class. + /// Initializes a new instance of the InvoiceSectionsCreateOrUpdateHeaders class. /// - /// Location URI to poll for result - /// Recommended time to wait before making - /// another request to check the status of the operation. The time is - /// specified in seconds. + + /// + /// + + /// + /// public InvoiceSectionsCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -47,19 +39,17 @@ public InvoiceSectionsCreateOrUpdateHeaders() /// partial void CustomInit(); + /// - /// Gets or sets location URI to poll for result + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets recommended time to wait before making another request - /// to check the status of the operation. The time is specified in - /// seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs index a30a4a9003e0..3a131485fed6 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs @@ -1,23 +1,15 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The invoice sections associated to the billing profile. By default this - /// is not populated, unless it's specified in $expand. + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. /// public partial class InvoiceSectionsOnExpand { @@ -32,16 +24,19 @@ public InvoiceSectionsOnExpand() /// /// Initializes a new instance of the InvoiceSectionsOnExpand class. /// - /// 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. - /// The invoice sections associated to the billing - /// profile. - public InvoiceSectionsOnExpand(bool? hasMoreResults = default(bool?), IList value = default(IList)) + + /// 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. + /// + + /// The invoice sections associated to the billing profile. + /// + public InvoiceSectionsOnExpand(bool? hasMoreResults = default(bool?), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + { - HasMoreResults = hasMoreResults; - Value = value; + this.HasMoreResults = hasMoreResults; + this.Value = value; CustomInit(); } @@ -50,21 +45,19 @@ public InvoiceSectionsOnExpand() /// partial void CustomInit(); + /// - /// Gets 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. + /// Gets 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(PropertyName = "hasMoreResults")] - public bool? HasMoreResults { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "hasMoreResults")] + public bool? HasMoreResults {get; private set; } /// - /// Gets or sets the invoice sections associated to the billing - /// profile. + /// Gets or sets the invoice sections associated to the billing profile. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs index 4a4bcaa725a2..3efbe16fd464 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for InvoiceStatus. /// + + public static class InvoiceStatus { public const string Due = "Due"; public const string OverDue = "OverDue"; public const string Paid = "Paid"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs index e6fa4d753a6c..dee5f86d8247 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for InvoiceType. /// + + public static class InvoiceType { public const string AzureService = "AzureService"; public const string AzureMarketplace = "AzureMarketplace"; public const string AzureSupport = "AzureSupport"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs index ae2853e38f54..6501666d992e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for DownloadBillingSubscriptionInvoice operation. - /// public partial class InvoicesDownloadBillingSubscriptionInvoiceHeaders { /// - /// Initializes a new instance of the - /// InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// Initializes a new instance of the InvoicesDownloadBillingSubscriptionInvoiceHeaders class. /// public InvoicesDownloadBillingSubscriptionInvoiceHeaders() { @@ -28,18 +18,19 @@ public InvoicesDownloadBillingSubscriptionInvoiceHeaders() } /// - /// Initializes a new instance of the - /// InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// Initializes a new instance of the InvoicesDownloadBillingSubscriptionInvoiceHeaders class. /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. + + /// + /// + + /// + /// public InvoicesDownloadBillingSubscriptionInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -48,19 +39,17 @@ public InvoicesDownloadBillingSubscriptionInvoiceHeaders() /// partial void CustomInit(); + /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs index 3f8c4a1ebf38..f58103febbdc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for DownloadInvoice operation. - /// public partial class InvoicesDownloadInvoiceHeaders { /// - /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders - /// class. + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders class. /// public InvoicesDownloadInvoiceHeaders() { @@ -28,18 +18,19 @@ public InvoicesDownloadInvoiceHeaders() } /// - /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders - /// class. + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders class. /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. + + /// + /// + + /// + /// public InvoicesDownloadInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -48,19 +39,17 @@ public InvoicesDownloadInvoiceHeaders() /// partial void CustomInit(); + /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs index 528fefe6c4e5..06e7c6ee2fb4 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for MarketplacePurchasesPolicy. /// + + public static class MarketplacePurchasesPolicy { public const string AllAllowed = "AllAllowed"; public const string OnlyFreeAllowed = "OnlyFreeAllowed"; public const string NotAllowed = "NotAllowed"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs index 20cb7d5af963..cd988e4f3795 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public Operation() /// /// Initializes a new instance of the Operation class. /// - /// Operation name: - /// {provider}/{resource}/{operation}. - /// The object that represents the - /// operation. + + /// Operation name: {provider}/{resource}/{operation}. + /// + + /// The object that represents the operation. + /// public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { - Name = name; - Display = display; + this.Name = name; + this.Display = display; CustomInit(); } @@ -45,17 +42,17 @@ public Operation() /// partial void CustomInit(); + /// /// Gets operation name: {provider}/{resource}/{operation}. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets or sets the object that represents the operation. /// - [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationDisplay Display {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs index 1fb0a8ab0c51..7204159b9bea 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,16 +23,22 @@ public OperationDisplay() /// /// Initializes a new instance of the OperationDisplay class. /// - /// Service provider: Microsoft.Billing. - /// Resource on which the operation is performed - /// such as invoice and billing subscription. - /// Operation type such as read, write and - /// delete. + + /// Service provider: Microsoft.Billing. + /// + + /// Resource on which the operation is performed such as invoice and billing + /// subscription. + /// + + /// Operation type such as read, write and delete. + /// public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { - Provider = provider; - Resource = resource; - Operation = operation; + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; CustomInit(); } @@ -47,24 +47,24 @@ public OperationDisplay() /// partial void CustomInit(); + /// /// Gets service provider: Microsoft.Billing. /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; private set; } /// - /// Gets resource on which the operation is performed such as invoice - /// and billing subscription. + /// Gets resource on which the operation is performed such as invoice and + /// billing subscription. /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; private set; } /// /// Gets operation type such as read, write and delete. /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs index 5f9ef03c16c2..cdc0396c9f91 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs @@ -1,53 +1,43 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; /// /// Defines a page in Azure responses. /// /// Type of the page content items - [JsonObject] - public class Page : IPage + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs index 760f89ceb15e..50c15960631e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,16 +23,21 @@ public Participants() /// /// Initializes a new instance of the Participants class. /// - /// The acceptance status of the - /// participant. - /// The date when the status got - /// changed. - /// The email address of the participant. + + /// The acceptance status of the participant. + /// + + /// The date when the status got changed. + /// + + /// The email address of the participant. + /// public Participants(string status = default(string), System.DateTime? statusDate = default(System.DateTime?), string email = default(string)) + { - Status = status; - StatusDate = statusDate; - Email = email; + this.Status = status; + this.StatusDate = statusDate; + this.Email = email; CustomInit(); } @@ -47,23 +46,23 @@ public Participants() /// partial void CustomInit(); + /// /// Gets the acceptance status of the participant. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } /// /// Gets the date when the status got changed. /// - [JsonProperty(PropertyName = "statusDate")] - public System.DateTime? StatusDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "statusDate")] + public System.DateTime? StatusDate {get; private set; } /// /// Gets the email address of the participant. /// - [JsonProperty(PropertyName = "email")] - public string Email { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "email")] + public string Email {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs index d7e8a23afa8e..606ffb9ad45c 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for PaymentMethodFamily. /// + + public static class PaymentMethodFamily { public const string Credits = "Credits"; @@ -21,4 +18,4 @@ public static class PaymentMethodFamily public const string CreditCard = "CreditCard"; public const string None = "None"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs index ce8212f8a6af..649650ab40cf 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,20 +23,29 @@ public PaymentProperties() /// /// Initializes a new instance of the PaymentProperties class. /// - /// The type of payment. - /// The paid amount. - /// The date when the payment was made. + + /// The type of payment. + /// + + /// The paid amount. + /// + + /// The date when the payment was made. + /// + /// The family of payment method. - /// Possible values include: 'Credits', 'CheckWire', 'CreditCard', - /// 'None' - /// The type of payment method. + /// Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None' + + /// The type of payment method. + /// public PaymentProperties(string paymentType = default(string), Amount amount = default(Amount), System.DateTime? date = default(System.DateTime?), string paymentMethodFamily = default(string), string paymentMethodType = default(string)) + { - PaymentType = paymentType; - Amount = amount; - Date = date; - PaymentMethodFamily = paymentMethodFamily; - PaymentMethodType = paymentMethodType; + this.PaymentType = paymentType; + this.Amount = amount; + this.Date = date; + this.PaymentMethodFamily = paymentMethodFamily; + this.PaymentMethodType = paymentMethodType; CustomInit(); } @@ -51,36 +54,35 @@ public PaymentProperties() /// partial void CustomInit(); + /// /// Gets the type of payment. /// - [JsonProperty(PropertyName = "paymentType")] - public string PaymentType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentType")] + public string PaymentType {get; private set; } /// /// Gets the paid amount. /// - [JsonProperty(PropertyName = "amount")] - public Amount Amount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public Amount Amount {get; private set; } /// /// Gets the date when the payment was made. /// - [JsonProperty(PropertyName = "date")] - public System.DateTime? Date { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; private set; } /// - /// Gets or sets the family of payment method. Possible values include: - /// 'Credits', 'CheckWire', 'CreditCard', 'None' + /// Gets or sets the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None' /// - [JsonProperty(PropertyName = "paymentMethodFamily")] - public string PaymentMethodFamily { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentMethodFamily")] + public string PaymentMethodFamily {get; set; } /// /// Gets the type of payment method. /// - [JsonProperty(PropertyName = "paymentMethodType")] - public string PaymentMethodType { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentMethodType")] + public string PaymentMethodType {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs index 09eb26d7da03..2146b07e28a9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// A policy. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Policy : Resource { /// @@ -32,25 +24,34 @@ public Policy() /// /// Initializes a new instance of the Policy class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The policy that controls whether - /// Azure marketplace purchases are allowed for a billing profile. - /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', - /// 'NotAllowed' - /// The policy that controls whether - /// Azure reservation purchases are allowed for a billing profile. - /// Possible values include: 'Allowed', 'NotAllowed' - /// The policy that controls whether users - /// with Azure RBAC access to a subscription can view its charges. - /// Possible values include: 'Allowed', 'NotAllowed' + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed + /// for a billing profile. + /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + + /// The policy that controls whether Azure reservation purchases are allowed + /// for a billing profile. + /// Possible values include: 'Allowed', 'NotAllowed' + + /// The policy that controls whether users with Azure RBAC access to a + /// subscription can view its charges. + /// Possible values include: 'Allowed', 'NotAllowed' public Policy(string id = default(string), string name = default(string), string type = default(string), string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) - : base(id, name, type) + + : base(id, name, type) { - MarketplacePurchases = marketplacePurchases; - ReservationPurchases = reservationPurchases; - ViewCharges = viewCharges; + this.MarketplacePurchases = marketplacePurchases; + this.ReservationPurchases = reservationPurchases; + this.ViewCharges = viewCharges; CustomInit(); } @@ -59,29 +60,26 @@ public Policy() /// partial void CustomInit(); + /// - /// Gets or sets the policy that controls whether Azure marketplace - /// purchases are allowed for a billing profile. Possible values - /// include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + /// Gets or sets the policy that controls whether Azure marketplace purchases + /// are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.marketplacePurchases")] - public string MarketplacePurchases { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.marketplacePurchases")] + public string MarketplacePurchases {get; set; } /// - /// Gets or sets the policy that controls whether Azure reservation - /// purchases are allowed for a billing profile. Possible values - /// include: 'Allowed', 'NotAllowed' + /// Gets or sets the policy that controls whether Azure reservation purchases + /// are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.reservationPurchases")] - public string ReservationPurchases { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reservationPurchases")] + public string ReservationPurchases {get; set; } /// - /// Gets or sets the policy that controls whether users with Azure RBAC - /// access to a subscription can view its charges. Possible values - /// include: 'Allowed', 'NotAllowed' + /// Gets or sets the policy that controls whether users with Azure RBAC access + /// to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.viewCharges")] - public string ViewCharges { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..7dd3e14a3dee --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs @@ -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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a policy. + /// + public partial class PolicyProperties + { + /// + /// Initializes a new instance of the PolicyProperties class. + /// + public PolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyProperties class. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed + /// for a billing profile. + /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + + /// The policy that controls whether Azure reservation purchases are allowed + /// for a billing profile. + /// Possible values include: 'Allowed', 'NotAllowed' + + /// The policy that controls whether users with Azure RBAC access to a + /// subscription can view its charges. + /// Possible values include: 'Allowed', 'NotAllowed' + public PolicyProperties(string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) + + { + this.MarketplacePurchases = marketplacePurchases; + this.ReservationPurchases = reservationPurchases; + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the policy that controls whether Azure marketplace purchases + /// are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "marketplacePurchases")] + public string MarketplacePurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether Azure reservation purchases + /// are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reservationPurchases")] + public string ReservationPurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether users with Azure RBAC access + /// to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs index b32228ce453d..95a47080e7cb 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// A product. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Product : Resource { /// @@ -32,76 +24,110 @@ public Product() /// /// Initializes a new instance of the Product class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// Indicates whether auto renewal is turned on - /// or off for a product. Possible values include: 'Off', 'On' - /// The display name of the product. - /// The date when the product was - /// purchased. - /// The ID of the type of product. - /// The description of the type of - /// product. - /// The current status of the product. Possible - /// values include: 'Active', 'Inactive', 'PastDue', 'Expiring', - /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' - /// The date when the product will be renewed or - /// canceled. - /// The frequency at which the product - /// will be billed. Possible values include: 'OneTime', 'Monthly', - /// 'UsageBased' - /// The last month charges. - /// The date of the last charge. - /// The quantity purchased for the - /// product. - /// The sku ID of the product. - /// The sku description of the - /// product. - /// The id of the tenant in which the product is - /// used. - /// The availability of the - /// product. - /// The ID of the invoice section to - /// which the product is billed. - /// The name of the invoice - /// section to which the product is billed. - /// The ID of the billing profile to - /// which the product is billed. - /// The name of the billing - /// profile to which the product is billed. - /// The ID of the customer for whom the - /// product was purchased. The field is applicable only for Microsoft - /// Partner Agreement billing account. - /// The name of the customer for whom - /// the product was purchased. The field is applicable only for - /// Microsoft Partner Agreement billing account. - /// Reseller for this product. - public Product(string id = default(string), string name = default(string), string type = default(string), string autoRenew = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), Reseller reseller = default(Reseller)) - : base(id, name, type) + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Indicates whether auto renewal is turned on or off for a product. + /// Possible values include: 'Off', 'On' + + /// The frequency at which the product will be billed. + /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' + + /// Reseller for this product. + /// + + /// The display name of the product. + /// + + /// The date when the product was purchased. + /// + + /// The ID of the type of product. + /// + + /// The description of the type of product. + /// + + /// The current status of the product. + /// Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', + /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + + /// The date when the product will be renewed or canceled. + /// + + /// The last month charges. + /// + + /// The date of the last charge. + /// + + /// The quantity purchased for the product. + /// + + /// The sku ID of the product. + /// + + /// The sku description of the product. + /// + + /// The id of the tenant in which the product is used. + /// + + /// The availability of the product. + /// + + /// The ID of the invoice section to which the product is billed. + /// + + /// The name of the invoice section to which the product is billed. + /// + + /// The ID of the billing profile to which the product is billed. + /// + + /// The name of the billing profile to which the product is billed. + /// + + /// The ID of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + public Product(string id = default(string), string name = default(string), string type = default(string), string autoRenew = default(string), string billingFrequency = default(string), Reseller reseller = default(Reseller), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string)) + + : base(id, name, type) { - AutoRenew = autoRenew; - DisplayName = displayName; - PurchaseDate = purchaseDate; - ProductTypeId = productTypeId; - ProductType = productType; - Status = status; - EndDate = endDate; - BillingFrequency = billingFrequency; - LastCharge = lastCharge; - LastChargeDate = lastChargeDate; - Quantity = quantity; - SkuId = skuId; - SkuDescription = skuDescription; - TenantId = tenantId; - AvailabilityId = availabilityId; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - Reseller = reseller; + this.AutoRenew = autoRenew; + this.BillingFrequency = billingFrequency; + this.Reseller = reseller; + this.DisplayName = displayName; + this.PurchaseDate = purchaseDate; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.Status = status; + this.EndDate = endDate; + this.LastCharge = lastCharge; + this.LastChargeDate = lastChargeDate; + this.Quantity = quantity; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + this.TenantId = tenantId; + this.AvailabilityId = availabilityId; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; CustomInit(); } @@ -110,147 +136,140 @@ public Product() /// partial void CustomInit(); + /// - /// Gets or sets indicates whether auto renewal is turned on or off for - /// a product. Possible values include: 'Off', 'On' + /// Gets or sets indicates whether auto renewal is turned on or off for a + /// product. Possible values include: 'Off', 'On' /// - [JsonProperty(PropertyName = "properties.autoRenew")] - public string AutoRenew { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoRenew")] + public string AutoRenew {get; set; } + + /// + /// Gets or sets the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingFrequency")] + public string BillingFrequency {get; set; } + + /// + /// Gets reseller for this product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller {get; private set; } /// /// Gets the display name of the product. /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } /// /// Gets the date when the product was purchased. /// - [JsonProperty(PropertyName = "properties.purchaseDate")] - public System.DateTime? PurchaseDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.purchaseDate")] + public System.DateTime? PurchaseDate {get; private set; } /// /// Gets the ID of the type of product. /// - [JsonProperty(PropertyName = "properties.productTypeId")] - public string ProductTypeId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId {get; private set; } /// /// Gets the description of the type of product. /// - [JsonProperty(PropertyName = "properties.productType")] - public string ProductType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productType")] + public string ProductType {get; private set; } /// - /// Gets or sets the current status of the product. Possible values - /// include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', - /// 'Disabled', 'Cancelled', 'AutoRenew' + /// Gets or sets the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } /// /// Gets the date when the product will be renewed or canceled. /// - [JsonProperty(PropertyName = "properties.endDate")] - public System.DateTime? EndDate { get; private set; } - - /// - /// Gets or sets the frequency at which the product will be billed. - /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' - /// - [JsonProperty(PropertyName = "properties.billingFrequency")] - public string BillingFrequency { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; private set; } /// /// Gets the last month charges. /// - [JsonProperty(PropertyName = "properties.lastCharge")] - public Amount LastCharge { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastCharge")] + public Amount LastCharge {get; private set; } /// /// Gets the date of the last charge. /// - [JsonProperty(PropertyName = "properties.lastChargeDate")] - public System.DateTime? LastChargeDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastChargeDate")] + public System.DateTime? LastChargeDate {get; private set; } /// /// Gets the quantity purchased for the product. /// - [JsonProperty(PropertyName = "properties.quantity")] - public double? Quantity { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.quantity")] + public double? Quantity {get; private set; } /// /// Gets the sku ID of the product. /// - [JsonProperty(PropertyName = "properties.skuId")] - public string SkuId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; private set; } /// /// Gets the sku description of the product. /// - [JsonProperty(PropertyName = "properties.skuDescription")] - public string SkuDescription { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } /// /// Gets the id of the tenant in which the product is used. /// - [JsonProperty(PropertyName = "properties.tenantId")] - public string TenantId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId {get; private set; } /// /// Gets the availability of the product. /// - [JsonProperty(PropertyName = "properties.availabilityId")] - public string AvailabilityId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.availabilityId")] + public string AvailabilityId {get; private set; } /// /// Gets the ID of the invoice section to which the product is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionId")] - public string InvoiceSectionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } /// - /// Gets the name of the invoice section to which the product is - /// billed. + /// Gets the name of the invoice section to which the product is billed. /// - [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] - public string InvoiceSectionDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } /// /// Gets the ID of the billing profile to which the product is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// - /// Gets the name of the billing profile to which the product is - /// billed. + /// Gets the name of the billing profile to which the product is billed. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// - /// Gets the ID of the customer for whom the product was purchased. The - /// field is applicable only for Microsoft Partner Agreement billing - /// account. + /// Gets the ID of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerId")] - public string CustomerId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } /// - /// Gets the name of the customer for whom the product was purchased. - /// The field is applicable only for Microsoft Partner Agreement - /// billing account. + /// Gets the name of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerDisplayName")] - public string CustomerDisplayName { get; private set; } - - /// - /// Gets reseller for this product. - /// - [JsonProperty(PropertyName = "properties.reseller")] - public Reseller Reseller { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs new file mode 100644 index 000000000000..39532913489a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs @@ -0,0 +1,264 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a product. + /// + public partial class ProductProperties + { + /// + /// Initializes a new instance of the ProductProperties class. + /// + public ProductProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProductProperties class. + /// + + /// Indicates whether auto renewal is turned on or off for a product. + /// Possible values include: 'Off', 'On' + + /// The display name of the product. + /// + + /// The date when the product was purchased. + /// + + /// The ID of the type of product. + /// + + /// The description of the type of product. + /// + + /// The current status of the product. + /// Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', + /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + + /// The date when the product will be renewed or canceled. + /// + + /// The frequency at which the product will be billed. + /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' + + /// The last month charges. + /// + + /// The date of the last charge. + /// + + /// The quantity purchased for the product. + /// + + /// The sku ID of the product. + /// + + /// The sku description of the product. + /// + + /// The id of the tenant in which the product is used. + /// + + /// The availability of the product. + /// + + /// The ID of the invoice section to which the product is billed. + /// + + /// The name of the invoice section to which the product is billed. + /// + + /// The ID of the billing profile to which the product is billed. + /// + + /// The name of the billing profile to which the product is billed. + /// + + /// The ID of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// Reseller for this product. + /// + public ProductProperties(string autoRenew = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), Reseller reseller = default(Reseller)) + + { + this.AutoRenew = autoRenew; + this.DisplayName = displayName; + this.PurchaseDate = purchaseDate; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.Status = status; + this.EndDate = endDate; + this.BillingFrequency = billingFrequency; + this.LastCharge = lastCharge; + this.LastChargeDate = lastChargeDate; + this.Quantity = quantity; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + this.TenantId = tenantId; + this.AvailabilityId = availabilityId; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.Reseller = reseller; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets indicates whether auto renewal is turned on or off for a + /// product. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoRenew")] + public string AutoRenew {get; set; } + + /// + /// Gets the display name of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the date when the product was purchased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "purchaseDate")] + public System.DateTime? PurchaseDate {get; private set; } + + /// + /// Gets the ID of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the description of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productType")] + public string ProductType {get; private set; } + + /// + /// Gets or sets the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets the date when the product will be renewed or canceled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; private set; } + + /// + /// Gets or sets the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingFrequency")] + public string BillingFrequency {get; set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastCharge")] + public Amount LastCharge {get; private set; } + + /// + /// Gets the date of the last charge. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastChargeDate")] + public System.DateTime? LastChargeDate {get; private set; } + + /// + /// Gets the quantity purchased for the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "quantity")] + public double? Quantity {get; private set; } + + /// + /// Gets the sku ID of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + + /// + /// Gets the id of the tenant in which the product is used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; private set; } + + /// + /// Gets the availability of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "availabilityId")] + public string AvailabilityId {get; private set; } + + /// + /// Gets the ID of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets reseller for this product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reseller")] + public Reseller Reseller {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs index 7e2f470d6198..289f5ecb4cdc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ProductStatusType. /// + + public static class ProductStatusType { public const string Active = "Active"; @@ -25,4 +22,4 @@ public static class ProductStatusType public const string Cancelled = "Cancelled"; public const string AutoRenew = "AutoRenew"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs index b2aa3eff7e27..d9c041c3b338 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ProductTransferValidationErrorCode. /// + + public static class ProductTransferValidationErrorCode { public const string InvalidSource = "InvalidSource"; @@ -26,4 +23,4 @@ public static class ProductTransferValidationErrorCode public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; public const string OneTimePurchaseProductTransferNotAllowed = "OneTimePurchaseProductTransferNotAllowed"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs index ace8ee2e077c..55dcfb7ea6a9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs @@ -1,21 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; - /// - /// Defines headers for Move operation. - /// public partial class ProductsMoveHeaders { /// @@ -29,14 +20,17 @@ public ProductsMoveHeaders() /// /// Initializes a new instance of the ProductsMoveHeaders class. /// - /// Location URI to poll for result - /// Recommended time to wait before making - /// another request to check the status of the operation. The time is - /// specified in seconds. + + /// + /// + + /// + /// public ProductsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + { - Location = location; - RetryAfter = retryAfter; + this.Location = location; + this.RetryAfter = retryAfter; CustomInit(); } @@ -45,19 +39,17 @@ public ProductsMoveHeaders() /// partial void CustomInit(); + /// - /// Gets or sets location URI to poll for result + /// Gets or sets /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } /// - /// Gets or sets recommended time to wait before making another request - /// to check the status of the operation. The time is specified in - /// seconds. + /// Gets or sets /// - [JsonProperty(PropertyName = "Retry-After")] - public int? RetryAfter { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs index c29c43f43865..4e46039e33cb 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,12 +23,17 @@ public Reseller() /// /// Initializes a new instance of the Reseller class. /// - /// The MPN ID of the reseller. - /// The name of the reseller. + + /// The MPN ID of the reseller. + /// + + /// The name of the reseller. + /// public Reseller(string resellerId = default(string), string description = default(string)) + { - ResellerId = resellerId; - Description = description; + this.ResellerId = resellerId; + this.Description = description; CustomInit(); } @@ -43,17 +42,17 @@ public Reseller() /// partial void CustomInit(); + /// /// Gets the MPN ID of the reseller. /// - [JsonProperty(PropertyName = "resellerId")] - public string ResellerId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resellerId")] + public string ResellerId {get; private set; } /// /// Gets the name of the reseller. /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs index a41293d8b273..ead07b499fcd 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ReservationPurchasesPolicy. /// + + public static class ReservationPurchasesPolicy { public const string Allowed = "Allowed"; public const string NotAllowed = "NotAllowed"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs index 40f0ea280679..667a698bdeb6 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ReservationType. /// + + public static class ReservationType { public const string Purchase = "Purchase"; public const string UsageCharge = "Usage Charge"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs index b545457eeb34..b07267bd625f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// /// The Resource model definition. /// - public partial class Resource : IResource + public partial class Resource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the Resource class. @@ -31,14 +23,21 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Resource Id. - /// Resource name. - /// Resource type. + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// public Resource(string id = default(string), string name = default(string), string type = default(string)) + { - Id = id; - Name = name; - Type = type; + this.Id = id; + this.Name = name; + this.Type = type; CustomInit(); } @@ -47,23 +46,23 @@ public Resource() /// partial void CustomInit(); + /// /// Gets resource Id. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets resource name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets resource type. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs index 9c110280d1f3..2a301ec38b73 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for SpendingLimit. /// + + public static class SpendingLimit { public const string Off = "Off"; public const string On = "On"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs index 24ac4ee58ff5..3004c65aa3ca 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for SpendingLimitForBillingProfile. /// + + public static class SpendingLimitForBillingProfile { public const string Off = "Off"; public const string On = "On"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs index b91f5b60e789..daec5e596efd 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for StatusReasonCode. /// + + public static class StatusReasonCode { public const string PastDue = "PastDue"; public const string SpendingLimitReached = "SpendingLimitReached"; public const string SpendingLimitExpired = "SpendingLimitExpired"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs index dcecf204daac..1841673b5171 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for StatusReasonCodeForBillingProfile. /// + + public static class StatusReasonCodeForBillingProfile { public const string PastDue = "PastDue"; public const string SpendingLimitReached = "SpendingLimitReached"; public const string SpendingLimitExpired = "SpendingLimitExpired"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs index 128d487ef129..6ccf36491a4e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for SubscriptionTransferValidationErrorCode. /// + + public static class SubscriptionTransferValidationErrorCode { public const string InvalidSource = "InvalidSource"; @@ -25,4 +22,4 @@ public static class SubscriptionTransferValidationErrorCode public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs index f89628991bb9..471a4d7cc6ff 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// /// A transaction. /// - [Rest.Serialization.JsonTransformation] + [Microsoft.Rest.Serialization.JsonTransformation] public partial class Transaction : Resource { /// @@ -32,126 +24,176 @@ public Transaction() /// /// Initializes a new instance of the Transaction class. /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// The kind of transaction. Options are all or - /// reservation. Possible values include: 'all', 'reservation' - /// The date of transaction. - /// Invoice on which the transaction was billed - /// or 'pending' if the transaction is not billed. - /// The ID of the invoice on which the - /// transaction was billed. This field is only applicable for - /// transactions which are billed. - /// The order ID of the reservation. The field is - /// only applicable for transaction of kind reservation. - /// The name of the reservation order. The - /// field is only applicable for transactions of kind - /// reservation. - /// The family of the product for which the - /// transaction took place. - /// The ID of the product type for which - /// the transaction took place. - /// The type of the product for which the - /// transaction took place. - /// The description of the product for - /// which the transaction took place. - /// The type of transaction. Possible - /// values include: 'Purchase', 'Usage Charge' - /// The charge associated with the - /// transaction. - /// The quantity purchased in the - /// transaction. - /// The ID of the invoice section which - /// will be billed for the transaction. - /// The name of the invoice - /// section which will be billed for the transaction. - /// The ID of the billing profile which - /// will be billed for the transaction. - /// The name of the billing - /// profile which will be billed for the transaction. - /// The ID of the customer for which the - /// transaction took place. The field is applicable only for Microsoft - /// Partner Agreement billing account. - /// The name of the customer for - /// which the transaction took place. The field is applicable only for - /// Microsoft Partner Agreement billing account. - /// The ID of the subscription that was - /// used for the transaction. The field is only applicable for - /// transaction of kind reservation. - /// The name of the subscription that - /// was used for the transaction. The field is only applicable for - /// transaction of kind reservation. - /// The type of azure plan of the subscription - /// that was used for the transaction. - /// The amount of any Azure credits - /// automatically applied to this transaction. - /// The ISO 4217 code for the currency in - /// which this transaction is billed. - /// The percentage discount, if any, applied to - /// this transaction. - /// The price of the product after - /// applying any discounts. - /// The exchange rate used to convert - /// charged amount to billing currency, if applicable. - /// The retail price of the product. - /// The ISO 4217 code for the currency in - /// which the product is priced. - /// The date of the purchase of - /// the product, or the start date of the month in which usage - /// started. - /// The end date of the product - /// term, or the end date of the month in which usage ended. - /// The pre-tax charged amount for the - /// transaction. - /// The tax amount applied to the - /// transaction. - /// The unit of measure used to bill for - /// the product. For example, compute services are billed per - /// hour. - /// The number of units used for a given - /// product. - /// The description for the unit of measure for - /// a given product. + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The kind of transaction. Options are all or reservation. + /// Possible values include: 'all', 'reservation' + + /// The date of transaction. + /// + + /// Invoice on which the transaction was billed or 'pending' if the transaction + /// is not billed. + /// + + /// The ID of the invoice on which the transaction was billed. This field is + /// only applicable for transactions which are billed. + /// + + /// The order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + + /// The name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + + /// The family of the product for which the transaction took place. + /// + + /// The ID of the product type for which the transaction took place. + /// + + /// The type of the product for which the transaction took place. + /// + + /// The description of the product for which the transaction took place. + /// + + /// The type of transaction. + /// Possible values include: 'Purchase', 'Usage Charge' + + /// The charge associated with the transaction. + /// + + /// The quantity purchased in the transaction. + /// + + /// The ID of the invoice section which will be billed for the transaction. + /// + + /// The name of the invoice section which will be billed for the transaction. + /// + + /// The ID of the billing profile which will be billed for the transaction. + /// + + /// The name of the billing profile which will be billed for the transaction. + /// + + /// The ID of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the subscription that was used for the transaction. The field is + /// only applicable for transaction of kind reservation. + /// + + /// The name of the subscription that was used for the transaction. The field + /// is only applicable for transaction of kind reservation. + /// + + /// The type of azure plan of the subscription that was used for the + /// transaction. + /// + + /// The amount of any Azure credits automatically applied to this transaction. + /// + + /// The ISO 4217 code for the currency in which this transaction is billed. + /// + + /// The percentage discount, if any, applied to this transaction. + /// + + /// The price of the product after applying any discounts. + /// + + /// The exchange rate used to convert charged amount to billing currency, if + /// applicable. + /// + + /// The retail price of the product. + /// + + /// The ISO 4217 code for the currency in which the product is priced. + /// + + /// The date of the purchase of the product, or the start date of the month in + /// which usage started. + /// + + /// The end date of the product term, or the end date of the month in which + /// usage ended. + /// + + /// The pre-tax charged amount for the transaction. + /// + + /// The tax amount applied to the transaction. + /// + + /// The unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + + /// The number of units used for a given product. + /// + + /// The description for the unit of measure for a given product. + /// public Transaction(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string invoiceId = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), string azurePlan = default(string), Amount azureCreditApplied = default(Amount), string billingCurrency = default(string), double? discount = default(double?), Amount effectivePrice = default(Amount), double? exchangeRate = default(double?), Amount marketPrice = default(Amount), string pricingCurrency = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), Amount subTotal = default(Amount), Amount tax = default(Amount), string unitOfMeasure = default(string), double? units = default(double?), string unitType = default(string)) - : base(id, name, type) + + : base(id, name, type) { - Kind = kind; - Date = date; - Invoice = invoice; - InvoiceId = invoiceId; - OrderId = orderId; - OrderName = orderName; - ProductFamily = productFamily; - ProductTypeId = productTypeId; - ProductType = productType; - ProductDescription = productDescription; - TransactionType = transactionType; - TransactionAmount = transactionAmount; - Quantity = quantity; - InvoiceSectionId = invoiceSectionId; - InvoiceSectionDisplayName = invoiceSectionDisplayName; - BillingProfileId = billingProfileId; - BillingProfileDisplayName = billingProfileDisplayName; - CustomerId = customerId; - CustomerDisplayName = customerDisplayName; - SubscriptionId = subscriptionId; - SubscriptionName = subscriptionName; - AzurePlan = azurePlan; - AzureCreditApplied = azureCreditApplied; - BillingCurrency = billingCurrency; - Discount = discount; - EffectivePrice = effectivePrice; - ExchangeRate = exchangeRate; - MarketPrice = marketPrice; - PricingCurrency = pricingCurrency; - ServicePeriodStartDate = servicePeriodStartDate; - ServicePeriodEndDate = servicePeriodEndDate; - SubTotal = subTotal; - Tax = tax; - UnitOfMeasure = unitOfMeasure; - Units = units; - UnitType = unitType; + this.Kind = kind; + this.Date = date; + this.Invoice = invoice; + this.InvoiceId = invoiceId; + this.OrderId = orderId; + this.OrderName = orderName; + this.ProductFamily = productFamily; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.ProductDescription = productDescription; + this.TransactionType = transactionType; + this.TransactionAmount = transactionAmount; + this.Quantity = quantity; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionName = subscriptionName; + this.AzurePlan = azurePlan; + this.AzureCreditApplied = azureCreditApplied; + this.BillingCurrency = billingCurrency; + this.Discount = discount; + this.EffectivePrice = effectivePrice; + this.ExchangeRate = exchangeRate; + this.MarketPrice = marketPrice; + this.PricingCurrency = pricingCurrency; + this.ServicePeriodStartDate = servicePeriodStartDate; + this.ServicePeriodEndDate = servicePeriodEndDate; + this.SubTotal = subTotal; + this.Tax = tax; + this.UnitOfMeasure = unitOfMeasure; + this.Units = units; + this.UnitType = unitType; CustomInit(); } @@ -160,249 +202,240 @@ public Transaction() /// partial void CustomInit(); + /// - /// Gets or sets the kind of transaction. Options are all or - /// reservation. Possible values include: 'all', 'reservation' + /// Gets or sets the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation' /// - [JsonProperty(PropertyName = "properties.kind")] - public string Kind { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.kind")] + public string Kind {get; set; } /// /// Gets the date of transaction. /// - [JsonProperty(PropertyName = "properties.date")] - public System.DateTime? Date { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.date")] + public System.DateTime? Date {get; private set; } /// - /// Gets invoice on which the transaction was billed or 'pending' if - /// the transaction is not billed. + /// Gets invoice on which the transaction was billed or 'pending' if the + /// transaction is not billed. /// - [JsonProperty(PropertyName = "properties.invoice")] - public string Invoice { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoice")] + public string Invoice {get; private set; } /// - /// Gets the ID of the invoice on which the transaction was billed. - /// This field is only applicable for transactions which are billed. + /// Gets the ID of the invoice on which the transaction was billed. This field + /// is only applicable for transactions which are billed. /// - [JsonProperty(PropertyName = "properties.invoiceId")] - public string InvoiceId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceId")] + public string InvoiceId {get; private set; } /// - /// Gets the order ID of the reservation. The field is only applicable - /// for transaction of kind reservation. + /// Gets the order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. /// - [JsonProperty(PropertyName = "properties.orderId")] - public string OrderId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.orderId")] + public string OrderId {get; private set; } /// - /// Gets the name of the reservation order. The field is only - /// applicable for transactions of kind reservation. + /// Gets the name of the reservation order. The field is only applicable for + /// transactions of kind reservation. /// - [JsonProperty(PropertyName = "properties.orderName")] - public string OrderName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.orderName")] + public string OrderName {get; private set; } /// - /// Gets the family of the product for which the transaction took - /// place. + /// Gets the family of the product for which the transaction took place. /// - [JsonProperty(PropertyName = "properties.productFamily")] - public string ProductFamily { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productFamily")] + public string ProductFamily {get; private set; } /// - /// Gets the ID of the product type for which the transaction took - /// place. + /// Gets the ID of the product type for which the transaction took place. /// - [JsonProperty(PropertyName = "properties.productTypeId")] - public string ProductTypeId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId {get; private set; } /// /// Gets the type of the product for which the transaction took place. /// - [JsonProperty(PropertyName = "properties.productType")] - public string ProductType { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productType")] + public string ProductType {get; private set; } /// - /// Gets the description of the product for which the transaction took - /// place. + /// Gets the description of the product for which the transaction took place. /// - [JsonProperty(PropertyName = "properties.productDescription")] - public string ProductDescription { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productDescription")] + public string ProductDescription {get; private set; } /// - /// Gets or sets the type of transaction. Possible values include: - /// 'Purchase', 'Usage Charge' + /// Gets or sets the type of transaction. Possible values include: 'Purchase', 'Usage Charge' /// - [JsonProperty(PropertyName = "properties.transactionType")] - public string TransactionType { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.transactionType")] + public string TransactionType {get; set; } /// /// Gets the charge associated with the transaction. /// - [JsonProperty(PropertyName = "properties.transactionAmount")] - public Amount TransactionAmount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.transactionAmount")] + public Amount TransactionAmount {get; private set; } /// /// Gets the quantity purchased in the transaction. /// - [JsonProperty(PropertyName = "properties.quantity")] - public int? Quantity { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.quantity")] + public int? Quantity {get; private set; } /// /// Gets the ID of the invoice section which will be billed for the /// transaction. /// - [JsonProperty(PropertyName = "properties.invoiceSectionId")] - public string InvoiceSectionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } /// /// Gets the name of the invoice section which will be billed for the /// transaction. /// - [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] - public string InvoiceSectionDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } /// /// Gets the ID of the billing profile which will be billed for the /// transaction. /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } /// /// Gets the name of the billing profile which will be billed for the /// transaction. /// - [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] - public string BillingProfileDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } /// - /// Gets the ID of the customer for which the transaction took place. - /// The field is applicable only for Microsoft Partner Agreement - /// billing account. + /// Gets the ID of the customer for which the transaction took place. The field + /// is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerId")] - public string CustomerId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } /// - /// Gets the name of the customer for which the transaction took place. - /// The field is applicable only for Microsoft Partner Agreement - /// billing account. + /// Gets the name of the customer for which the transaction took place. The + /// field is applicable only for Microsoft Partner Agreement billing account. /// - [JsonProperty(PropertyName = "properties.customerDisplayName")] - public string CustomerDisplayName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } /// - /// Gets the ID of the subscription that was used for the transaction. - /// The field is only applicable for transaction of kind reservation. + /// Gets the ID of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. /// - [JsonProperty(PropertyName = "properties.subscriptionId")] - public string SubscriptionId { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId {get; private set; } /// - /// Gets the name of the subscription that was used for the - /// transaction. The field is only applicable for transaction of kind - /// reservation. + /// Gets the name of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. /// - [JsonProperty(PropertyName = "properties.subscriptionName")] - public string SubscriptionName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionName")] + public string SubscriptionName {get; private set; } /// - /// Gets the type of azure plan of the subscription that was used for - /// the transaction. + /// Gets the type of azure plan of the subscription that was used for the + /// transaction. /// - [JsonProperty(PropertyName = "properties.azurePlan")] - public string AzurePlan { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azurePlan")] + public string AzurePlan {get; private set; } /// /// Gets the amount of any Azure credits automatically applied to this /// transaction. /// - [JsonProperty(PropertyName = "properties.azureCreditApplied")] - public Amount AzureCreditApplied { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azureCreditApplied")] + public Amount AzureCreditApplied {get; private set; } /// - /// Gets the ISO 4217 code for the currency in which this transaction - /// is billed. + /// Gets the ISO 4217 code for the currency in which this transaction is + /// billed. /// - [JsonProperty(PropertyName = "properties.billingCurrency")] - public string BillingCurrency { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency {get; private set; } /// /// Gets the percentage discount, if any, applied to this transaction. /// - [JsonProperty(PropertyName = "properties.discount")] - public double? Discount { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.discount")] + public double? Discount {get; private set; } /// /// Gets the price of the product after applying any discounts. /// - [JsonProperty(PropertyName = "properties.effectivePrice")] - public Amount EffectivePrice { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.effectivePrice")] + public Amount EffectivePrice {get; private set; } /// - /// Gets the exchange rate used to convert charged amount to billing - /// currency, if applicable. + /// Gets the exchange rate used to convert charged amount to billing currency, + /// if applicable. /// - [JsonProperty(PropertyName = "properties.exchangeRate")] - public double? ExchangeRate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.exchangeRate")] + public double? ExchangeRate {get; private set; } /// /// Gets the retail price of the product. /// - [JsonProperty(PropertyName = "properties.marketPrice")] - public Amount MarketPrice { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.marketPrice")] + public Amount MarketPrice {get; private set; } /// - /// Gets the ISO 4217 code for the currency in which the product is - /// priced. + /// Gets the ISO 4217 code for the currency in which the product is priced. /// - [JsonProperty(PropertyName = "properties.pricingCurrency")] - public string PricingCurrency { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.pricingCurrency")] + public string PricingCurrency {get; private set; } /// - /// Gets the date of the purchase of the product, or the start date of - /// the month in which usage started. + /// Gets the date of the purchase of the product, or the start date of the + /// month in which usage started. /// - [JsonProperty(PropertyName = "properties.servicePeriodStartDate")] - public System.DateTime? ServicePeriodStartDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate {get; private set; } /// - /// Gets the end date of the product term, or the end date of the month - /// in which usage ended. + /// Gets the end date of the product term, or the end date of the month in + /// which usage ended. /// - [JsonProperty(PropertyName = "properties.servicePeriodEndDate")] - public System.DateTime? ServicePeriodEndDate { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate {get; private set; } /// /// Gets the pre-tax charged amount for the transaction. /// - [JsonProperty(PropertyName = "properties.subTotal")] - public Amount SubTotal { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal {get; private set; } /// /// Gets the tax amount applied to the transaction. /// - [JsonProperty(PropertyName = "properties.tax")] - public Amount Tax { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.tax")] + public Amount Tax {get; private set; } /// - /// Gets the unit of measure used to bill for the product. For example, - /// compute services are billed per hour. + /// Gets the unit of measure used to bill for the product. For example, compute + /// services are billed per hour. /// - [JsonProperty(PropertyName = "properties.unitOfMeasure")] - public string UnitOfMeasure { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.unitOfMeasure")] + public string UnitOfMeasure {get; private set; } /// /// Gets the number of units used for a given product. /// - [JsonProperty(PropertyName = "properties.units")] - public double? Units { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.units")] + public double? Units {get; private set; } /// /// Gets the description for the unit of measure for a given product. /// - [JsonProperty(PropertyName = "properties.unitType")] - public string UnitType { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.unitType")] + public string UnitType {get; private set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs new file mode 100644 index 000000000000..1823cf65c33e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs @@ -0,0 +1,430 @@ +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a transaction. + /// + public partial class TransactionProperties + { + /// + /// Initializes a new instance of the TransactionProperties class. + /// + public TransactionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransactionProperties class. + /// + + /// The kind of transaction. Options are all or reservation. + /// Possible values include: 'all', 'reservation' + + /// The date of transaction. + /// + + /// Invoice on which the transaction was billed or 'pending' if the transaction + /// is not billed. + /// + + /// The ID of the invoice on which the transaction was billed. This field is + /// only applicable for transactions which are billed. + /// + + /// The order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + + /// The name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + + /// The family of the product for which the transaction took place. + /// + + /// The ID of the product type for which the transaction took place. + /// + + /// The type of the product for which the transaction took place. + /// + + /// The description of the product for which the transaction took place. + /// + + /// The type of transaction. + /// Possible values include: 'Purchase', 'Usage Charge' + + /// The charge associated with the transaction. + /// + + /// The quantity purchased in the transaction. + /// + + /// The ID of the invoice section which will be billed for the transaction. + /// + + /// The name of the invoice section which will be billed for the transaction. + /// + + /// The ID of the billing profile which will be billed for the transaction. + /// + + /// The name of the billing profile which will be billed for the transaction. + /// + + /// The ID of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the subscription that was used for the transaction. The field is + /// only applicable for transaction of kind reservation. + /// + + /// The name of the subscription that was used for the transaction. The field + /// is only applicable for transaction of kind reservation. + /// + + /// The type of azure plan of the subscription that was used for the + /// transaction. + /// + + /// The amount of any Azure credits automatically applied to this transaction. + /// + + /// The ISO 4217 code for the currency in which this transaction is billed. + /// + + /// The percentage discount, if any, applied to this transaction. + /// + + /// The price of the product after applying any discounts. + /// + + /// The exchange rate used to convert charged amount to billing currency, if + /// applicable. + /// + + /// The retail price of the product. + /// + + /// The ISO 4217 code for the currency in which the product is priced. + /// + + /// The date of the purchase of the product, or the start date of the month in + /// which usage started. + /// + + /// The end date of the product term, or the end date of the month in which + /// usage ended. + /// + + /// The pre-tax charged amount for the transaction. + /// + + /// The tax amount applied to the transaction. + /// + + /// The unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + + /// The number of units used for a given product. + /// + + /// The description for the unit of measure for a given product. + /// + public TransactionProperties(string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string invoiceId = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), string azurePlan = default(string), Amount azureCreditApplied = default(Amount), string billingCurrency = default(string), double? discount = default(double?), Amount effectivePrice = default(Amount), double? exchangeRate = default(double?), Amount marketPrice = default(Amount), string pricingCurrency = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), Amount subTotal = default(Amount), Amount tax = default(Amount), string unitOfMeasure = default(string), double? units = default(double?), string unitType = default(string)) + + { + this.Kind = kind; + this.Date = date; + this.Invoice = invoice; + this.InvoiceId = invoiceId; + this.OrderId = orderId; + this.OrderName = orderName; + this.ProductFamily = productFamily; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.ProductDescription = productDescription; + this.TransactionType = transactionType; + this.TransactionAmount = transactionAmount; + this.Quantity = quantity; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionName = subscriptionName; + this.AzurePlan = azurePlan; + this.AzureCreditApplied = azureCreditApplied; + this.BillingCurrency = billingCurrency; + this.Discount = discount; + this.EffectivePrice = effectivePrice; + this.ExchangeRate = exchangeRate; + this.MarketPrice = marketPrice; + this.PricingCurrency = pricingCurrency; + this.ServicePeriodStartDate = servicePeriodStartDate; + this.ServicePeriodEndDate = servicePeriodEndDate; + this.SubTotal = subTotal; + this.Tax = tax; + this.UnitOfMeasure = unitOfMeasure; + this.Units = units; + this.UnitType = unitType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; set; } + + /// + /// Gets the date of transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; private set; } + + /// + /// Gets invoice on which the transaction was billed or 'pending' if the + /// transaction is not billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoice")] + public string Invoice {get; private set; } + + /// + /// Gets the ID of the invoice on which the transaction was billed. This field + /// is only applicable for transactions which are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceId")] + public string InvoiceId {get; private set; } + + /// + /// Gets the order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "orderId")] + public string OrderId {get; private set; } + + /// + /// Gets the name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "orderName")] + public string OrderName {get; private set; } + + /// + /// Gets the family of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productFamily")] + public string ProductFamily {get; private set; } + + /// + /// Gets the ID of the product type for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the type of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productType")] + public string ProductType {get; private set; } + + /// + /// Gets the description of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productDescription")] + public string ProductDescription {get; private set; } + + /// + /// Gets or sets the type of transaction. Possible values include: 'Purchase', 'Usage Charge' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transactionType")] + public string TransactionType {get; set; } + + /// + /// Gets the charge associated with the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transactionAmount")] + public Amount TransactionAmount {get; private set; } + + /// + /// Gets the quantity purchased in the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "quantity")] + public int? Quantity {get; private set; } + + /// + /// Gets the ID of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for which the transaction took place. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for which the transaction took place. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; private set; } + + /// + /// Gets the name of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionName")] + public string SubscriptionName {get; private set; } + + /// + /// Gets the type of azure plan of the subscription that was used for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azurePlan")] + public string AzurePlan {get; private set; } + + /// + /// Gets the amount of any Azure credits automatically applied to this + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azureCreditApplied")] + public Amount AzureCreditApplied {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which this transaction is + /// billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingCurrency")] + public string BillingCurrency {get; private set; } + + /// + /// Gets the percentage discount, if any, applied to this transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "discount")] + public double? Discount {get; private set; } + + /// + /// Gets the price of the product after applying any discounts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "effectivePrice")] + public Amount EffectivePrice {get; private set; } + + /// + /// Gets the exchange rate used to convert charged amount to billing currency, + /// if applicable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "exchangeRate")] + public double? ExchangeRate {get; private set; } + + /// + /// Gets the retail price of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "marketPrice")] + public Amount MarketPrice {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which the product is priced. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "pricingCurrency")] + public string PricingCurrency {get; private set; } + + /// + /// Gets the date of the purchase of the product, or the start date of the + /// month in which usage started. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the product term, or the end date of the month in + /// which usage ended. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate {get; private set; } + + /// + /// Gets the pre-tax charged amount for the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the tax amount applied to the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tax")] + public Amount Tax {get; private set; } + + /// + /// Gets the unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "unitOfMeasure")] + public string UnitOfMeasure {get; private set; } + + /// + /// Gets the number of units used for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "units")] + public double? Units {get; private set; } + + /// + /// Gets the description for the unit of measure for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "unitType")] + public string UnitType {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs index 700c53775320..404dd5fa90d5 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for TransactionTypeKind. /// + + public static class TransactionTypeKind { public const string All = "all"; public const string Reservation = "reservation"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs index 58ad2fc19b6b..807bb3e24b77 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -20,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class TransferBillingSubscriptionRequestProperties { /// - /// Initializes a new instance of the - /// TransferBillingSubscriptionRequestProperties class. + /// Initializes a new instance of the TransferBillingSubscriptionRequestProperties class. /// public TransferBillingSubscriptionRequestProperties() { @@ -29,14 +21,15 @@ public TransferBillingSubscriptionRequestProperties() } /// - /// Initializes a new instance of the - /// TransferBillingSubscriptionRequestProperties class. + /// Initializes a new instance of the TransferBillingSubscriptionRequestProperties class. /// - /// The destination invoice - /// section id. + + /// The destination invoice section id. + /// public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId) + { - DestinationInvoiceSectionId = destinationInvoiceSectionId; + this.DestinationInvoiceSectionId = destinationInvoiceSectionId; CustomInit(); } @@ -45,24 +38,25 @@ public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSec /// partial void CustomInit(); + /// /// Gets or sets the destination invoice section id. /// - [JsonProperty(PropertyName = "destinationInvoiceSectionId")] - public string DestinationInvoiceSectionId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (DestinationInvoiceSectionId == null) + if (this.DestinationInvoiceSectionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "DestinationInvoiceSectionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DestinationInvoiceSectionId"); } + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs index f8ce7edb5219..ba575477bc1d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class TransferProductRequestProperties { /// - /// Initializes a new instance of the TransferProductRequestProperties - /// class. + /// Initializes a new instance of the TransferProductRequestProperties class. /// public TransferProductRequestProperties() { @@ -28,14 +21,15 @@ public TransferProductRequestProperties() } /// - /// Initializes a new instance of the TransferProductRequestProperties - /// class. + /// Initializes a new instance of the TransferProductRequestProperties class. /// - /// The destination invoice - /// section id. + + /// The destination invoice section id. + /// public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string)) + { - DestinationInvoiceSectionId = destinationInvoiceSectionId; + this.DestinationInvoiceSectionId = destinationInvoiceSectionId; CustomInit(); } @@ -44,11 +38,11 @@ public TransferProductRequestProperties() /// partial void CustomInit(); + /// /// Gets or sets the destination invoice section id. /// - [JsonProperty(PropertyName = "destinationInvoiceSectionId")] - public string DestinationInvoiceSectionId { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs index f3ec2bbcb846..3861bca0cfbc 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,16 +23,21 @@ public ValidateAddressResponse() /// /// Initializes a new instance of the ValidateAddressResponse class. /// - /// status of the address validation. Possible - /// values include: 'Valid', 'Invalid' - /// The list of suggested - /// addresses. - /// Validation error message. - public ValidateAddressResponse(string status = default(string), IList suggestedAddresses = default(IList), string validationMessage = default(string)) + + /// status of the address validation. + /// Possible values include: 'Valid', 'Invalid' + + /// The list of suggested addresses. + /// + + /// Validation error message. + /// + public ValidateAddressResponse(string status = default(string), System.Collections.Generic.IList suggestedAddresses = default(System.Collections.Generic.IList), string validationMessage = default(string)) + { - Status = status; - SuggestedAddresses = suggestedAddresses; - ValidationMessage = validationMessage; + this.Status = status; + this.SuggestedAddresses = suggestedAddresses; + this.ValidationMessage = validationMessage; CustomInit(); } @@ -49,24 +46,23 @@ public ValidateAddressResponse() /// partial void CustomInit(); + /// - /// Gets or sets status of the address validation. Possible values - /// include: 'Valid', 'Invalid' + /// Gets or sets status of the address validation. Possible values include: 'Valid', 'Invalid' /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets the list of suggested addresses. /// - [JsonProperty(PropertyName = "suggestedAddresses")] - public IList SuggestedAddresses { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "suggestedAddresses")] + public System.Collections.Generic.IList SuggestedAddresses {get; set; } /// /// Gets or sets validation error message. /// - [JsonProperty(PropertyName = "validationMessage")] - public string ValidationMessage { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "validationMessage")] + public string ValidationMessage {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs index 6d06b5bcc559..003e53036f00 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class ValidateProductTransferEligibilityError { /// - /// Initializes a new instance of the - /// ValidateProductTransferEligibilityError class. + /// Initializes a new instance of the ValidateProductTransferEligibilityError class. /// public ValidateProductTransferEligibilityError() { @@ -28,25 +21,27 @@ public ValidateProductTransferEligibilityError() } /// - /// Initializes a new instance of the - /// ValidateProductTransferEligibilityError class. + /// Initializes a new instance of the ValidateProductTransferEligibilityError class. /// + /// Error code for the product transfer validation. - /// Possible values include: 'InvalidSource', 'ProductNotActive', - /// 'InsufficientPermissionOnSource', - /// 'InsufficientPermissionOnDestination', - /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', - /// 'CrossBillingAccountNotAllowed', - /// 'NotAvailableForDestinationMarket', - /// 'OneTimePurchaseProductTransferNotAllowed' - /// The error message. - /// Detailed error message explaining the - /// error. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + + /// The error message. + /// + + /// Detailed error message explaining the error. + /// public ValidateProductTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { - Code = code; - Message = message; - Details = details; + this.Code = code; + this.Message = message; + this.Details = details; CustomInit(); } @@ -55,30 +50,23 @@ public ValidateProductTransferEligibilityError() /// partial void CustomInit(); + /// - /// Gets or sets error code for the product transfer validation. - /// Possible values include: 'InvalidSource', 'ProductNotActive', - /// 'InsufficientPermissionOnSource', - /// 'InsufficientPermissionOnDestination', - /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', - /// 'CrossBillingAccountNotAllowed', - /// 'NotAvailableForDestinationMarket', - /// 'OneTimePurchaseProductTransferNotAllowed' + /// Gets or sets error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed' /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets the error message. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } /// /// Gets or sets detailed error message explaining the error. /// - [JsonProperty(PropertyName = "details")] - public string Details { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public string Details {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs index ff0c8119304e..839ff7c044a3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class ValidateProductTransferEligibilityResult { /// - /// Initializes a new instance of the - /// ValidateProductTransferEligibilityResult class. + /// Initializes a new instance of the ValidateProductTransferEligibilityResult class. /// public ValidateProductTransferEligibilityResult() { @@ -28,16 +21,19 @@ public ValidateProductTransferEligibilityResult() } /// - /// Initializes a new instance of the - /// ValidateProductTransferEligibilityResult class. + /// Initializes a new instance of the ValidateProductTransferEligibilityResult class. /// - /// Specifies whether the transfer is - /// eligible or not. - /// Validation error details. + + /// Specifies whether the transfer is eligible or not. + /// + + /// Validation error details. + /// public ValidateProductTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateProductTransferEligibilityError errorDetails = default(ValidateProductTransferEligibilityError)) + { - IsMoveEligible = isMoveEligible; - ErrorDetails = errorDetails; + this.IsMoveEligible = isMoveEligible; + this.ErrorDetails = errorDetails; CustomInit(); } @@ -46,17 +42,17 @@ public ValidateProductTransferEligibilityResult() /// partial void CustomInit(); + /// /// Gets specifies whether the transfer is eligible or not. /// - [JsonProperty(PropertyName = "isMoveEligible")] - public bool? IsMoveEligible { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible {get; private set; } /// /// Gets or sets validation error details. /// - [JsonProperty(PropertyName = "errorDetails")] - public ValidateProductTransferEligibilityError ErrorDetails { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "errorDetails")] + public ValidateProductTransferEligibilityError ErrorDetails {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs index 93b4696ea517..a1ceadba5c4d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class ValidateSubscriptionTransferEligibilityError { /// - /// Initializes a new instance of the - /// ValidateSubscriptionTransferEligibilityError class. + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityError class. /// public ValidateSubscriptionTransferEligibilityError() { @@ -28,24 +21,26 @@ public ValidateSubscriptionTransferEligibilityError() } /// - /// Initializes a new instance of the - /// ValidateSubscriptionTransferEligibilityError class. + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityError class. /// + /// Error code for the product transfer validation. - /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', - /// 'InsufficientPermissionOnSource', - /// 'InsufficientPermissionOnDestination', - /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', - /// 'CrossBillingAccountNotAllowed', - /// 'NotAvailableForDestinationMarket' - /// The error message. - /// Detailed error message explaining the - /// error. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + + /// The error message. + /// + + /// Detailed error message explaining the error. + /// public ValidateSubscriptionTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { - Code = code; - Message = message; - Details = details; + this.Code = code; + this.Message = message; + this.Details = details; CustomInit(); } @@ -54,28 +49,23 @@ public ValidateSubscriptionTransferEligibilityError() /// partial void CustomInit(); + /// - /// Gets or sets error code for the product transfer validation. - /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', - /// 'InsufficientPermissionOnSource', - /// 'InsufficientPermissionOnDestination', - /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', - /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + /// Gets or sets error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets the error message. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } /// /// Gets or sets detailed error message explaining the error. /// - [JsonProperty(PropertyName = "details")] - public string Details { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public string Details {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs index e8fb98e41044..835312e8188b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -19,8 +13,7 @@ namespace Microsoft.Azure.Management.Billing.Models public partial class ValidateSubscriptionTransferEligibilityResult { /// - /// Initializes a new instance of the - /// ValidateSubscriptionTransferEligibilityResult class. + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityResult class. /// public ValidateSubscriptionTransferEligibilityResult() { @@ -28,16 +21,19 @@ public ValidateSubscriptionTransferEligibilityResult() } /// - /// Initializes a new instance of the - /// ValidateSubscriptionTransferEligibilityResult class. + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityResult class. /// - /// Specifies whether the subscription is - /// eligible to be transferred. - /// Validation error details. + + /// Specifies whether the subscription is eligible to be transferred. + /// + + /// Validation error details. + /// public ValidateSubscriptionTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateSubscriptionTransferEligibilityError errorDetails = default(ValidateSubscriptionTransferEligibilityError)) + { - IsMoveEligible = isMoveEligible; - ErrorDetails = errorDetails; + this.IsMoveEligible = isMoveEligible; + this.ErrorDetails = errorDetails; CustomInit(); } @@ -46,18 +42,17 @@ public ValidateSubscriptionTransferEligibilityResult() /// partial void CustomInit(); + /// - /// Gets specifies whether the subscription is eligible to be - /// transferred. + /// Gets specifies whether the subscription is eligible to be transferred. /// - [JsonProperty(PropertyName = "isMoveEligible")] - public bool? IsMoveEligible { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible {get; private set; } /// /// Gets or sets validation error details. /// - [JsonProperty(PropertyName = "errorDetails")] - public ValidateSubscriptionTransferEligibilityError ErrorDetails { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "errorDetails")] + public ValidateSubscriptionTransferEligibilityError ErrorDetails {get; set; } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs index 1554a09e32ab..84a43e548ab3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ViewCharges. /// + + public static class ViewCharges { public const string Allowed = "Allowed"; public const string NotAllowed = "NotAllowed"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs index 39e0334d635c..0fd9b6d374f3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Defines values for ViewChargesPolicy. /// + + public static class ViewChargesPolicy { public const string Allowed = "Allowed"; public const string NotAllowed = "NotAllowed"; } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Operations.cs b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs index 7507aedc3476..fa8f11372deb 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/Operations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// Operations operations. /// - internal partial class Operations : IServiceOperations, IOperations + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations { /// /// Initializes a new instance of the Operations class. @@ -36,13 +24,13 @@ internal partial class Operations : IServiceOperations, /// /// Thrown when a required parameter is null /// - internal Operations(BillingManagementClient client) + internal Operations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -52,7 +40,6 @@ internal Operations(BillingManagementClient client) /// /// Lists the available billing REST API operations. - /// /// /// /// Headers that will be added to request. @@ -60,13 +47,13 @@ internal Operations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -75,54 +62,59 @@ internal Operations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/operations").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -134,50 +126,51 @@ internal Operations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -187,9 +180,10 @@ internal Operations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -200,28 +194,31 @@ internal Operations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the available billing REST API operations. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -232,13 +229,13 @@ internal Operations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -247,51 +244,54 @@ internal Operations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -303,50 +303,51 @@ internal Operations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -356,9 +357,10 @@ internal Operations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -369,24 +371,28 @@ internal Operations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs index e34702e76499..654b47da7413 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs @@ -1,91 +1,76 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for Operations. + /// Extension methods for Operations /// public static partial class OperationsExtensions { - /// - /// Lists the available billing REST API operations. - /// - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IOperations operations) + { + return ((IOperations)operations).ListAsync().GetAwaiter().GetResult(); + } - /// - /// Lists the available billing REST API operations. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IOperations operations, string nextPageLink) + { + return ((IOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the available billing REST API operations. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IOperations operations, string nextPageLink) + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists the available billing REST API operations. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs index 730a744a6ed5..de99c6804332 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// PoliciesOperations operations. /// - internal partial class PoliciesOperations : IServiceOperations, IPoliciesOperations + internal partial class PoliciesOperations : Microsoft.Rest.IServiceOperations, IPoliciesOperations { /// /// Initializes a new instance of the PoliciesOperations class. @@ -36,13 +24,13 @@ internal partial class PoliciesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PoliciesOperations(BillingManagementClient client) + internal PoliciesOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -53,7 +41,6 @@ internal PoliciesOperations(BillingManagementClient client) /// /// Lists the policies for a billing profile. This operation is supported only /// for billing accounts with agreement type Microsoft Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -67,13 +54,13 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -82,66 +69,73 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -153,50 +147,51 @@ internal PoliciesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -206,9 +201,10 @@ internal PoliciesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -219,25 +215,29 @@ internal PoliciesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the policies for a billing profile. This operation is supported /// only for billing accounts with agreement type Microsoft Customer Agreement. @@ -257,13 +257,13 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -272,71 +272,79 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -348,56 +356,57 @@ internal PoliciesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -407,9 +416,10 @@ internal PoliciesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -420,29 +430,32 @@ internal PoliciesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the policies for a customer. This operation is supported only for /// billing accounts with agreement type Microsoft Partner Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -456,13 +469,13 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -471,66 +484,73 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -542,50 +562,51 @@ internal PoliciesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -595,9 +616,10 @@ internal PoliciesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -608,25 +630,29 @@ internal PoliciesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the policies for a customer. This operation is supported only for /// billing accounts with agreement type Microsoft Partner Agreement. @@ -638,9 +664,8 @@ internal PoliciesOperations(BillingManagementClient client) /// The ID that uniquely identifies a customer. /// /// - /// 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' + /// The policy that controls whether the users in customer's organization can + /// view charges at pay-as-you-go prices. /// /// /// Headers that will be added to request. @@ -648,13 +673,13 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -663,72 +688,79 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + string apiVersion = "2020-05-01"; CustomerPolicy parameters = new CustomerPolicy(); - if (viewCharges != null) + if(viewCharges != null) { parameters.ViewCharges = viewCharges; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateCustomer", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "UpdateCustomer", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -740,56 +772,57 @@ internal PoliciesOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -799,9 +832,10 @@ internal PoliciesOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -812,24 +846,28 @@ internal PoliciesOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs index e88b3ba9afde..01d34d86aead 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -1,213 +1,180 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for PoliciesOperations. + /// Extension methods for PoliciesOperations /// public static partial class PoliciesOperationsExtensions { - /// - /// Lists the policies for a billing profile. This operation is supported only - /// for billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) - { - return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); - } + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) + { + return ((IPoliciesOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } - /// - /// Lists the policies for a billing profile. This operation is supported only - /// for billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The cancellation token. - /// - public static async Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Policy Update(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters) + { + return ((IPoliciesOperations)operations).UpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } - /// - /// Updates the policies for a billing profile. This operation is supported - /// only for billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Request parameters that are provided to the update policies operation. - /// - public static Policy Update(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters) + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName) + { + return ((IPoliciesOperations)operations).GetByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } - /// - /// Updates the policies for a billing profile. This operation is supported - /// only for billing accounts with agreement type Microsoft Customer Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// Request parameters that are provided to the update policies operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string)) + { + return ((IPoliciesOperations)operations).UpdateCustomerAsync(billingAccountName, customerName, viewCharges).GetAwaiter().GetResult(); + } - /// - /// Lists the policies for a customer. This operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName) + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, viewCharges, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists the policies for a customer. This operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// The cancellation token. - /// - public static async Task GetByCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the policies for a customer. This operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// 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' - /// - public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string)) - { - return operations.UpdateCustomerAsync(billingAccountName, customerName, viewCharges).GetAwaiter().GetResult(); - } - - /// - /// Updates the policies for a customer. This operation is supported only for - /// billing accounts with agreement type Microsoft Partner Agreement. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// 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' - /// - /// - /// The cancellation token. - /// - public static async Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, viewCharges, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs index a6570c4be059..dc0279877c78 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// ProductsOperations operations. /// - internal partial class ProductsOperations : IServiceOperations, IProductsOperations + internal partial class ProductsOperations : Microsoft.Rest.IServiceOperations, IProductsOperations { /// /// Initializes a new instance of the ProductsOperations class. @@ -36,13 +24,13 @@ internal partial class ProductsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ProductsOperations(BillingManagementClient client) + internal ProductsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -51,10 +39,9 @@ internal ProductsOperations(BillingManagementClient client) public BillingManagementClient Client { get; private set; } /// - /// Lists the products for a customer. These don't include products billed + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -68,13 +55,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -83,66 +70,73 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -154,50 +148,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -207,9 +202,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -220,38 +216,41 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for a billing account. These don't include products + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. /// /// - /// 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 + /// 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 (:). /// /// @@ -260,13 +259,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -275,36 +274,44 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("filter", filter); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (filter != null) { @@ -315,25 +322,24 @@ internal ProductsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -345,50 +351,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -398,9 +405,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -411,30 +419,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for a billing profile. These don't include products + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -443,9 +454,9 @@ internal ProductsOperations(BillingManagementClient client) /// The ID that uniquely identifies a billing profile. /// /// - /// 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 + /// 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 (:). /// /// @@ -454,13 +465,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -469,42 +480,51 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("filter", filter); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (filter != null) { @@ -515,25 +535,24 @@ internal ProductsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -545,50 +564,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -598,9 +618,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -611,30 +632,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for an invoice section. These don't include products + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -646,9 +670,9 @@ internal ProductsOperations(BillingManagementClient client) /// The ID that uniquely identifies an invoice section. /// /// - /// 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 + /// 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 (:). /// /// @@ -657,13 +681,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -672,48 +696,58 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); } + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); } + + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("filter", filter); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (filter != null) { @@ -724,25 +758,24 @@ internal ProductsOperations(BillingManagementClient client) _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -754,50 +787,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -807,9 +841,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -820,29 +855,32 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets a product by ID. The operation is supported only for billing accounts /// with agreement type Microsoft Customer Agreement. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -856,13 +894,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -871,66 +909,73 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (productName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "productName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -942,50 +987,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -995,9 +1041,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1008,25 +1055,29 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Updates the properties of a Product. Currently, auto renew can be updated. /// The operation is supported only for billing accounts with agreement type @@ -1047,13 +1098,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1062,71 +1113,78 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (productName == null) + + + + + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - if (Client.ApiVersion == null) + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } - if (parameters == null) + + if (productName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1138,56 +1196,57 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1197,9 +1256,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1210,32 +1270,35 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Moves a product's charges to a new invoice section. The new invoice section + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1252,13 +1315,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1267,72 +1330,79 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (productName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "productName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); } + + string apiVersion = "2020-05-01"; TransferProductRequestProperties parameters = new TransferProductRequestProperties(); - if (destinationInvoiceSectionId != null) + if(destinationInvoiceSectionId != null) { parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1344,56 +1414,57 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1403,9 +1474,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1416,44 +1488,47 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Validates if a product's charges can be moved to a new invoice section. + /// 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. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -1470,13 +1545,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1485,72 +1560,79 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (productName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "productName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); } + + string apiVersion = "2020-05-01"; TransferProductRequestProperties parameters = new TransferProductRequestProperties(); - if (destinationInvoiceSectionId != null) + if(destinationInvoiceSectionId != null) { parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1562,56 +1644,57 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1621,9 +1704,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1634,30 +1718,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for a customer. These don't include products billed + /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1668,13 +1755,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1683,51 +1770,54 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1739,50 +1829,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1792,9 +1883,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1805,30 +1897,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for a billing account. These don't include products + /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1839,13 +1934,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -1854,51 +1949,54 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1910,50 +2008,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1963,9 +2062,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -1976,30 +2076,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for a billing profile. These don't include products + /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2010,13 +2113,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2025,51 +2128,54 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2081,50 +2187,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2134,9 +2241,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2147,30 +2255,33 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Lists the products for an invoice section. These don't include products + /// 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. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -2181,13 +2292,13 @@ internal ProductsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2196,51 +2307,54 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2252,50 +2366,51 @@ internal ProductsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2305,9 +2420,10 @@ internal ProductsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -2318,24 +2434,28 @@ internal ProductsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs index 5c70f8a05d64..b3be8177e51a 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs @@ -1,609 +1,548 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for ProductsOperations. + /// Extension methods for ProductsOperations /// public static partial class ProductsOperationsExtensions { - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - public static IPage ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName) - { - return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a customer. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName) + { + return ((IProductsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// 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 (:). - /// - public static IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// 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 (:). - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, filter).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// 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 (:). - /// - public static IPage ListByBillingProfile(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, filter).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// 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 (:). - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Get(this IProductsOperations operations, string billingAccountName, string productName) + { + return ((IProductsOperations)operations).GetAsync(billingAccountName, productName).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// 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 (:). - /// - public static IPage ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IProductsOperations operations, string billingAccountName, string productName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, productName, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Update(this IProductsOperations operations, string billingAccountName, string productName, Product parameters) + { + return ((IProductsOperations)operations).UpdateAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a billing profile. - /// - /// - /// The ID that uniquely identifies an invoice section. - /// - /// - /// 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 (:). - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IProductsOperations operations, string billingAccountName, string productName, Product parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + { + return ((IProductsOperations)operations).MoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } - /// - /// Gets a product by ID. The operation is supported only for billing accounts - /// with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - public static Product Get(this IProductsOperations operations, 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) { - return operations.GetAsync(billingAccountName, productName).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + { + return ((IProductsOperations)operations).ValidateMoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + } - /// - /// Gets a product by ID. The operation is supported only for billing accounts - /// with agreement type Microsoft Customer Agreement. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, productName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// Request parameters that are provided to the update product operation. - /// - public static Product Update(this IProductsOperations operations, string billingAccountName, string productName, Product parameters) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.UpdateAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// Request parameters that are provided to the update product operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IProductsOperations operations, string billingAccountName, string productName, Product parameters, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// The destination invoice section id. - /// - public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.MoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return _result.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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// The destination invoice section id. - /// - /// - /// The cancellation token. - /// - public static async Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// The destination invoice section id. - /// - public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) - { - return operations.ValidateMoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies a product. - /// - /// - /// The destination invoice section id. - /// - /// - /// The cancellation token. - /// - public static async Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByCustomerNext(this IProductsOperations operations, string nextPageLink) - { - return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByCustomerNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) - { - return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByBillingProfileNext(this IProductsOperations operations, string nextPageLink) - { - return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByBillingProfileNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceSectionNext(this IProductsOperations operations, string nextPageLink) - { - return operations.ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceSectionNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs deleted file mode 100644 index 8b3c30035787..000000000000 --- a/src/Billing/Billing.Management.Sdk/Generated/SdkInfo_BillingManagementClient.cs +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Billing -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_BillingManagementClient - { - get - { - return new Tuple[] - { - new Tuple("Billing", "Address", "2020-05-01"), - new Tuple("Billing", "Agreements", "2020-05-01"), - new Tuple("Billing", "AvailableBalances", "2020-05-01"), - new Tuple("Billing", "BillingAccounts", "2020-05-01"), - new Tuple("Billing", "BillingPermissions", "2020-05-01"), - new Tuple("Billing", "BillingProfiles", "2020-05-01"), - new Tuple("Billing", "BillingProperty", "2020-05-01"), - new Tuple("Billing", "BillingRoleAssignments", "2020-05-01"), - new Tuple("Billing", "BillingRoleDefinitions", "2020-05-01"), - new Tuple("Billing", "BillingSubscriptions", "2020-05-01"), - new Tuple("Billing", "Customers", "2020-05-01"), - new Tuple("Billing", "Instructions", "2020-05-01"), - new Tuple("Billing", "InvoiceSections", "2020-05-01"), - new Tuple("Billing", "Invoices", "2020-05-01"), - new Tuple("Billing", "Operations", "2020-05-01"), - new Tuple("Billing", "Policies", "2020-05-01"), - new Tuple("Billing", "Products", "2020-05-01"), - new Tuple("Billing", "Transactions", "2020-05-01"), - }.AsEnumerable(); - } - } - } -} diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs index b0fe0e9a9911..70d13b528cd1 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; /// /// TransactionsOperations operations. /// - internal partial class TransactionsOperations : IServiceOperations, ITransactionsOperations + internal partial class TransactionsOperations : Microsoft.Rest.IServiceOperations, ITransactionsOperations { /// /// Initializes a new instance of the TransactionsOperations class. @@ -36,13 +24,13 @@ internal partial class TransactionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal TransactionsOperations(BillingManagementClient client) + internal TransactionsOperations (BillingManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -53,7 +41,6 @@ internal TransactionsOperations(BillingManagementClient client) /// /// Lists the transactions for an invoice. Transactions include purchases, /// refunds and Azure usage charges. - /// /// /// /// The ID that uniquely identifies a billing account. @@ -67,13 +54,13 @@ internal TransactionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -82,66 +69,73 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (billingAccountName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); } + if (invoiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); } + + string apiVersion = "2020-05-01"; // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoice", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoice", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -153,50 +147,51 @@ internal TransactionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -206,9 +201,10 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -219,29 +215,32 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists the transactions for an invoice. Transactions include purchases, /// refunds and Azure usage charges. - /// /// /// /// The NextLink from the previous successful call to List operation. @@ -252,13 +251,13 @@ internal TransactionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when unable to deserialize the response /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -267,51 +266,54 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -323,50 +325,51 @@ internal TransactionsOperations(BillingManagementClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -376,9 +379,10 @@ internal TransactionsOperations(BillingManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); @@ -389,24 +393,28 @@ internal TransactionsOperations(BillingManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs index 9273d6443e9e..a04be1b5cf70 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs @@ -1,107 +1,92 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.Billing { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for TransactionsOperations. + /// Extension methods for TransactionsOperations /// public static partial class TransactionsOperationsExtensions { - /// - /// Lists the transactions for an invoice. Transactions include purchases, - /// refunds and Azure usage charges. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - public static IPage ListByInvoice(this ITransactionsOperations operations, string billingAccountName, string invoiceName) - { - return operations.ListByInvoiceAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); - } + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoice(this ITransactionsOperations operations, string billingAccountName, string invoiceName) + { + return ((ITransactionsOperations)operations).ListByInvoiceAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } - /// - /// Lists the transactions for an invoice. Transactions include purchases, - /// refunds and Azure usage charges. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The ID that uniquely identifies a billing account. - /// - /// - /// The ID that uniquely identifies an invoice. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListByInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceNext(this ITransactionsOperations operations, string nextPageLink) + { + return ((ITransactionsOperations)operations).ListByInvoiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists the transactions for an invoice. Transactions include purchases, - /// refunds and Azure usage charges. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByInvoiceNext(this ITransactionsOperations operations, string nextPageLink) + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceNextAsync(this ITransactionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListByInvoiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists the transactions for an invoice. Transactions include purchases, - /// refunds and Azure usage charges. - /// - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByInvoiceNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByInvoiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/Billing/Billing.Management.Sdk/README.md b/src/Billing/Billing.Management.Sdk/README.md index 529e31af2e5b..d0b7f6f90ead 100644 --- a/src/Billing/Billing.Management.Sdk/README.md +++ b/src/Billing/Billing.Management.Sdk/README.md @@ -5,14 +5,14 @@ This directory contains management plane service clients of Az.Storage module. In this directory, run AutoRest: ``` autorest --reset -autorest --use:@microsoft.azure/autorest.csharp@2.3.90 -autorest.cmd README.md --version=v2 +autorest --use:@autorest/powershell@4.x ``` ### AutoRest Configuration > see https://aka.ms/autorest ``` yaml -csharp: true +isSdkGenerator: true +powershell: true clear-output-folder: true reflect-api-versions: true openapi-type: arm @@ -21,13 +21,12 @@ license-header: MICROSOFT_MIT_NO_VERSION payload-flattening-threshold: 2 ``` - - ### ``` yaml commit: bfd326ea58084517f8e9cb2e6bdbcb0c400f6370 input-file: - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/billing.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/billingV2.json output-folder: Generated From 45cb5e5da49dfbd1ca885639f128da64a79ffe44 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:11:30 +0800 Subject: [PATCH 04/10] Update Az.Billing.psd1 --- src/Billing/Billing/Az.Billing.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Billing/Billing/Az.Billing.psd1 b/src/Billing/Billing/Az.Billing.psd1 index 2562dbccaf3f..a21dd3ff097b 100644 --- a/src/Billing/Billing/Az.Billing.psd1 +++ b/src/Billing/Billing/Az.Billing.psd1 @@ -57,7 +57,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.0.1'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Microsoft.Azure.Commerce.UsageAggregates.dll', - 'Microsoft.Azure.Management.Billing.dll', + 'Microsoft.Azure.PowerShell.Billing.Management.Sdk.dll', 'Microsoft.Azure.Management.Consumption.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. From a17790b69f07f87b667e38502500fe70c192e372 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:18:12 +0800 Subject: [PATCH 05/10] Update BreakingChangeIssues.csv --- .../Exceptions/Az.Billing/BreakingChangeIssues.csv | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv diff --git a/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv new file mode 100644 index 000000000000..bc93c5c4f9e7 --- /dev/null +++ b/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv @@ -0,0 +1,5 @@ +"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.GetAzureRmConsumptionBudget","Get-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." +"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.NewAzureRmConsumptionBudget","New-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." +"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.RemoveAzureRmConsumptionBudget","Remove-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." +"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.SetAzureRmConsumptionBudget","Set-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." +"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.SetAzureRmConsumptionBudget","Set-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." \ No newline at end of file From 36f68d18457ff0097ce09a3ee43199081a314967 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:00:42 +0800 Subject: [PATCH 06/10] fix payload-flattening-threshold --- .../Generated/BillingPropertyOperations.cs | 16 +++---- .../BillingPropertyOperationsExtensions.cs | 8 ++-- .../BillingSubscriptionsOperations.cs | 47 +++++++++++-------- ...illingSubscriptionsOperationsExtensions.cs | 24 +++++----- .../Generated/IBillingPropertyOperations.cs | 7 +-- .../IBillingSubscriptionsOperations.cs | 19 ++++---- .../Generated/IInvoiceSectionsOperations.cs | 18 +++---- .../Generated/IPoliciesOperations.cs | 7 ++- .../Generated/IProductsOperations.cs | 13 ++--- .../Generated/InvoiceSectionsOperations.cs | 31 +++++------- .../InvoiceSectionsOperationsExtensions.cs | 16 +++---- .../Generated/PoliciesOperations.cs | 17 ++++--- .../Generated/PoliciesOperationsExtensions.cs | 8 ++-- .../Generated/ProductsOperations.cs | 33 ++++++------- .../Generated/ProductsOperationsExtensions.cs | 16 +++---- src/Billing/Billing.Management.Sdk/README.md | 2 +- 16 files changed, 139 insertions(+), 143 deletions(-) diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs index 217e08f6d83c..9200d74de6c9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs @@ -229,8 +229,9 @@ internal BillingPropertyOperations (BillingManagementClient client) /// be updated. The operation is supported only for billing accounts with /// agreement type Microsoft Customer Agreement. /// - /// - /// The cost center applied to the subscription. + /// + /// Request parameters that are provided to the update billing property + /// operation. /// /// /// Headers that will be added to request. @@ -253,23 +254,22 @@ internal BillingPropertyOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(BillingProperty parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } if (this.Client.SubscriptionId == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string apiVersion = "2020-05-01"; - BillingProperty parameters = new BillingProperty(); - if(costCenter != null) - { - parameters.CostCenter = costCenter; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs index 456b786519e2..fbd2bf27a20c 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs @@ -49,9 +49,9 @@ public static BillingProperty Get(this IBillingPropertyOperations operations) /// /// The operations group for this extension method. /// - public static BillingProperty Update(this IBillingPropertyOperations operations, string costCenter = default(string)) + public static BillingProperty Update(this IBillingPropertyOperations operations, BillingProperty parameters) { - return ((IBillingPropertyOperations)operations).UpdateAsync(costCenter).GetAwaiter().GetResult(); + return ((IBillingPropertyOperations)operations).UpdateAsync(parameters).GetAwaiter().GetResult(); } /// @@ -65,9 +65,9 @@ public static BillingProperty Get(this IBillingPropertyOperations operations) /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UpdateAsync(this IBillingPropertyOperations operations, string costCenter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingPropertyOperations operations, BillingProperty parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(costCenter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs index 3a603c24855c..f0e61919610d 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs @@ -1259,8 +1259,8 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move subscription operation. /// /// /// Headers that will be added to request. @@ -1268,10 +1268,10 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1283,8 +1283,9 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. /// /// /// Headers that will be added to request. @@ -1307,12 +1308,20 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -1324,11 +1333,6 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); - if(destinationInvoiceSectionId != null) - { - parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1496,8 +1500,8 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move subscription operation. /// /// /// Headers that will be added to request. @@ -1520,12 +1524,20 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -1537,11 +1549,6 @@ internal BillingSubscriptionsOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - TransferBillingSubscriptionRequestProperties parameters = new TransferBillingSubscriptionRequestProperties(); - if(destinationInvoiceSectionId != null) - { - parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs index cd0363f7f05f..38ba9968e7ad 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -268,9 +268,9 @@ public static BillingSubscription Update(this IBillingSubscriptionsOperations op /// /// The ID that uniquely identifies a billing account. /// - public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { - return ((IBillingSubscriptionsOperations)operations).MoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return ((IBillingSubscriptionsOperations)operations).MoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); } /// @@ -288,9 +288,9 @@ public static BillingSubscription Move(this IBillingSubscriptionsOperations oper /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -306,9 +306,9 @@ public static BillingSubscription Move(this IBillingSubscriptionsOperations oper /// /// The ID that uniquely identifies a billing account. /// - public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { - return ((IBillingSubscriptionsOperations)operations).ValidateMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return ((IBillingSubscriptionsOperations)operations).ValidateMoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); } /// @@ -325,9 +325,9 @@ public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IB /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -344,9 +344,9 @@ public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IB /// /// The ID that uniquely identifies a billing account. /// - public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId) + public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { - return ((IBillingSubscriptionsOperations)operations).BeginMoveAsync(billingAccountName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return ((IBillingSubscriptionsOperations)operations).BeginMoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); } /// @@ -364,9 +364,9 @@ public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string destinationInvoiceSectionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs index a33a9442a94d..003590b9f70b 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs @@ -45,8 +45,9 @@ public partial interface IBillingPropertyOperations /// be updated. The operation is supported only for billing accounts with /// agreement type Microsoft Customer Agreement. /// - /// - /// The cost center applied to the subscription. + /// + /// Request parameters that are provided to the update billing property + /// operation. /// /// /// The headers that will be added to request. @@ -60,7 +61,7 @@ public partial interface IBillingPropertyOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string costCenter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(BillingProperty parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } } \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs index b2353ff249df..e477fb25dc0f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs @@ -204,8 +204,8 @@ public partial interface IBillingSubscriptionsOperations /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move subscription operation. /// /// /// The headers that will be added to request. @@ -219,7 +219,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Validates if a subscription's charges can be moved to a new invoice @@ -234,8 +234,9 @@ public partial interface IBillingSubscriptionsOperations /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. /// /// /// The headers that will be added to request. @@ -249,7 +250,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Moves a subscription's charges to a new invoice section. The new invoice @@ -266,8 +267,8 @@ public partial interface IBillingSubscriptionsOperations /// /// The ID that uniquely identifies a billing account. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move subscription operation. /// /// /// The headers that will be added to request. @@ -281,7 +282,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, string destinationInvoiceSectionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Lists the subscriptions for a customer. The operation is supported only for diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs index ce2d3e0e20a3..a28ddc74947f 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs @@ -91,11 +91,8 @@ public partial interface IInvoiceSectionsOperations /// /// The ID that uniquely identifies an invoice section. /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. + /// + /// The new or updated invoice section. /// /// /// The headers that will be added to request. @@ -109,7 +106,7 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Creates or updates an invoice section. The operation is supported only for @@ -128,11 +125,8 @@ public partial interface IInvoiceSectionsOperations /// /// The ID that uniquely identifies an invoice section. /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. + /// + /// The new or updated invoice section. /// /// /// The headers that will be added to request. @@ -146,7 +140,7 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Lists the invoice sections that a user has access to. The operation is diff --git a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs index 98701444ff88..3ef5c91514ee 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs @@ -114,9 +114,8 @@ public partial interface IPoliciesOperations /// /// The ID that uniquely identifies a customer. /// - /// - /// The policy that controls whether the users in customer's organization can - /// view charges at pay-as-you-go prices. + /// + /// Request parameters that are provided to the update policies operation. /// /// /// The headers that will be added to request. @@ -130,7 +129,7 @@ public partial interface IPoliciesOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, CustomerPolicy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } } \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs index 736c1fdb13c8..3511047027e3 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs @@ -232,8 +232,8 @@ public partial interface IProductsOperations /// /// The ID that uniquely identifies a product. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move product operation. /// /// /// The headers that will be added to request. @@ -247,7 +247,7 @@ public partial interface IProductsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Validates if a product's charges can be moved to a new invoice section. @@ -267,8 +267,9 @@ public partial interface IProductsOperations /// /// The ID that uniquely identifies a product. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. /// /// /// The headers that will be added to request. @@ -282,7 +283,7 @@ public partial interface IProductsOperations /// /// Thrown when unable to deserialize the response /// - System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// Lists the products for a customer. These don't include products billed diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs index a97fe811c0ab..afaff8c13870 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs @@ -462,11 +462,8 @@ internal InvoiceSectionsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies an invoice section. /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. + /// + /// The new or updated invoice section. /// /// /// Headers that will be added to request. @@ -474,10 +471,10 @@ internal InvoiceSectionsOperations (BillingManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, customHeaders, cancellationToken).ConfigureAwait(false); + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -494,11 +491,8 @@ internal InvoiceSectionsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies an invoice section. /// - /// - /// The name of the invoice section. - /// - /// - /// Dictionary of metadata associated with the invoice section. + /// + /// The new or updated invoice section. /// /// /// Headers that will be added to request. @@ -521,12 +515,17 @@ internal InvoiceSectionsOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -543,12 +542,6 @@ internal InvoiceSectionsOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - InvoiceSection parameters = new InvoiceSection(); - if(displayName != null||labels != null) - { - parameters.DisplayName = displayName; - parameters.Labels = labels; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs index ae03f551ad12..d51b73f6c992 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs @@ -118,9 +118,9 @@ public static InvoiceSection Get(this IInvoiceSectionsOperations operations, str /// /// The ID that uniquely identifies an invoice section. /// - public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary)) + public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return ((IInvoiceSectionsOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + return ((IInvoiceSectionsOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -142,9 +142,9 @@ public static InvoiceSection Get(this IInvoiceSectionsOperations operations, str /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -165,9 +165,9 @@ public static InvoiceSection Get(this IInvoiceSectionsOperations operations, str /// /// The ID that uniquely identifies an invoice section. /// - public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary)) + public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return ((IInvoiceSectionsOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels).GetAwaiter().GetResult(); + return ((IInvoiceSectionsOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -189,9 +189,9 @@ public static InvoiceSection Get(this IInvoiceSectionsOperations operations, str /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName, labels, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs index de99c6804332..c9bc67949d3e 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs @@ -663,9 +663,8 @@ internal PoliciesOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a customer. /// - /// - /// The policy that controls whether the users in customer's organization can - /// view charges at pay-as-you-go prices. + /// + /// Request parameters that are provided to the update policies operation. /// /// /// Headers that will be added to request. @@ -688,12 +687,17 @@ internal PoliciesOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string viewCharges = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, CustomerPolicy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -705,11 +709,6 @@ internal PoliciesOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - CustomerPolicy parameters = new CustomerPolicy(); - if(viewCharges != null) - { - parameters.ViewCharges = viewCharges; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs index 01d34d86aead..6e3639fc59f5 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -148,9 +148,9 @@ public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, /// /// The ID that uniquely identifies a customer. /// - public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string)) + public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, CustomerPolicy parameters) { - return ((IPoliciesOperations)operations).UpdateCustomerAsync(billingAccountName, customerName, viewCharges).GetAwaiter().GetResult(); + return ((IPoliciesOperations)operations).UpdateCustomerAsync(billingAccountName, customerName, parameters).GetAwaiter().GetResult(); } /// @@ -169,9 +169,9 @@ public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, string viewCharges = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, CustomerPolicy parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, viewCharges, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs index dc0279877c78..a2cf48854844 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs @@ -1306,8 +1306,8 @@ internal ProductsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a product. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the move product operation. /// /// /// Headers that will be added to request. @@ -1330,12 +1330,17 @@ internal ProductsOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -1347,11 +1352,6 @@ internal ProductsOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - TransferProductRequestProperties parameters = new TransferProductRequestProperties(); - if(destinationInvoiceSectionId != null) - { - parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1536,8 +1536,9 @@ internal ProductsOperations (BillingManagementClient client) /// /// The ID that uniquely identifies a product. /// - /// - /// The destination invoice section id. + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. /// /// /// Headers that will be added to request. @@ -1560,12 +1561,17 @@ internal ProductsOperations (BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); @@ -1577,11 +1583,6 @@ internal ProductsOperations (BillingManagementClient client) } string apiVersion = "2020-05-01"; - TransferProductRequestProperties parameters = new TransferProductRequestProperties(); - if(destinationInvoiceSectionId != null) - { - parameters.DestinationInvoiceSectionId = destinationInvoiceSectionId; - } // Tracing bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs index b3be8177e51a..304956deb1d9 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs @@ -320,9 +320,9 @@ public static Product Update(this IProductsOperations operations, string billing /// /// The ID that uniquely identifies a product. /// - public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters) { - return ((IProductsOperations)operations).MoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return ((IProductsOperations)operations).MoveAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); } /// @@ -344,9 +344,9 @@ public static Product Update(this IProductsOperations operations, string billing /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -366,9 +366,9 @@ public static Product Update(this IProductsOperations operations, string billing /// /// The ID that uniquely identifies a product. /// - public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string)) + public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters) { - return ((IProductsOperations)operations).ValidateMoveAsync(billingAccountName, productName, destinationInvoiceSectionId).GetAwaiter().GetResult(); + return ((IProductsOperations)operations).ValidateMoveAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); } /// @@ -389,9 +389,9 @@ public static Product Update(this IProductsOperations operations, string billing /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, string destinationInvoiceSectionId = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, destinationInvoiceSectionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/Billing/Billing.Management.Sdk/README.md b/src/Billing/Billing.Management.Sdk/README.md index d0b7f6f90ead..243cd1b8aa7b 100644 --- a/src/Billing/Billing.Management.Sdk/README.md +++ b/src/Billing/Billing.Management.Sdk/README.md @@ -18,7 +18,7 @@ reflect-api-versions: true openapi-type: arm azure-arm: true license-header: MICROSOFT_MIT_NO_VERSION -payload-flattening-threshold: 2 +payload-flattening-threshold: 0 ``` ### From 942da00b03b041fbe341120bcf07ed2e674527d2 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:19:52 +0800 Subject: [PATCH 07/10] Update ChangeLog.md --- src/Billing/Billing/ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Billing/Billing/ChangeLog.md b/src/Billing/Billing/ChangeLog.md index 893a43543369..ecf79d28f97b 100644 --- a/src/Billing/Billing/ChangeLog.md +++ b/src/Billing/Billing/ChangeLog.md @@ -18,6 +18,8 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed "Microsoft.Azure.Management.Billing" Version "4.1.0" PackageReference +* Removed "Microsoft.Azure.Management.Consumption" Version "3.0.0" PackageReference ## Version 2.2.0 * Upgraded nuget package to signed package. From 534232fbc074f6e3e47f7d8e5afd1f5eff720faf Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 21 Feb 2025 11:31:56 +0800 Subject: [PATCH 08/10] sync up autorest generated code --- .../Generated/BillingManagementClient.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs index 95f6a815db88..4a44e21251ca 100644 --- a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs @@ -340,6 +340,9 @@ public BillingManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientC /// /// Optional. The http client handler used to handle http transport. /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// /// /// Thrown when a required parameter is null /// From c9a4257a514f7eb09a82a698a9d66fded5b79192 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:50:33 +0800 Subject: [PATCH 09/10] Update ChangeLog.md --- src/Billing/Billing/ChangeLog.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Billing/Billing/ChangeLog.md b/src/Billing/Billing/ChangeLog.md index ecf79d28f97b..8e0a3ee12f85 100644 --- a/src/Billing/Billing/ChangeLog.md +++ b/src/Billing/Billing/ChangeLog.md @@ -19,7 +19,6 @@ --> ## Upcoming Release * Removed "Microsoft.Azure.Management.Billing" Version "4.1.0" PackageReference -* Removed "Microsoft.Azure.Management.Consumption" Version "3.0.0" PackageReference ## Version 2.2.0 * Upgraded nuget package to signed package. From 282447332e19e92c472a8704cbdbc337fb66d156 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:37:58 +0800 Subject: [PATCH 10/10] Revert "Update BreakingChangeIssues.csv" This reverts commit a17790b69f07f87b667e38502500fe70c192e372. --- .../Exceptions/Az.Billing/BreakingChangeIssues.csv | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv diff --git a/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv deleted file mode 100644 index bc93c5c4f9e7..000000000000 --- a/tools/StaticAnalysis/Exceptions/Az.Billing/BreakingChangeIssues.csv +++ /dev/null @@ -1,5 +0,0 @@ -"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.GetAzureRmConsumptionBudget","Get-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." -"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.NewAzureRmConsumptionBudget","New-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." -"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.RemoveAzureRmConsumptionBudget","Remove-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." -"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.SetAzureRmConsumptionBudget","Set-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." -"Az.Billing","Microsoft.Azure.Commands.Consumption.Cmdlets.Budget.SetAzureRmConsumptionBudget","Set-AzConsumptionBudget","0","3000","The type of property 'Amount' of type 'Microsoft.Azure.Commands.Consumption.Models.PSBudget' has changed from 'System.Decimal' to 'System.Nullable`1[System.Decimal]'.","Change the type of property 'Amount' back to 'System.Decimal'." \ No newline at end of file