Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@azure/arm-billing/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/@azure/arm-billing/lib/billingManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class BillingManagementClient extends BillingManagementClientContext {
enrollmentAccounts: operations.EnrollmentAccounts;
billingPeriods: operations.BillingPeriods;
invoices: operations.Invoices;
products: operations.Products;
operations: operations.Operations;

/**
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
67 changes: 67 additions & 0 deletions packages/@azure/arm-billing/lib/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down
44 changes: 44 additions & 0 deletions packages/@azure/arm-billing/lib/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
30 changes: 30 additions & 0 deletions packages/@azure/arm-billing/lib/models/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand All @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions packages/@azure/arm-billing/lib/models/productsMappers.ts
Original file line number Diff line number Diff line change
@@ -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";

1 change: 1 addition & 0 deletions packages/@azure/arm-billing/lib/operations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
export * from "./enrollmentAccounts";
export * from "./billingPeriods";
export * from "./invoices";
export * from "./products";
export * from "./operations";
103 changes: 103 additions & 0 deletions packages/@azure/arm-billing/lib/operations/products.ts
Original file line number Diff line number Diff line change
@@ -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<Models.ProductsTransferResponse>
*/
transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: Models.ProductsTransferOptionalParams): Promise<Models.ProductsTransferResponse>;
/**
* @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>): 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>): void;
transfer(billingAccountId: string, invoiceSectionId: string, productName: string, options?: Models.ProductsTransferOptionalParams, callback?: msRest.ServiceCallback<void>): Promise<Models.ProductsTransferResponse> {
return this.client.sendOperationRequest(
{
billingAccountId,
invoiceSectionId,
productName,
options
},
transferOperationSpec,
callback) as Promise<Models.ProductsTransferResponse>;
}
}

// 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
};