From c92fc79938c3446c4c936efe2485f98df45978c2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 8 Feb 2019 10:32:35 +0000 Subject: [PATCH 1/3] Generated from 5cea84d15ec15d6ac36f627700b139d4a0f56546 [DO NOT MERGE] Changes for introduction of transfer products API These are the API changes for the transfer products API for Azure modern billing platform infrastructure --- packages/@azure/arm-billing/LICENSE.txt | 2 +- .../lib/billingManagementClient.ts | 2 + .../lib/billingManagementClientContext.ts | 2 +- .../@azure/arm-billing/lib/models/index.ts | 54 ++++++++++ .../@azure/arm-billing/lib/models/mappers.ts | 45 +++++++++ .../arm-billing/lib/models/parameters.ts | 30 ++++++ .../arm-billing/lib/models/productsMappers.ts | 17 ++++ .../arm-billing/lib/operations/index.ts | 1 + .../arm-billing/lib/operations/products.ts | 98 +++++++++++++++++++ 9 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 packages/@azure/arm-billing/lib/models/productsMappers.ts create mode 100644 packages/@azure/arm-billing/lib/operations/products.ts 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..c3a7d8048b7c 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -14,6 +14,22 @@ import * as msRest from "ms-rest-js"; export { BaseResource, CloudError }; +/** + * @interface + * An interface representing TransferProductProperties. + * The properties of the product to initiate itansfer. + * + */ +export interface TransferProductProperties { + /** + * @member {string} [destinationInvoiceSectionId] Destination invoice section + * id. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly destinationInvoiceSectionId?: string; +} + /** * @interface * An interface representing Resource. @@ -315,6 +331,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 +613,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..bfa6478208b4 100644 --- a/packages/@azure/arm-billing/lib/models/mappers.ts +++ b/packages/@azure/arm-billing/lib/models/mappers.ts @@ -14,6 +14,23 @@ 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: { + readOnly: true, + serializedName: "destinationInvoiceSectionId", + type: { + name: "String" + } + } + } + } +}; + export const Resource: msRest.CompositeMapper = { serializedName: "Resource", type: { @@ -271,6 +288,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..ed7c94c11a2c --- /dev/null +++ b/packages/@azure/arm-billing/lib/operations/products.ts @@ -0,0 +1,98 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * 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?: msRest.RequestOptionsBase): 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: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: msRest.RequestOptionsBase, 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: "parameters", + mapper: { + ...Mappers.TransferProductProperties, + required: true + } + }, + responses: { + 202: { + headersMapper: Mappers.ProductsTransferHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; From b32858ce826cb98d9323e874c0ea770ea61a5ee4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 8 Feb 2019 21:06:09 +0000 Subject: [PATCH 2/3] Generated from f7bd66f5b55d7d6f6baf55c50803c6ddb01f6cca Changes for the Microsoft Billing APIs --- packages/@azure/arm-billing/lib/models/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@azure/arm-billing/lib/models/index.ts b/packages/@azure/arm-billing/lib/models/index.ts index c3a7d8048b7c..53082393773c 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -17,7 +17,7 @@ export { BaseResource, CloudError }; /** * @interface * An interface representing TransferProductProperties. - * The properties of the product to initiate itansfer. + * The properties of the product to initiate a transfer. * */ export interface TransferProductProperties { From e2bf4c468e6dbf49e9bc89fa3f85425b9c30867f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sat, 9 Feb 2019 00:13:28 +0000 Subject: [PATCH 3/3] Generated from 4ef0f1d9e16a4fb91b1c9232c28b136008422171 Swagger changes for Microsoft.Billing for GTM product transfers --- .../@azure/arm-billing/lib/models/index.ts | 19 ++++++++++++++++--- .../@azure/arm-billing/lib/models/mappers.ts | 1 - .../arm-billing/lib/operations/products.ts | 13 +++++++++---- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/@azure/arm-billing/lib/models/index.ts b/packages/@azure/arm-billing/lib/models/index.ts index 53082393773c..d73877125a1c 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -24,10 +24,8 @@ export interface TransferProductProperties { /** * @member {string} [destinationInvoiceSectionId] Destination invoice section * id. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** */ - readonly destinationInvoiceSectionId?: string; + destinationInvoiceSectionId?: string; } /** @@ -319,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. diff --git a/packages/@azure/arm-billing/lib/models/mappers.ts b/packages/@azure/arm-billing/lib/models/mappers.ts index bfa6478208b4..f62b488a98a4 100644 --- a/packages/@azure/arm-billing/lib/models/mappers.ts +++ b/packages/@azure/arm-billing/lib/models/mappers.ts @@ -21,7 +21,6 @@ export const TransferProductProperties: msRest.CompositeMapper = { className: "TransferProductProperties", modelProperties: { destinationInvoiceSectionId: { - readOnly: true, serializedName: "destinationInvoiceSectionId", type: { name: "String" diff --git a/packages/@azure/arm-billing/lib/operations/products.ts b/packages/@azure/arm-billing/lib/operations/products.ts index ed7c94c11a2c..57ba578901b9 100644 --- a/packages/@azure/arm-billing/lib/operations/products.ts +++ b/packages/@azure/arm-billing/lib/operations/products.ts @@ -34,7 +34,7 @@ export class Products { * @param [options] The optional parameters * @returns Promise */ - transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: msRest.RequestOptionsBase): Promise; + transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: Models.ProductsTransferOptionalParams): Promise; /** * @param billingAccountId billing Account Id. * @param invoiceSectionId Invoice Id. @@ -49,8 +49,8 @@ export class Products { * @param options The optional parameters * @param callback The callback */ - transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: msRest.RequestOptionsBase, callback?: msRest.ServiceCallback): Promise { + 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, @@ -80,7 +80,12 @@ const transferOperationSpec: msRest.OperationSpec = { Parameters.acceptLanguage ], requestBody: { - parameterPath: "parameters", + parameterPath: { + destinationInvoiceSectionId: [ + "options", + "destinationInvoiceSectionId" + ] + }, mapper: { ...Mappers.TransferProductProperties, required: true