From 013e078aaf99a5e211bafa694b41718f5e58e83d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 15 Feb 2019 19:12:41 +0000 Subject: [PATCH 1/2] Generated from 1b3bfe4471a84159d5e5fc3fa7da8136a2452872 Create billing.json Adding swagger --- packages/@azure/arm-billing/LICENSE.txt | 42 ++-- packages/@azure/arm-billing/README.md | 192 +++++++++--------- .../lib/billingManagementClientContext.ts | 2 +- .../@azure/arm-billing/lib/models/index.ts | 4 +- packages/@azure/arm-billing/package.json | 8 +- packages/@azure/arm-billing/rollup.config.js | 22 +- 6 files changed, 138 insertions(+), 132 deletions(-) diff --git a/packages/@azure/arm-billing/LICENSE.txt b/packages/@azure/arm-billing/LICENSE.txt index a70e8cf66038..8f3d856145c5 100644 --- a/packages/@azure/arm-billing/LICENSE.txt +++ b/packages/@azure/arm-billing/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-billing/README.md b/packages/@azure/arm-billing/README.md index f36daa13d9f6..d61ca6cf7569 100644 --- a/packages/@azure/arm-billing/README.md +++ b/packages/@azure/arm-billing/README.md @@ -1,96 +1,96 @@ -## Azure BillingManagementClient SDK for JavaScript - -This package contains an isomorphic SDK for BillingManagementClient. - -### Currently supported environments - -- Node.js version 6.x.x or higher -- Browser JavaScript - -### How to Install - -``` -npm install @azure/arm-billing -``` - -### How to use - -#### nodejs - Authentication, client creation and list enrollmentAccounts as an example written in TypeScript. - -##### Install @azure/ms-rest-nodeauth - -``` -npm install @azure/ms-rest-nodeauth -``` - -##### Sample code - -```ts -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { BillingManagementClient, BillingManagementModels, BillingManagementMappers } from "@azure/arm-billing"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new BillingManagementClient(creds, subscriptionId); - client.enrollmentAccounts.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -#### browser - Authentication, client creation and list enrollmentAccounts as an example written in JavaScript. - -##### Install @azure/ms-rest-browserauth - -``` -npm install @azure/ms-rest-browserauth -``` - -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-billing sample - - - - - - - - -``` - -## Related projects - -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +## Azure BillingManagementClient SDK for JavaScript + +This package contains an isomorphic SDK for BillingManagementClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-billing +``` + +### How to use + +#### nodejs - Authentication, client creation and list enrollmentAccounts as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { BillingManagementClient, BillingManagementModels, BillingManagementMappers } from "@azure/arm-billing"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new BillingManagementClient(creds, subscriptionId); + client.enrollmentAccounts.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list enrollmentAccounts as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-billing sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-billing/lib/billingManagementClientContext.ts b/packages/@azure/arm-billing/lib/billingManagementClientContext.ts index 3501b4ba6e55..8f491c627e85 100644 --- a/packages/@azure/arm-billing/lib/billingManagementClientContext.ts +++ b/packages/@azure/arm-billing/lib/billingManagementClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-billing"; -const packageVersion = "0.1.0"; +const packageVersion = "2.2.0"; export class BillingManagementClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; diff --git a/packages/@azure/arm-billing/lib/models/index.ts b/packages/@azure/arm-billing/lib/models/index.ts index 43c00d84b805..a1b52d572c52 100644 --- a/packages/@azure/arm-billing/lib/models/index.ts +++ b/packages/@azure/arm-billing/lib/models/index.ts @@ -182,8 +182,8 @@ export interface Invoice extends Resource { */ readonly invoicePeriodEndDate?: Date; /** - * @member {string[]} [billingPeriodIds] Array of billing perdiod ids that - * the invoice is attributed to. + * @member {string[]} [billingPeriodIds] Array of billing period ids that the + * invoice is attributed to. * **NOTE: This property will not be serialized. It can only be populated by * the server.** */ diff --git a/packages/@azure/arm-billing/package.json b/packages/@azure/arm-billing/package.json index b3747378d079..165c7a5511c7 100644 --- a/packages/@azure/arm-billing/package.json +++ b/packages/@azure/arm-billing/package.json @@ -4,8 +4,8 @@ "description": "BillingManagementClient Library with typescript type definitions for node.js and browser.", "version": "2.2.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -23,6 +23,7 @@ "typescript": "^3.1.1", "rollup": "^0.66.2", "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/arm-billing", @@ -51,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-billing.js.map'\" -o ./dist/arm-billing.min.js ./dist/arm-billing.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "authPublish": true + "sideEffects": false } diff --git a/packages/@azure/arm-billing/rollup.config.js b/packages/@azure/arm-billing/rollup.config.js index ae6725122752..75249006e750 100644 --- a/packages/@azure/arm-billing/rollup.config.js +++ b/packages/@azure/arm-billing/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/billingManagementClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/billingManagementClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/arm-billing.js", format: "umd", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * 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. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ module: true }), + sourcemaps() ] }; + export default config; From fc05ea8b23c57e23a12939f2ac18b4e560433872 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 19 Feb 2019 19:28:22 +0000 Subject: [PATCH 2/2] Generated from f29e13dcd4c8ab3531d76ca8ceba444a9c41c489 Feedback changes Feedback changes --- packages/@azure/arm-subscriptions/LICENSE.txt | 42 ++-- packages/@azure/arm-subscriptions/README.md | 192 +++++++++--------- .../arm-subscriptions/lib/models/index.ts | 143 ++++++++++--- .../arm-subscriptions/lib/models/mappers.ts | 91 +++++++-- .../lib/models/parameters.ts | 28 ++- .../lib/models/subscriptionFactoryMappers.ts | 2 +- .../subscriptionOperationOperationsMappers.ts | 16 ++ .../arm-subscriptions/lib/operations/index.ts | 2 +- .../lib/operations/subscriptionFactory.ts | 34 ++-- .../subscriptionOperationOperations.ts | 88 ++++++++ .../lib/subscriptionClient.ts | 107 +++++++++- .../lib/subscriptionClientContext.ts | 2 +- .../@azure/arm-subscriptions/package.json | 8 +- .../@azure/arm-subscriptions/rollup.config.js | 22 +- 14 files changed, 580 insertions(+), 197 deletions(-) create mode 100644 packages/@azure/arm-subscriptions/lib/models/subscriptionOperationOperationsMappers.ts create mode 100644 packages/@azure/arm-subscriptions/lib/operations/subscriptionOperationOperations.ts diff --git a/packages/@azure/arm-subscriptions/LICENSE.txt b/packages/@azure/arm-subscriptions/LICENSE.txt index a70e8cf66038..8f3d856145c5 100644 --- a/packages/@azure/arm-subscriptions/LICENSE.txt +++ b/packages/@azure/arm-subscriptions/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/arm-subscriptions/README.md b/packages/@azure/arm-subscriptions/README.md index c888bbccbd7c..a351fd9169fe 100644 --- a/packages/@azure/arm-subscriptions/README.md +++ b/packages/@azure/arm-subscriptions/README.md @@ -1,96 +1,96 @@ -## Azure SubscriptionClient SDK for JavaScript - -This package contains an isomorphic SDK for SubscriptionClient. - -### Currently supported environments - -- Node.js version 6.x.x or higher -- Browser JavaScript - -### How to Install - -``` -npm install @azure/arm-subscriptions -``` - -### How to use - -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. - -##### Install @azure/ms-rest-nodeauth - -``` -npm install @azure/ms-rest-nodeauth -``` - -##### Sample code - -```ts -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { SubscriptionClient, SubscriptionModels, SubscriptionMappers } from "@azure/arm-subscriptions"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new SubscriptionClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -#### browser - Authentication, client creation and list operations as an example written in JavaScript. - -##### Install @azure/ms-rest-browserauth - -``` -npm install @azure/ms-rest-browserauth -``` - -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-subscriptions sample - - - - - - - - -``` - -## Related projects - -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +## Azure SubscriptionClient SDK for JavaScript + +This package contains an isomorphic SDK for SubscriptionClient. + +### Currently supported environments + +- Node.js version 6.x.x or higher +- Browser JavaScript + +### How to Install + +```bash +npm install @azure/arm-subscriptions +``` + +### How to use + +#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. + +##### Install @azure/ms-rest-nodeauth + +```bash +npm install @azure/ms-rest-nodeauth +``` + +##### Sample code + +```typescript +import * as msRest from "@azure/ms-rest-js"; +import * as msRestAzure from "@azure/ms-rest-azure-js"; +import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; +import { SubscriptionClient, SubscriptionModels, SubscriptionMappers } from "@azure/arm-subscriptions"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new SubscriptionClient(creds, subscriptionId); + client.operations.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +#### browser - Authentication, client creation and list operations as an example written in JavaScript. + +##### Install @azure/ms-rest-browserauth + +```bash +npm install @azure/ms-rest-browserauth +``` + +##### Sample code + +See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. + +- index.html +```html + + + + @azure/arm-subscriptions sample + + + + + + + + +``` + +## Related projects + +- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/arm-subscriptions/lib/models/index.ts b/packages/@azure/arm-subscriptions/lib/models/index.ts index 58329f3a0f52..7c2a19ae1d47 100644 --- a/packages/@azure/arm-subscriptions/lib/models/index.ts +++ b/packages/@azure/arm-subscriptions/lib/models/index.ts @@ -53,19 +53,21 @@ export interface SubscriptionCreationParameters { */ displayName?: string; /** - * @member {AdPrincipal[]} [owners] The list of principals that should be - * granted Owner access on the subscription. Principals should be of type - * User, Service Principal or Security Group. + * @member {string} [billingProfileId] The ARM id of the billing profile. */ - owners?: AdPrincipal[]; + billingProfileId?: string; /** - * @member {OfferType} [offerType] The offer type of the subscription. For - * example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P - * (EnterpriseAgreement devTest) are available. Only valid when creating a - * subscription in a enrollment account scope. Possible values include: - * 'MS-AZR-0017P', 'MS-AZR-0148P' + * @member {string} [skuId] The commerce id of the sku. */ - offerType?: OfferType; + skuId?: string; + /** + * @member {string} [costCenter] optional customer cost center + */ + costCenter?: string; + /** + * @member {AdPrincipal} [owner] rbac owner of the subscription + */ + owner?: AdPrincipal; /** * @member {{ [propertyName: string]: any }} [additionalParameters] * Additional, untyped parameters to support custom subscription creation @@ -188,6 +190,36 @@ export interface OperationListResult { nextLink?: string; } +/** + * @interface + * An interface representing CanceledSubscriptionId. + * Canceled Subscription Id + * + */ +export interface CanceledSubscriptionId { + /** + * @member {string} [value] Canceled Subscription Id + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly value?: string; +} + +/** + * @interface + * An interface representing RenamedSubscriptionId. + * Renamed Subscription Id + * + */ +export interface RenamedSubscriptionId { + /** + * @member {string} [value] Renamed Subscription Id + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly value?: string; +} + /** * @interface * An interface representing Location. @@ -349,21 +381,40 @@ export interface SubscriptionClientOptions extends AzureServiceClientOptions { /** * @interface - * An interface representing SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders. - * Defines headers for CreateSubscriptionInEnrollmentAccount operation. + * An interface representing SubscriptionOperationGetHeaders. + * Defines headers for Get operation. + * + */ +export interface SubscriptionOperationGetHeaders { + /** + * @member {string} [location] The URL where the status of the asynchronous + * operation can be checked. + */ + location: string; + /** + * @member {number} [retryAfter] The amount of delay to use while the status + * of the operation is checked. The value is expressed in seconds. + */ + retryAfter: number; +} + +/** + * @interface + * An interface representing SubscriptionFactoryCreateSubscriptionHeaders. + * Defines headers for CreateSubscription operation. * */ -export interface SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders { +export interface SubscriptionFactoryCreateSubscriptionHeaders { /** * @member {string} [location] GET this URL to retrieve the status of the * asynchronous operation. */ location: string; /** - * @member {string} [retryAfter] The amount of delay to use while the status + * @member {number} [retryAfter] The amount of delay to use while the status * of the operation is checked. The value is expressed in seconds. */ - retryAfter: string; + retryAfter: number; } @@ -406,14 +457,6 @@ export interface TenantListResult extends Array { nextLink: string; } -/** - * Defines values for OfferType. - * Possible values include: 'MS-AZR-0017P', 'MS-AZR-0148P' - * @readonly - * @enum {string} - */ -export type OfferType = 'MS-AZR-0017P' | 'MS-AZR-0148P'; - /** * Defines values for SubscriptionState. * Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' @@ -450,13 +493,17 @@ export type OperationsListResponse = OperationListResult & { }; /** - * Contains response data for the list operation. + * Contains response data for the get operation. */ -export type SubscriptionOperationsListResponse = SubscriptionOperationListResult & { +export type SubscriptionOperationGetResponse = SubscriptionCreationResult & SubscriptionOperationGetHeaders & { /** * The underlying HTTP response. */ _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: SubscriptionOperationGetHeaders; /** * The response body as text (string format) */ @@ -464,14 +511,14 @@ export type SubscriptionOperationsListResponse = SubscriptionOperationListResult /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionOperationListResult; + parsedBody: SubscriptionCreationResult; }; }; /** - * Contains response data for the createSubscriptionInEnrollmentAccount operation. + * Contains response data for the createSubscription operation. */ -export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders & { +export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionHeaders & { /** * The underlying HTTP response. */ @@ -479,7 +526,7 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders; + parsedHeaders: SubscriptionFactoryCreateSubscriptionHeaders; /** * The response body as text (string format) */ @@ -491,6 +538,44 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S }; }; +/** + * Contains response data for the cancelSubscription operation. + */ +export type CancelSubscriptionResponse = CanceledSubscriptionId & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: CanceledSubscriptionId; + }; +}; + +/** + * Contains response data for the renameSubscription operation. + */ +export type RenameSubscriptionResponse = RenamedSubscriptionId & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: RenamedSubscriptionId; + }; +}; + /** * Contains response data for the listLocations operation. */ diff --git a/packages/@azure/arm-subscriptions/lib/models/mappers.ts b/packages/@azure/arm-subscriptions/lib/models/mappers.ts index 8d029bbac602..eef3f833bde6 100644 --- a/packages/@azure/arm-subscriptions/lib/models/mappers.ts +++ b/packages/@azure/arm-subscriptions/lib/models/mappers.ts @@ -59,24 +59,31 @@ export const SubscriptionCreationParameters: msRest.CompositeMapper = { name: "String" } }, - owners: { - serializedName: "owners", + billingProfileId: { + serializedName: "billingProfileId", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AdPrincipal" - } - } + name: "String" } }, - offerType: { - serializedName: "offerType", + skuId: { + serializedName: "skuId", type: { name: "String" } }, + costCenter: { + serializedName: "costCenter", + type: { + name: "String" + } + }, + owner: { + serializedName: "owner", + type: { + name: "Composite", + className: "AdPrincipal" + } + }, additionalParameters: { serializedName: "additionalParameters", type: { @@ -244,6 +251,40 @@ export const OperationListResult: msRest.CompositeMapper = { } }; +export const CanceledSubscriptionId: msRest.CompositeMapper = { + serializedName: "CanceledSubscriptionId", + type: { + name: "Composite", + className: "CanceledSubscriptionId", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const RenamedSubscriptionId: msRest.CompositeMapper = { + serializedName: "RenamedSubscriptionId", + type: { + name: "Composite", + className: "RenamedSubscriptionId", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + export const Location: msRest.CompositeMapper = { serializedName: "Location", type: { @@ -414,11 +455,11 @@ export const TenantIdDescription: msRest.CompositeMapper = { } }; -export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: msRest.CompositeMapper = { - serializedName: "subscriptionfactory-createsubscriptioninenrollmentaccount-headers", +export const SubscriptionOperationGetHeaders: msRest.CompositeMapper = { + serializedName: "subscriptionoperation-get-headers", type: { name: "Composite", - className: "SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders", + className: "SubscriptionOperationGetHeaders", modelProperties: { location: { serializedName: "location", @@ -428,9 +469,31 @@ export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: ms }, retryAfter: { serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const SubscriptionFactoryCreateSubscriptionHeaders: msRest.CompositeMapper = { + serializedName: "subscriptionfactory-createsubscription-headers", + type: { + name: "Composite", + className: "SubscriptionFactoryCreateSubscriptionHeaders", + modelProperties: { + location: { + serializedName: "location", type: { name: "String" } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } } } } diff --git a/packages/@azure/arm-subscriptions/lib/models/parameters.ts b/packages/@azure/arm-subscriptions/lib/models/parameters.ts index 136f82600bfa..7073528267dc 100644 --- a/packages/@azure/arm-subscriptions/lib/models/parameters.ts +++ b/packages/@azure/arm-subscriptions/lib/models/parameters.ts @@ -26,7 +26,7 @@ export const apiVersion0: msRest.OperationQueryParameter = { required: true, isConstant: true, serializedName: "api-version", - defaultValue: '2018-03-01-preview', + defaultValue: '2018-11-01-preview', type: { name: "String" } @@ -44,11 +44,21 @@ export const apiVersion1: msRest.OperationQueryParameter = { } } }; -export const enrollmentAccountName: msRest.OperationURLParameter = { - parameterPath: "enrollmentAccountName", +export const billingAccountName: msRest.OperationURLParameter = { + parameterPath: "billingAccountName", mapper: { required: true, - serializedName: "enrollmentAccountName", + serializedName: "billingAccountName", + type: { + name: "String" + } + } +}; +export const invoiceSectionName: msRest.OperationURLParameter = { + parameterPath: "invoiceSectionName", + mapper: { + required: true, + serializedName: "invoiceSectionName", type: { name: "String" } @@ -65,6 +75,16 @@ export const nextPageLink: msRest.OperationURLParameter = { }, skipEncoding: true }; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + serializedName: "operationId", + type: { + name: "String" + } + } +}; export const subscriptionId: msRest.OperationURLParameter = { parameterPath: "subscriptionId", mapper: { diff --git a/packages/@azure/arm-subscriptions/lib/models/subscriptionFactoryMappers.ts b/packages/@azure/arm-subscriptions/lib/models/subscriptionFactoryMappers.ts index e6c04bcb4b26..fe92eb1483fb 100644 --- a/packages/@azure/arm-subscriptions/lib/models/subscriptionFactoryMappers.ts +++ b/packages/@azure/arm-subscriptions/lib/models/subscriptionFactoryMappers.ts @@ -12,7 +12,7 @@ export { SubscriptionCreationParameters, AdPrincipal, SubscriptionCreationResult, - SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders, + SubscriptionFactoryCreateSubscriptionHeaders, ErrorResponse } from "../models/mappers"; diff --git a/packages/@azure/arm-subscriptions/lib/models/subscriptionOperationOperationsMappers.ts b/packages/@azure/arm-subscriptions/lib/models/subscriptionOperationOperationsMappers.ts new file mode 100644 index 000000000000..c5247037b3ea --- /dev/null +++ b/packages/@azure/arm-subscriptions/lib/models/subscriptionOperationOperationsMappers.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. All rights 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 { + SubscriptionCreationResult, + SubscriptionOperationGetHeaders, + CloudError +} from "../models/mappers"; + diff --git a/packages/@azure/arm-subscriptions/lib/operations/index.ts b/packages/@azure/arm-subscriptions/lib/operations/index.ts index eafce4f8f867..613df35a62ca 100644 --- a/packages/@azure/arm-subscriptions/lib/operations/index.ts +++ b/packages/@azure/arm-subscriptions/lib/operations/index.ts @@ -9,7 +9,7 @@ */ export * from "./operations"; -export * from "./subscriptionOperations"; +export * from "./subscriptionOperationOperations"; export * from "./subscriptionFactory"; export * from "./subscriptions"; export * from "./tenants"; diff --git a/packages/@azure/arm-subscriptions/lib/operations/subscriptionFactory.ts b/packages/@azure/arm-subscriptions/lib/operations/subscriptionFactory.ts index ccfa425796be..e2855b6049b6 100644 --- a/packages/@azure/arm-subscriptions/lib/operations/subscriptionFactory.ts +++ b/packages/@azure/arm-subscriptions/lib/operations/subscriptionFactory.ts @@ -29,44 +29,46 @@ export class SubscriptionFactory { /** * Creates an Azure subscription - * @param enrollmentAccountName The name of the enrollment account to which the subscription will - * be billed. + * @param billingAccountName The name of the commerce root billing account. + * @param invoiceSectionName The name of the invoice section. * @param body The subscription creation parameters. * @param [options] The optional parameters - * @returns Promise + * @returns Promise */ - createSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName,body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + createSubscription(billingAccountName: string, invoiceSectionName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateSubscription(billingAccountName,invoiceSectionName,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; } /** * Creates an Azure subscription - * @param enrollmentAccountName The name of the enrollment account to which the subscription will - * be billed. + * @param billingAccountName The name of the commerce root billing account. + * @param invoiceSectionName The name of the invoice section. * @param body The subscription creation parameters. * @param [options] The optional parameters * @returns Promise */ - beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + beginCreateSubscription(billingAccountName: string, invoiceSectionName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { return this.client.sendLRORequest( { - enrollmentAccountName, + billingAccountName, + invoiceSectionName, body, options }, - beginCreateSubscriptionInEnrollmentAccountOperationSpec, + beginCreateSubscriptionOperationSpec, options); } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); -const beginCreateSubscriptionInEnrollmentAccountOperationSpec: msRest.OperationSpec = { +const beginCreateSubscriptionOperationSpec: msRest.OperationSpec = { httpMethod: "POST", - path: "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription", + path: "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription", urlParameters: [ - Parameters.enrollmentAccountName + Parameters.billingAccountName, + Parameters.invoiceSectionName ], queryParameters: [ Parameters.apiVersion0 @@ -84,10 +86,10 @@ const beginCreateSubscriptionInEnrollmentAccountOperationSpec: msRest.OperationS responses: { 200: { bodyMapper: Mappers.SubscriptionCreationResult, - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders + headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionHeaders }, 202: { - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders + headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionHeaders }, default: { bodyMapper: Mappers.ErrorResponse diff --git a/packages/@azure/arm-subscriptions/lib/operations/subscriptionOperationOperations.ts b/packages/@azure/arm-subscriptions/lib/operations/subscriptionOperationOperations.ts new file mode 100644 index 000000000000..912b225c3289 --- /dev/null +++ b/packages/@azure/arm-subscriptions/lib/operations/subscriptionOperationOperations.ts @@ -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. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/subscriptionOperationOperationsMappers"; +import * as Parameters from "../models/parameters"; +import { SubscriptionClientContext } from "../subscriptionClientContext"; + +/** Class representing a SubscriptionOperationOperations. */ +export class SubscriptionOperationOperations { + private readonly client: SubscriptionClientContext; + + /** + * Create a SubscriptionOperationOperations. + * @param {SubscriptionClientContext} client Reference to the service client. + */ + constructor(client: SubscriptionClientContext) { + this.client = client; + } + + /** + * Get the status of the pending Microsoft.Subscription API operations. + * @param operationId The operation ID, which can be found from the Location field in the generate + * recommendation response header. + * @param [options] The optional parameters + * @returns Promise + */ + get(operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param operationId The operation ID, which can be found from the Location field in the generate + * recommendation response header. + * @param callback The callback + */ + get(operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param operationId The operation ID, which can be found from the Location field in the generate + * recommendation response header. + * @param options The optional parameters + * @param callback The callback + */ + get(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + operationId, + options + }, + getOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Subscription/subscriptionOperations/{operationId}", + urlParameters: [ + Parameters.operationId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionCreationResult, + headersMapper: Mappers.SubscriptionOperationGetHeaders + }, + 202: { + headersMapper: Mappers.SubscriptionOperationGetHeaders + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/packages/@azure/arm-subscriptions/lib/subscriptionClient.ts b/packages/@azure/arm-subscriptions/lib/subscriptionClient.ts index 6a060c07fcca..0524b34b31bb 100644 --- a/packages/@azure/arm-subscriptions/lib/subscriptionClient.ts +++ b/packages/@azure/arm-subscriptions/lib/subscriptionClient.ts @@ -11,6 +11,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as Models from "./models"; import * as Mappers from "./models/mappers"; +import * as Parameters from "./models/parameters"; import * as operations from "./operations"; import { SubscriptionClientContext } from "./subscriptionClientContext"; @@ -18,7 +19,7 @@ import { SubscriptionClientContext } from "./subscriptionClientContext"; class SubscriptionClient extends SubscriptionClientContext { // Operation groups operations: operations.Operations; - subscriptionOperations: operations.SubscriptionOperations; + subscriptionOperation: operations.SubscriptionOperationOperations; subscriptionFactory: operations.SubscriptionFactory; subscriptions: operations.Subscriptions; tenants: operations.Tenants; @@ -31,14 +32,116 @@ class SubscriptionClient extends SubscriptionClientContext { constructor(credentials: msRest.ServiceClientCredentials, options?: Models.SubscriptionClientOptions) { super(credentials, options); this.operations = new operations.Operations(this); - this.subscriptionOperations = new operations.SubscriptionOperations(this); + this.subscriptionOperation = new operations.SubscriptionOperationOperations(this); this.subscriptionFactory = new operations.SubscriptionFactory(this); this.subscriptions = new operations.Subscriptions(this); this.tenants = new operations.Tenants(this); } + + /** + * Cancels the subscription + * @param subscriptionId Subscription Id. + * @param [options] The optional parameters + * @returns Promise + */ + cancelSubscription(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Subscription Id. + * @param callback The callback + */ + cancelSubscription(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Subscription Id. + * @param options The optional parameters + * @param callback The callback + */ + cancelSubscription(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + cancelSubscription(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + subscriptionId, + options + }, + cancelSubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Renames the subscription + * @param subscriptionId Subscription Id. + * @param [options] The optional parameters + * @returns Promise + */ + renameSubscription(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Subscription Id. + * @param callback The callback + */ + renameSubscription(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Subscription Id. + * @param options The optional parameters + * @param callback The callback + */ + renameSubscription(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + renameSubscription(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.sendOperationRequest( + { + subscriptionId, + options + }, + renameSubscriptionOperationSpec, + callback) as Promise; + } } // Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const cancelSubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Subscription/subscriptions/{subscriptionId}/cancel", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CanceledSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const renameSubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Subscription/subscriptions/{subscriptionId}/rename", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.RenamedSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; export { SubscriptionClient, diff --git a/packages/@azure/arm-subscriptions/lib/subscriptionClientContext.ts b/packages/@azure/arm-subscriptions/lib/subscriptionClientContext.ts index bc27f46c00cb..f1f805ba1d10 100644 --- a/packages/@azure/arm-subscriptions/lib/subscriptionClientContext.ts +++ b/packages/@azure/arm-subscriptions/lib/subscriptionClientContext.ts @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; const packageName = "@azure/arm-subscriptions"; -const packageVersion = "0.1.0"; +const packageVersion = "1.0.0"; export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; diff --git a/packages/@azure/arm-subscriptions/package.json b/packages/@azure/arm-subscriptions/package.json index 8b1ad4dfed36..6648e4d3f31d 100644 --- a/packages/@azure/arm-subscriptions/package.json +++ b/packages/@azure/arm-subscriptions/package.json @@ -4,8 +4,8 @@ "description": "SubscriptionClient Library with typescript type definitions for node.js and browser.", "version": "1.0.0", "dependencies": { - "@azure/ms-rest-azure-js": "^1.1.0", - "@azure/ms-rest-js": "^1.1.0", + "@azure/ms-rest-azure-js": "^1.2.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -23,6 +23,7 @@ "typescript": "^3.1.1", "rollup": "^0.66.2", "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/arm-subscriptions", @@ -51,6 +52,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-subscriptions.js.map'\" -o ./dist/arm-subscriptions.min.js ./dist/arm-subscriptions.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "authPublish": true + "sideEffects": false } diff --git a/packages/@azure/arm-subscriptions/rollup.config.js b/packages/@azure/arm-subscriptions/rollup.config.js index a828255f7f53..f4ae2d19454d 100644 --- a/packages/@azure/arm-subscriptions/rollup.config.js +++ b/packages/@azure/arm-subscriptions/rollup.config.js @@ -1,10 +1,16 @@ +import rollup from "rollup"; import nodeResolve from "rollup-plugin-node-resolve"; +import sourcemaps from "rollup-plugin-sourcemaps"; + /** - * @type {import('rollup').RollupFileOptions} + * @type {rollup.RollupFileOptions} */ const config = { - input: './esm/subscriptionClient.js', - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], + input: "./esm/subscriptionClient.js", + external: [ + "@azure/ms-rest-js", + "@azure/ms-rest-azure-js" + ], output: { file: "./dist/arm-subscriptions.js", format: "umd", @@ -16,16 +22,16 @@ const config = { }, banner: `/* * 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. */` }, plugins: [ - nodeResolve({ module: true }) + nodeResolve({ module: true }), + sourcemaps() ] }; + export default config;