From 888ca52ddfb3c6c84146f041235e92e4d27a552b Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 26 Jul 2019 19:59:02 +0000 Subject: [PATCH] Generated from 759b016dc1a08b58f84a3eab06047f14841fc7f5 Update subscriptions.json --- .../arm-subscriptions/LICENSE.txt | 2 +- sdk/subscription/arm-subscriptions/README.md | 9 +- .../arm-subscriptions/package.json | 14 +- .../arm-subscriptions/rollup.config.js | 22 +- .../arm-subscriptions/src/models/index.ts | 335 ++++++------------ .../arm-subscriptions/src/models/mappers.ts | 152 ++------ .../src/models/operationsMappers.ts | 11 +- .../src/models/parameters.ts | 12 +- .../src/models/subscriptionsMappers.ts | 20 +- .../src/models/tenantsMappers.ts | 11 +- .../arm-subscriptions/src/operations/index.ts | 2 - .../src/operations/subscriptions.ts | 164 +++++++++ .../src/subscriptionClient.ts | 4 - .../src/subscriptionClientContext.ts | 2 +- 14 files changed, 352 insertions(+), 408 deletions(-) diff --git a/sdk/subscription/arm-subscriptions/LICENSE.txt b/sdk/subscription/arm-subscriptions/LICENSE.txt index a70e8cf66038..b73b4a1293c3 100644 --- a/sdk/subscription/arm-subscriptions/LICENSE.txt +++ b/sdk/subscription/arm-subscriptions/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/sdk/subscription/arm-subscriptions/README.md b/sdk/subscription/arm-subscriptions/README.md index cf12bd35b66a..2685a893c221 100644 --- a/sdk/subscription/arm-subscriptions/README.md +++ b/sdk/subscription/arm-subscriptions/README.md @@ -9,7 +9,7 @@ This package contains an isomorphic SDK for SubscriptionClient. ### How to Install -``` +```bash npm install @azure/arm-subscriptions ``` @@ -19,13 +19,13 @@ npm install @azure/arm-subscriptions ##### Install @azure/ms-rest-nodeauth -``` +```bash npm install @azure/ms-rest-nodeauth ``` ##### Sample code -```ts +```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"; @@ -47,7 +47,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => { ##### Install @azure/ms-rest-browserauth -``` +```bash npm install @azure/ms-rest-browserauth ``` @@ -95,5 +95,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/subscription/arm-subscriptions/README.png) diff --git a/sdk/subscription/arm-subscriptions/package.json b/sdk/subscription/arm-subscriptions/package.json index 3509dca1c114..df1cee796e09 100644 --- a/sdk/subscription/arm-subscriptions/package.json +++ b/sdk/subscription/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.3.2", + "@azure/ms-rest-js": "^1.8.1", "tslib": "^1.9.3" }, "keywords": [ @@ -23,15 +23,16 @@ "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/sdk/subscription/arm-subscriptions", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/subscription/arm-subscriptions", "repository": { "type": "git", - "url": "https://github.com/azure/azure-sdk-for-js.git" + "url": "https://github.com/Azure/azure-sdk-for-js.git" }, "bugs": { - "url": "https://github.com/azure/azure-sdk-for-js/issues" + "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", @@ -43,6 +44,7 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "src/**/*.ts", + "README.md", "rollup.config.js", "tsconfig.json" ], @@ -52,5 +54,5 @@ "prepack": "npm install && npm run build" }, "sideEffects": false, - "authPublish": true + "autoPublish": true } diff --git a/sdk/subscription/arm-subscriptions/rollup.config.js b/sdk/subscription/arm-subscriptions/rollup.config.js index a828255f7f53..f4ae2d19454d 100644 --- a/sdk/subscription/arm-subscriptions/rollup.config.js +++ b/sdk/subscription/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; diff --git a/sdk/subscription/arm-subscriptions/src/models/index.ts b/sdk/subscription/arm-subscriptions/src/models/index.ts index 58329f3a0f52..ba4486b16003 100644 --- a/sdk/subscription/arm-subscriptions/src/models/index.ts +++ b/sdk/subscription/arm-subscriptions/src/models/index.ts @@ -1,11 +1,9 @@ /* * 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. */ import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; @@ -13,365 +11,234 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; - /** - * @interface - * An interface representing SubscriptionCreationResult. - * The created subscription object. - * + * Describes the error if the operation is not successful. */ -export interface SubscriptionCreationResult { +export interface ErrorResponse { /** - * @member {string} [subscriptionLink] The link to the new subscription. + * Error code */ - subscriptionLink?: string; -} - -/** - * @interface - * An interface representing AdPrincipal. - * Active Directory Principal for subscription creation delegated permission - * - */ -export interface AdPrincipal { + code?: string; /** - * @member {string} objectId Object id of the Principal + * Error message indicating why the operation failed. */ - objectId: string; + message?: string; } /** - * @interface - * An interface representing SubscriptionCreationParameters. - * Subscription Creation Parameters required to create a new Azure - * subscription. - * + * The ID of the canceled subscription */ -export interface SubscriptionCreationParameters { - /** - * @member {string} [displayName] The display name of the subscription. - */ - 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. - */ - owners?: AdPrincipal[]; - /** - * @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' - */ - offerType?: OfferType; +export interface CanceledSubscriptionId { /** - * @member {{ [propertyName: string]: any }} [additionalParameters] - * Additional, untyped parameters to support custom subscription creation - * scenarios. + * The ID of the canceled subscription + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - additionalParameters?: { [propertyName: string]: any }; + readonly value?: string; } /** - * @interface - * An interface representing ErrorResponse. - * Describes the format of Error response. - * + * The ID of the subscriptions that is being renamed */ -export interface ErrorResponse { +export interface RenamedSubscriptionId { /** - * @member {string} [code] Error code + * The ID of the subscriptions that is being renamed + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - code?: string; - /** - * @member {string} [message] Error message indicating why the operation - * failed. - */ - message?: string; + readonly value?: string; } /** - * @interface - * An interface representing SubscriptionOperation. - * status of the subscription POST operation. - * + * Enabled Subscription Id */ -export interface SubscriptionOperation { - /** - * @member {string} [id] The operation Id. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly id?: string; - /** - * @member {string} [status] Status of the pending subscription - */ - status?: string; +export interface EnabledSubscriptionId { /** - * @member {string} [statusDetail] Status Detail of the pending subscription + * Enabled Subscription Id + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - statusDetail?: string; + readonly value?: string; } /** - * @interface - * An interface representing SubscriptionOperationListResult. - * A list of pending subscription operations. - * + * The new name of the subscription. */ -export interface SubscriptionOperationListResult { +export interface SubscriptionName { /** - * @member {SubscriptionOperation[]} [value] A list of pending - * SubscriptionOperations + * New subscription name */ - value?: SubscriptionOperation[]; + subscriptionName?: string; } /** - * @interface - * An interface representing OperationDisplay. * The object that represents the operation. - * */ export interface OperationDisplay { /** - * @member {string} [provider] Service provider: Microsoft.Subscription + * Service provider: Microsoft.Subscription */ provider?: string; /** - * @member {string} [resource] Resource on which the operation is performed: - * Profile, endpoint, etc. + * Resource on which the operation is performed: Profile, endpoint, etc. */ resource?: string; /** - * @member {string} [operation] Operation type: Read, write, delete, etc. + * Operation type: Read, write, delete, etc. */ operation?: string; } /** - * @interface - * An interface representing Operation. * REST API operation - * */ export interface Operation { /** - * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * Operation name: {provider}/{resource}/{operation} */ name?: string; /** - * @member {OperationDisplay} [display] The object that represents the - * operation. + * The object that represents the operation. */ display?: OperationDisplay; } /** - * @interface - * An interface representing OperationListResult. - * Result of the request to list operations. It contains a list of operations - * and a URL link to get the next set of results. - * + * Result of the request to list operations. It contains a list of operations and a URL link to get + * the next set of results. */ export interface OperationListResult { /** - * @member {Operation[]} [value] List of operations. + * List of operations. */ value?: Operation[]; /** - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. + * URL to get the next set of operation list results if there are any. */ nextLink?: string; } /** - * @interface - * An interface representing Location. * Location information. - * */ export interface Location { /** - * @member {string} [id] The fully qualified ID of the location. For example, + * The fully qualified ID of the location. For example, * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * @member {string} [subscriptionId] The subscription ID. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly subscriptionId?: string; /** - * @member {string} [name] The location name. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The location name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly name?: string; /** - * @member {string} [displayName] The display name of the location. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The display name of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly displayName?: string; /** - * @member {string} [latitude] The latitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The latitude of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly latitude?: string; /** - * @member {string} [longitude] The longitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The longitude of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly longitude?: string; } /** - * @interface - * An interface representing SubscriptionPolicies. * Subscription policies. - * */ export interface SubscriptionPolicies { /** - * @member {string} [locationPlacementId] The subscription location placement - * ID. The ID indicates which regions are visible for a subscription. For - * example, a subscription with a location placement Id of Public_2014-09-01 + * The subscription location placement ID. The ID indicates which regions are visible for a + * subscription. For example, a subscription with a location placement Id of Public_2014-09-01 * has access to Azure public regions. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly locationPlacementId?: string; /** - * @member {string} [quotaId] The subscription quota ID. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription quota ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly quotaId?: string; /** - * @member {SpendingLimit} [spendingLimit] The subscription spending limit. - * Possible values include: 'On', 'Off', 'CurrentPeriodOff' - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly spendingLimit?: SpendingLimit; } /** - * @interface - * An interface representing Subscription. * Subscription information. - * */ export interface Subscription { /** - * @member {string} [id] The fully qualified ID for the subscription. For - * example, /subscriptions/00000000-0000-0000-0000-000000000000. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The fully qualified ID for the subscription. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * @member {string} [subscriptionId] The subscription ID. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly subscriptionId?: string; /** - * @member {string} [displayName] The subscription display name. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription display name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly displayName?: string; /** - * @member {SubscriptionState} [state] The subscription state. Possible - * values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible - * values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. + * Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly state?: SubscriptionState; /** - * @member {SubscriptionPolicies} [subscriptionPolicies] The subscription - * policies. + * The subscription policies. */ subscriptionPolicies?: SubscriptionPolicies; /** - * @member {string} [authorizationSource] The authorization source of the - * request. Valid values are one or more combinations of Legacy, RoleBased, - * Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * The authorization source of the request. Valid values are one or more combinations of Legacy, + * RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. */ authorizationSource?: string; } /** - * @interface - * An interface representing TenantIdDescription. * Tenant Id information. - * */ export interface TenantIdDescription { /** - * @member {string} [id] The fully qualified ID of the tenant. For example, + * The fully qualified ID of the tenant. For example, * /tenants/00000000-0000-0000-0000-000000000000. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * @member {string} [tenantId] The tenant ID. For example, - * 00000000-0000-0000-0000-000000000000. - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly tenantId?: string; } /** - * @interface * An interface representing SubscriptionClientOptions. - * @extends AzureServiceClientOptions */ export interface SubscriptionClientOptions extends AzureServiceClientOptions { - /** - * @member {string} [baseUri] - */ baseUri?: string; } /** * @interface - * An interface representing SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders. - * Defines headers for CreateSubscriptionInEnrollmentAccount operation. - * - */ -export interface SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders { - /** - * @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 - * of the operation is checked. The value is expressed in seconds. - */ - retryAfter: string; -} - - -/** - * @interface - * An interface representing the LocationListResult. * Location list operation response. - * * @extends Array */ export interface LocationListResult extends Array { @@ -379,41 +246,28 @@ export interface LocationListResult extends Array { /** * @interface - * An interface representing the SubscriptionListResult. * Subscription list operation response. - * * @extends Array */ export interface SubscriptionListResult extends Array { /** - * @member {string} nextLink The URL to get the next set of results. + * The URL to get the next set of results. */ nextLink: string; } /** * @interface - * An interface representing the TenantListResult. * Tenant Ids information. - * * @extends Array */ export interface TenantListResult extends Array { /** - * @member {string} nextLink The URL to use for getting the next set of - * results. + * The URL to use for getting the next set of results. */ 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' @@ -442,6 +296,7 @@ export type OperationsListResponse = OperationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -450,9 +305,9 @@ export type OperationsListResponse = OperationListResult & { }; /** - * Contains response data for the list operation. + * Contains response data for the cancel operation. */ -export type SubscriptionOperationsListResponse = SubscriptionOperationListResult & { +export type SubscriptionsCancelResponse = CanceledSubscriptionId & { /** * The underlying HTTP response. */ @@ -461,33 +316,51 @@ export type SubscriptionOperationsListResponse = SubscriptionOperationListResult * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionOperationListResult; + parsedBody: CanceledSubscriptionId; }; }; /** - * Contains response data for the createSubscriptionInEnrollmentAccount operation. + * Contains response data for the rename operation. */ -export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders & { +export type SubscriptionsRenameResponse = RenamedSubscriptionId & { /** * The underlying HTTP response. */ _response: msRest.HttpResponse & { /** - * The parsed HTTP response headers. + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders; + parsedBody: RenamedSubscriptionId; + }; +}; + +/** + * Contains response data for the enable operation. + */ +export type SubscriptionsEnableResponse = EnabledSubscriptionId & { + /** + * 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: SubscriptionCreationResult; + parsedBody: EnabledSubscriptionId; }; }; @@ -503,6 +376,7 @@ export type SubscriptionsListLocationsResponse = LocationListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -522,6 +396,7 @@ export type SubscriptionsGetResponse = Subscription & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -541,6 +416,7 @@ export type SubscriptionsListResponse = SubscriptionListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -560,6 +436,7 @@ export type SubscriptionsListNextResponse = SubscriptionListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -579,6 +456,7 @@ export type TenantsListResponse = TenantListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ @@ -598,6 +476,7 @@ export type TenantsListNextResponse = TenantListResult & { * The response body as text (string format) */ bodyAsText: string; + /** * The response body as parsed JSON or XML */ diff --git a/sdk/subscription/arm-subscriptions/src/models/mappers.ts b/sdk/subscription/arm-subscriptions/src/models/mappers.ts index 8d029bbac602..32d5e6e3f39e 100644 --- a/sdk/subscription/arm-subscriptions/src/models/mappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/mappers.ts @@ -1,11 +1,9 @@ /* * 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. */ import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; @@ -14,31 +12,20 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; -export const SubscriptionCreationResult: msRest.CompositeMapper = { - serializedName: "SubscriptionCreationResult", +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", type: { name: "Composite", - className: "SubscriptionCreationResult", + className: "ErrorResponse", modelProperties: { - subscriptionLink: { - serializedName: "subscriptionLink", + code: { + serializedName: "code", type: { name: "String" } - } - } - } -}; - -export const AdPrincipal: msRest.CompositeMapper = { - serializedName: "AdPrincipal", - type: { - name: "Composite", - className: "AdPrincipal", - modelProperties: { - objectId: { - required: true, - serializedName: "objectId", + }, + message: { + serializedName: "message", type: { name: "String" } @@ -47,65 +34,32 @@ export const AdPrincipal: msRest.CompositeMapper = { } }; -export const SubscriptionCreationParameters: msRest.CompositeMapper = { - serializedName: "SubscriptionCreationParameters", +export const CanceledSubscriptionId: msRest.CompositeMapper = { + serializedName: "CanceledSubscriptionId", type: { name: "Composite", - className: "SubscriptionCreationParameters", + className: "CanceledSubscriptionId", modelProperties: { - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - owners: { - serializedName: "owners", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AdPrincipal" - } - } - } - }, - offerType: { - serializedName: "offerType", + value: { + readOnly: true, + serializedName: "value", type: { name: "String" } - }, - additionalParameters: { - serializedName: "additionalParameters", - type: { - name: "Dictionary", - value: { - type: { - name: "Object" - } - } - } } } } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const RenamedSubscriptionId: msRest.CompositeMapper = { + serializedName: "RenamedSubscriptionId", type: { name: "Composite", - className: "ErrorResponse", + className: "RenamedSubscriptionId", modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", + value: { + readOnly: true, + serializedName: "value", type: { name: "String" } @@ -114,27 +68,15 @@ export const ErrorResponse: msRest.CompositeMapper = { } }; -export const SubscriptionOperation: msRest.CompositeMapper = { - serializedName: "SubscriptionOperation", +export const EnabledSubscriptionId: msRest.CompositeMapper = { + serializedName: "EnabledSubscriptionId", type: { name: "Composite", - className: "SubscriptionOperation", + className: "EnabledSubscriptionId", modelProperties: { - id: { + value: { readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - statusDetail: { - serializedName: "statusDetail", + serializedName: "value", type: { name: "String" } @@ -143,22 +85,16 @@ export const SubscriptionOperation: msRest.CompositeMapper = { } }; -export const SubscriptionOperationListResult: msRest.CompositeMapper = { - serializedName: "SubscriptionOperationListResult", +export const SubscriptionName: msRest.CompositeMapper = { + serializedName: "SubscriptionName", type: { name: "Composite", - className: "SubscriptionOperationListResult", + className: "SubscriptionName", modelProperties: { - value: { - serializedName: "value", + subscriptionName: { + serializedName: "subscriptionName", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SubscriptionOperation" - } - } + name: "String" } } } @@ -414,28 +350,6 @@ export const TenantIdDescription: msRest.CompositeMapper = { } }; -export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: msRest.CompositeMapper = { - serializedName: "subscriptionfactory-createsubscriptioninenrollmentaccount-headers", - type: { - name: "Composite", - className: "SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "String" - } - } - } - } -}; - export const LocationListResult: msRest.CompositeMapper = { serializedName: "LocationListResult", type: { diff --git a/sdk/subscription/arm-subscriptions/src/models/operationsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/operationsMappers.ts index 715467ec9522..b8de8606cf9d 100644 --- a/sdk/subscription/arm-subscriptions/src/models/operationsMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/operationsMappers.ts @@ -1,17 +1,14 @@ /* * 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. */ export { - OperationListResult, + ErrorResponse, Operation, OperationDisplay, - ErrorResponse + OperationListResult } from "../models/mappers"; - diff --git a/sdk/subscription/arm-subscriptions/src/models/parameters.ts b/sdk/subscription/arm-subscriptions/src/models/parameters.ts index 136f82600bfa..827bf5839416 100644 --- a/sdk/subscription/arm-subscriptions/src/models/parameters.ts +++ b/sdk/subscription/arm-subscriptions/src/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: '2019-03-01-preview', type: { name: "String" } @@ -44,16 +44,6 @@ export const apiVersion1: msRest.OperationQueryParameter = { } } }; -export const enrollmentAccountName: msRest.OperationURLParameter = { - parameterPath: "enrollmentAccountName", - mapper: { - required: true, - serializedName: "enrollmentAccountName", - type: { - name: "String" - } - } -}; export const nextPageLink: msRest.OperationURLParameter = { parameterPath: "nextPageLink", mapper: { diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts index 8630883ef598..a639a03b4ba3 100644 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts @@ -1,19 +1,21 @@ /* * 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. */ export { - LocationListResult, - Location, + CanceledSubscriptionId, CloudError, + EnabledSubscriptionId, + ErrorResponse, + Location, + LocationListResult, + RenamedSubscriptionId, Subscription, - SubscriptionPolicies, - SubscriptionListResult + SubscriptionListResult, + SubscriptionName, + SubscriptionPolicies } from "../models/mappers"; - diff --git a/sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts index cc13f90c8b50..3bb2cb4ae153 100644 --- a/sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts @@ -1,16 +1,13 @@ /* * 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. */ export { - TenantListResult, + CloudError, TenantIdDescription, - CloudError + TenantListResult } from "../models/mappers"; - diff --git a/sdk/subscription/arm-subscriptions/src/operations/index.ts b/sdk/subscription/arm-subscriptions/src/operations/index.ts index eafce4f8f867..3e6732554b87 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/index.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/index.ts @@ -9,7 +9,5 @@ */ export * from "./operations"; -export * from "./subscriptionOperations"; -export * from "./subscriptionFactory"; export * from "./subscriptions"; export * from "./tenants"; diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts index 3e978cba8f83..a193dd90f9fb 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts @@ -26,6 +26,94 @@ export class Subscriptions { this.client = client; } + /** + * The operation to cancel a subscription + * @param subscriptionId Subscription Id. + * @param [options] The optional parameters + * @returns Promise + */ + cancel(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Subscription Id. + * @param callback The callback + */ + cancel(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Subscription Id. + * @param options The optional parameters + * @param callback The callback + */ + cancel(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + cancel(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + subscriptionId, + options + }, + cancelOperationSpec, + callback) as Promise; + } + + /** + * The operation to rename a subscription + * @param subscriptionId Subscription Id. + * @param body Subscription Name + * @param [options] The optional parameters + * @returns Promise + */ + rename(subscriptionId: string, body: Models.SubscriptionName, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Subscription Id. + * @param body Subscription Name + * @param callback The callback + */ + rename(subscriptionId: string, body: Models.SubscriptionName, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Subscription Id. + * @param body Subscription Name + * @param options The optional parameters + * @param callback The callback + */ + rename(subscriptionId: string, body: Models.SubscriptionName, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + rename(subscriptionId: string, body: Models.SubscriptionName, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + subscriptionId, + body, + options + }, + renameOperationSpec, + callback) as Promise; + } + + /** + * Enables the subscription + * @param subscriptionId Subscription Id. + * @param [options] The optional parameters + * @returns Promise + */ + enable(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param subscriptionId Subscription Id. + * @param callback The callback + */ + enable(subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param subscriptionId Subscription Id. + * @param options The optional parameters + * @param callback The callback + */ + enable(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + enable(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + subscriptionId, + options + }, + enableOperationSpec, + callback) as Promise; + } + /** * This operation provides all the locations that are available for resource providers; however, * each resource provider may support a subset of this list. @@ -139,6 +227,82 @@ export class Subscriptions { // Operation Specifications const serializer = new msRest.Serializer(Mappers); +const cancelOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.CanceledSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const renameOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.SubscriptionName, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.RenamedSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const enableOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion0 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EnabledSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + const listLocationsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/locations", diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts index 6a060c07fcca..188113792eb6 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts @@ -18,8 +18,6 @@ import { SubscriptionClientContext } from "./subscriptionClientContext"; class SubscriptionClient extends SubscriptionClientContext { // Operation groups operations: operations.Operations; - subscriptionOperations: operations.SubscriptionOperations; - subscriptionFactory: operations.SubscriptionFactory; subscriptions: operations.Subscriptions; tenants: operations.Tenants; @@ -31,8 +29,6 @@ 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.subscriptionFactory = new operations.SubscriptionFactory(this); this.subscriptions = new operations.Subscriptions(this); this.tenants = new operations.Tenants(this); } diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts index bc27f46c00cb..f1f805ba1d10 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts +++ b/sdk/subscription/arm-subscriptions/src/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;