diff --git a/packages/@azure/arm-billing/LICENSE.txt b/packages/@azure/arm-billing/LICENSE.txt index 5431ba98b936..8f3d856145c5 100644 --- a/packages/@azure/arm-billing/LICENSE.txt +++ b/packages/@azure/arm-billing/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2019 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@azure/arm-billing/lib/billingManagementClient.ts b/packages/@azure/arm-billing/lib/billingManagementClient.ts index 9d43fa4f0c48..137d267ee26a 100644 --- a/packages/@azure/arm-billing/lib/billingManagementClient.ts +++ b/packages/@azure/arm-billing/lib/billingManagementClient.ts @@ -20,6 +20,7 @@ class BillingManagementClient extends BillingManagementClientContext { enrollmentAccounts: operations.EnrollmentAccounts; billingPeriods: operations.BillingPeriods; invoices: operations.Invoices; + products: operations.Products; operations: operations.Operations; /** @@ -33,6 +34,7 @@ class BillingManagementClient extends BillingManagementClientContext { this.enrollmentAccounts = new operations.EnrollmentAccounts(this); this.billingPeriods = new operations.BillingPeriods(this); this.invoices = new operations.Invoices(this); + this.products = new operations.Products(this); this.operations = new operations.Operations(this); } } diff --git a/packages/@azure/arm-billing/lib/billingManagementClientContext.ts b/packages/@azure/arm-billing/lib/billingManagementClientContext.ts index eab3e097eeac..93728a141995 100644 --- a/packages/@azure/arm-billing/lib/billingManagementClientContext.ts +++ b/packages/@azure/arm-billing/lib/billingManagementClientContext.ts @@ -46,7 +46,7 @@ export class BillingManagementClientContext extends msRestAzure.AzureServiceClie } super(credentials, options); - this.apiVersion = '2018-03-01-preview'; + this.apiVersion = '2018-11-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; diff --git a/packages/@azure/arm-billing/lib/models/index.ts b/packages/@azure/arm-billing/lib/models/index.ts index 59f6023515e8..d73877125a1c 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -14,6 +14,20 @@ import * as msRest from "ms-rest-js"; export { BaseResource, CloudError }; +/** + * @interface + * An interface representing TransferProductProperties. + * The properties of the product to initiate a transfer. + * + */ +export interface TransferProductProperties { + /** + * @member {string} [destinationInvoiceSectionId] Destination invoice section + * id. + */ + destinationInvoiceSectionId?: string; +} + /** * @interface * An interface representing Resource. @@ -303,6 +317,21 @@ export interface InvoicesListOptionalParams extends msRest.RequestOptionsBase { top?: number; } +/** + * @interface + * An interface representing ProductsTransferOptionalParams. + * Optional Parameters. + * + * @extends RequestOptionsBase + */ +export interface ProductsTransferOptionalParams extends msRest.RequestOptionsBase { + /** + * @member {string} [destinationInvoiceSectionId] Destination invoice section + * id. + */ + destinationInvoiceSectionId?: string; +} + /** * @interface * An interface representing BillingManagementClientOptions. @@ -315,6 +344,29 @@ export interface BillingManagementClientOptions extends AzureServiceClientOption baseUri?: string; } +/** + * @interface + * An interface representing ProductsTransferHeaders. + * Defines headers for Transfer operation. + * + */ +export interface ProductsTransferHeaders { + /** + * @member {string} [location] Location URI to poll for result + */ + location: string; + /** + * @member {number} [retryAfter] Recommends the retryable time after + * receiving this. + */ + retryAfter: number; + /** + * @member {string} [azureAsyncOperation] URI to poll for the operation + * status + */ + azureAsyncOperation: string; +} + /** * @interface @@ -574,6 +626,21 @@ export type InvoicesListNextResponse = InvoicesListResult & { }; }; +/** + * Contains response data for the transfer operation. + */ +export type ProductsTransferResponse = ProductsTransferHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: ProductsTransferHeaders; + }; +}; + /** * Contains response data for the list operation. */ diff --git a/packages/@azure/arm-billing/lib/models/mappers.ts b/packages/@azure/arm-billing/lib/models/mappers.ts index 9ae65c44eb82..f62b488a98a4 100644 --- a/packages/@azure/arm-billing/lib/models/mappers.ts +++ b/packages/@azure/arm-billing/lib/models/mappers.ts @@ -14,6 +14,22 @@ import * as msRest from "ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; +export const TransferProductProperties: msRest.CompositeMapper = { + serializedName: "TransferProductProperties", + type: { + name: "Composite", + className: "TransferProductProperties", + modelProperties: { + destinationInvoiceSectionId: { + serializedName: "destinationInvoiceSectionId", + type: { + name: "String" + } + } + } + } +}; + export const Resource: msRest.CompositeMapper = { serializedName: "Resource", type: { @@ -271,6 +287,34 @@ export const Operation: msRest.CompositeMapper = { } }; +export const ProductsTransferHeaders: msRest.CompositeMapper = { + serializedName: "products-transfer-headers", + type: { + name: "Composite", + className: "ProductsTransferHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + export const EnrollmentAccountListResult: msRest.CompositeMapper = { serializedName: "EnrollmentAccountListResult", type: { diff --git a/packages/@azure/arm-billing/lib/models/parameters.ts b/packages/@azure/arm-billing/lib/models/parameters.ts index c3d7dbc8cd9f..dc09c05aad1c 100644 --- a/packages/@azure/arm-billing/lib/models/parameters.ts +++ b/packages/@azure/arm-billing/lib/models/parameters.ts @@ -30,6 +30,16 @@ export const apiVersion: msRest.OperationQueryParameter = { } } }; +export const billingAccountId: msRest.OperationURLParameter = { + parameterPath: "billingAccountId", + mapper: { + required: true, + serializedName: "billingAccountId", + type: { + name: "String" + } + } +}; export const billingPeriodName: msRest.OperationURLParameter = { parameterPath: "billingPeriodName", mapper: { @@ -74,6 +84,16 @@ export const invoiceName: msRest.OperationURLParameter = { } } }; +export const invoiceSectionId: msRest.OperationURLParameter = { + parameterPath: "invoiceSectionId", + mapper: { + required: true, + serializedName: "invoiceSectionId", + type: { + name: "String" + } + } +}; export const name: msRest.OperationURLParameter = { parameterPath: "name", mapper: { @@ -95,6 +115,16 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; +export const productName: msRest.OperationURLParameter = { + parameterPath: "productName", + mapper: { + required: true, + serializedName: "productName", + type: { + name: "String" + } + } +}; export const skiptoken: msRest.OperationQueryParameter = { parameterPath: [ "options", diff --git a/packages/@azure/arm-billing/lib/models/productsMappers.ts b/packages/@azure/arm-billing/lib/models/productsMappers.ts new file mode 100644 index 000000000000..01c30186ca7e --- /dev/null +++ b/packages/@azure/arm-billing/lib/models/productsMappers.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Microsoft Corporation. All rights 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. + */ + +export { + TransferProductProperties, + ProductsTransferHeaders, + ErrorResponse, + ErrorDetails +} from "../models/mappers"; + diff --git a/packages/@azure/arm-billing/lib/operations/index.ts b/packages/@azure/arm-billing/lib/operations/index.ts index cfc488e846ba..c65ef11eb886 100644 --- a/packages/@azure/arm-billing/lib/operations/index.ts +++ b/packages/@azure/arm-billing/lib/operations/index.ts @@ -11,4 +11,5 @@ export * from "./enrollmentAccounts"; export * from "./billingPeriods"; export * from "./invoices"; +export * from "./products"; export * from "./operations"; diff --git a/packages/@azure/arm-billing/lib/operations/products.ts b/packages/@azure/arm-billing/lib/operations/products.ts new file mode 100644 index 000000000000..57ba578901b9 --- /dev/null +++ b/packages/@azure/arm-billing/lib/operations/products.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. All rights 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. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/productsMappers"; +import * as Parameters from "../models/parameters"; +import { BillingManagementClientContext } from "../billingManagementClientContext"; + +/** Class representing a Products. */ +export class Products { + private readonly client: BillingManagementClientContext; + + /** + * Create a Products. + * @param {BillingManagementClientContext} client Reference to the service client. + */ + constructor(client: BillingManagementClientContext) { + this.client = client; + } + + /** + * The operation to transfer a Product to another InvoiceSection. + * @param billingAccountId billing Account Id. + * @param invoiceSectionId Invoice Id. + * @param productName Product Id. + * @param [options] The optional parameters + * @returns Promise + */ + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: Models.ProductsTransferOptionalParams): Promise; + /** + * @param billingAccountId billing Account Id. + * @param invoiceSectionId Invoice Id. + * @param productName Product Id. + * @param callback The callback + */ + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, callback: msRest.ServiceCallback): void; + /** + * @param billingAccountId billing Account Id. + * @param invoiceSectionId Invoice Id. + * @param productName Product Id. + * @param options The optional parameters + * @param callback The callback + */ + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options: Models.ProductsTransferOptionalParams, callback: msRest.ServiceCallback): void; + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: Models.ProductsTransferOptionalParams, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + billingAccountId, + invoiceSectionId, + productName, + options + }, + transferOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const transferOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}/products/{productName}/transfer", + urlParameters: [ + Parameters.billingAccountId, + Parameters.invoiceSectionId, + Parameters.productName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: { + destinationInvoiceSectionId: [ + "options", + "destinationInvoiceSectionId" + ] + }, + mapper: { + ...Mappers.TransferProductProperties, + required: true + } + }, + responses: { + 202: { + headersMapper: Mappers.ProductsTransferHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +};