From 3895eafb7f4f1ed945de16c95cb2c88393a25c14 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 1 May 2020 11:52:38 +0000 Subject: [PATCH] Generated from f8b941ddb4f72ae7514c222cf7efb1eabd0c09a1 Update readme.md --- .../arm-subscriptions/LICENSE.txt | 2 +- sdk/subscription/arm-subscriptions/README.md | 18 +- .../arm-subscriptions/src/models/index.ts | 408 ++++------------- .../arm-subscriptions/src/models/mappers.ts | 385 ++++------------- .../src/models/parameters.ts | 49 +-- ...ctoryMappers.ts => subscriptionMappers.ts} | 10 +- ...ers.ts => subscriptionOperationMappers.ts} | 0 .../models/subscriptionOperationsMappers.ts | 13 - .../src/models/subscriptionsMappers.ts | 20 - .../src/models/tenantsMappers.ts | 13 - .../arm-subscriptions/src/operations/index.ts | 7 +- .../src/operations/operations.ts | 2 +- .../src/operations/subscription.ts | 409 ++++++++++++++++++ .../src/operations/subscriptionFactory.ts | 169 -------- ...Operations.ts => subscriptionOperation.ts} | 10 +- .../src/operations/subscriptionOperations.ts | 74 ---- .../src/operations/subscriptions.ts | 340 --------------- .../src/operations/tenants.ts | 123 ------ .../src/subscriptionClient.ts | 14 +- .../src/subscriptionClientContext.ts | 8 +- 20 files changed, 615 insertions(+), 1459 deletions(-) rename sdk/subscription/arm-subscriptions/src/models/{subscriptionFactoryMappers.ts => subscriptionMappers.ts} (63%) rename sdk/subscription/arm-subscriptions/src/models/{subscriptionOperationOperationsMappers.ts => subscriptionOperationMappers.ts} (100%) delete mode 100644 sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts delete mode 100644 sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts delete mode 100644 sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts create mode 100644 sdk/subscription/arm-subscriptions/src/operations/subscription.ts delete mode 100644 sdk/subscription/arm-subscriptions/src/operations/subscriptionFactory.ts rename sdk/subscription/arm-subscriptions/src/operations/{subscriptionOperationOperations.ts => subscriptionOperation.ts} (91%) delete mode 100644 sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts delete mode 100644 sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts delete mode 100644 sdk/subscription/arm-subscriptions/src/operations/tenants.ts diff --git a/sdk/subscription/arm-subscriptions/LICENSE.txt b/sdk/subscription/arm-subscriptions/LICENSE.txt index b73b4a1293c3..ea8fb1516028 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) 2019 Microsoft +Copyright (c) 2020 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 a4549f0fae61..dc6c1388b842 100644 --- a/sdk/subscription/arm-subscriptions/README.md +++ b/sdk/subscription/arm-subscriptions/README.md @@ -15,7 +15,7 @@ npm install @azure/arm-subscriptions ### How to use -#### nodejs - Authentication, client creation and listLocations subscriptions as an example written in TypeScript. +#### nodejs - Authentication, client creation and get subscriptionOperation as an example written in TypeScript. ##### Install @azure/ms-rest-nodeauth @@ -31,10 +31,12 @@ 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); - client.subscriptions.list().then((result) => { + const client = new SubscriptionClient(creds, subscriptionId); + const operationId = "testoperationId"; + client.subscriptionOperation.get(operationId).then((result) => { console.log("The result is:"); console.log(result); }); @@ -43,7 +45,7 @@ msRestNodeAuth.interactiveLogin().then((creds) => { }); ``` -#### browser - Authentication, client creation and listLocations subscriptions as an example written in JavaScript. +#### browser - Authentication, client creation and get subscriptionOperation as an example written in JavaScript. ##### Install @azure/ms-rest-browserauth @@ -77,8 +79,8 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to authManager.login(); } const client = new Azure.ArmSubscriptions.SubscriptionClient(res.creds, subscriptionId); - const subscriptionId = "testsubscriptionId"; - client.subscriptions.listLocations(subscriptionId).then((result) => { + const operationId = "testoperationId"; + client.subscriptionOperation.get(operationId).then((result) => { console.log("The result is:"); console.log(result); }).catch((err) => { @@ -96,4 +98,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%2Fsdk%2Fsubscription%2Farm-subscriptions%2FREADME.png) +![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/src/models/index.ts b/sdk/subscription/arm-subscriptions/src/models/index.ts index c36cd679f128..56b1e85b1b45 100644 --- a/sdk/subscription/arm-subscriptions/src/models/index.ts +++ b/sdk/subscription/arm-subscriptions/src/models/index.ts @@ -47,6 +47,17 @@ export interface RenamedSubscriptionId { readonly value?: string; } +/** + * The ID of the subscriptions that is being enabled + */ +export interface EnabledSubscriptionId { + /** + * The ID of the subscriptions that is being enabled + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly value?: string; +} + /** * The new name of the subscription. */ @@ -104,17 +115,6 @@ export interface OperationListResult { nextLink?: string; } -/** - * The created subscription object. - */ -export interface SubscriptionCreationResult { - /** - * The link to the new subscription. Use this link to check the status of subscription creation - * operation. - */ - subscriptionLink?: string; -} - /** * Active Directory Principal who’ll get owner access on the new subscription. */ @@ -126,69 +126,14 @@ export interface AdPrincipal { } /** - * The parameters required to create a new subscription. - */ -export interface ModernSubscriptionCreationParameters { - /** - * The friendly name of the subscription. - */ - displayName: string; - /** - * The ARM ID of the billing profile for which you want to create the subscription. - */ - billingProfileId: string; - /** - * The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of - * the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for - * DevTest. - */ - skuId: string; - /** - * If set, the cost center will show up on the Azure usage and charges file. - */ - costCenter?: string; - /** - * If specified, the AD principal will get owner access to the subscription, along with the user - * who is performing the create subscription operation - */ - owner?: AdPrincipal; - /** - * The identifier of the management group to which this subscription will be associated. - */ - managementGroupId?: string; - /** - * Additional, untyped parameters to support custom subscription creation scenarios. - */ - additionalParameters?: { [propertyName: string]: any }; -} - -/** - * status of the subscription POST operation. - */ -export interface SubscriptionOperation { - /** - * The operation Id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Status of the pending subscription - */ - status?: string; - /** - * Status Detail of the pending subscription - */ - statusDetail?: string; -} - -/** - * A list of pending subscription operations. + * The created subscription object. */ -export interface SubscriptionOperationListResult { +export interface SubscriptionCreationResult { /** - * A list of pending SubscriptionOperations + * The link to the new subscription. Use this link to check the status of subscription creation + * operation. */ - value?: SubscriptionOperation[]; + subscriptionLink?: string; } /** @@ -199,6 +144,10 @@ export interface SubscriptionCreationParameters { * The display name of the subscription. */ displayName?: string; + /** + * The Management Group Id. + */ + managementGroupId?: string; /** * The list of principals that should be granted Owner access on the subscription. Principals * should be of type User, Service Principal or Security Group. @@ -218,124 +167,78 @@ export interface SubscriptionCreationParameters { } /** - * Location information. + * The parameters required to create a new subscription. */ -export interface Location { +export interface ModernSubscriptionCreationParameters { /** - * 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.** + * The friendly name of the subscription. */ - readonly id?: string; + displayName: string; /** - * The subscription ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of + * the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for + * DevTest. */ - readonly subscriptionId?: string; + skuId: string; /** - * The location name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * If set, the cost center will show up on the Azure usage and charges file. */ - readonly name?: string; + costCenter?: string; /** - * The display name of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * If specified, the AD principal will get owner access to the subscription, along with the user + * who is performing the create subscription operation */ - readonly displayName?: string; + owner?: AdPrincipal; /** - * The latitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The identifier of the management group to which this subscription will be associated. */ - readonly latitude?: string; + managementGroupId?: string; /** - * The longitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Additional, untyped parameters to support custom subscription creation scenarios. */ - readonly longitude?: string; + additionalParameters?: { [propertyName: string]: any }; } /** - * Subscription policies. + * The parameters required to create a new CSP subscription. */ -export interface SubscriptionPolicies { +export interface ModernCspSubscriptionCreationParameters { /** - * 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.** + * The friendly name of the subscription. */ - readonly locationPlacementId?: string; + displayName: string; /** - * The subscription quota ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The SKU ID of the Azure plan. Azure plan determines the pricing and service-level agreement of + * the subscription. Use 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for + * DevTest. */ - readonly quotaId?: string; + skuId: string; /** - * 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.** + * Reseller ID, basically MPN Id. */ - readonly spendingLimit?: SpendingLimit; + resellerId?: string; } /** - * Subscription information. + * An interface representing SubscriptionClientOptions. */ -export interface Subscription { - /** - * 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; - /** - * The subscription ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly subscriptionId?: string; - /** - * The subscription display name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly displayName?: string; - /** - * 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; - /** - * The subscription policies. - */ - subscriptionPolicies?: SubscriptionPolicies; - /** - * 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; +export interface SubscriptionClientOptions extends AzureServiceClientOptions { + baseUri?: string; } /** - * Tenant Id information. + * Defines headers for CreateSubscriptionInEnrollmentAccount operation. */ -export interface TenantIdDescription { +export interface SubscriptionCreateSubscriptionInEnrollmentAccountHeaders { /** - * 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.** + * GET this URL to retrieve the status of the asynchronous operation. */ - readonly id?: string; + location: string; /** - * 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 amount of delay to use while the status of the operation is checked. The value is + * expressed in seconds. */ - readonly tenantId?: string; -} - -/** - * An interface representing SubscriptionClientOptions. - */ -export interface SubscriptionClientOptions extends AzureServiceClientOptions { - baseUri?: string; + retryAfter: string; } /** @@ -356,7 +259,7 @@ export interface SubscriptionOperationGetHeaders { /** * Defines headers for CreateSubscription operation. */ -export interface SubscriptionFactoryCreateSubscriptionHeaders { +export interface SubscriptionCreateSubscriptionHeaders { /** * GET this URL to retrieve the status of the asynchronous operation. */ @@ -369,9 +272,9 @@ export interface SubscriptionFactoryCreateSubscriptionHeaders { } /** - * Defines headers for CreateSubscriptionInEnrollmentAccount operation. + * Defines headers for CreateCspSubscription operation. */ -export interface SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders { +export interface SubscriptionCreateCspSubscriptionHeaders { /** * GET this URL to retrieve the status of the asynchronous operation. */ @@ -380,39 +283,7 @@ export interface SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders * The amount of delay to use while the status of the operation is checked. The value is * expressed in seconds. */ - retryAfter: string; -} - -/** - * @interface - * Location list operation response. - * @extends Array - */ -export interface LocationListResult extends Array { -} - -/** - * @interface - * Subscription list operation response. - * @extends Array - */ -export interface SubscriptionListResult extends Array { - /** - * The URL to get the next set of results. - */ - nextLink: string; -} - -/** - * @interface - * Tenant Ids information. - * @extends Array - */ -export interface TenantListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink: string; + retryAfter: number; } /** @@ -424,69 +295,18 @@ export interface TenantListResult extends Array { export type OfferType = 'MS-AZR-0017P' | 'MS-AZR-0148P'; /** - * Defines values for SubscriptionState. - * Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' - * @readonly - * @enum {string} - */ -export type SubscriptionState = 'Enabled' | 'Warned' | 'PastDue' | 'Disabled' | 'Deleted'; - -/** - * Defines values for SpendingLimit. - * Possible values include: 'On', 'Off', 'CurrentPeriodOff' - * @readonly - * @enum {string} - */ -export type SpendingLimit = 'On' | 'Off' | 'CurrentPeriodOff'; - -/** - * Contains response data for the cancel operation. - */ -export type SubscriptionsCancelResponse = 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 rename operation. + * Contains response data for the createSubscriptionInEnrollmentAccount operation. */ -export type SubscriptionsRenameResponse = RenamedSubscriptionId & { +export type SubscriptionCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionCreateSubscriptionInEnrollmentAccountHeaders & { /** * The underlying HTTP response. */ _response: msRest.HttpResponse & { /** - * The response body as text (string format) + * The parsed HTTP response headers. */ - bodyAsText: string; + parsedHeaders: SubscriptionCreateSubscriptionInEnrollmentAccountHeaders; - /** - * The response body as parsed JSON or XML - */ - parsedBody: RenamedSubscriptionId; - }; -}; - -/** - * Contains response data for the listLocations operation. - */ -export type SubscriptionsListLocationsResponse = LocationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { /** * The response body as text (string format) */ @@ -495,14 +315,14 @@ export type SubscriptionsListLocationsResponse = LocationListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: LocationListResult; + parsedBody: SubscriptionCreationResult; }; }; /** - * Contains response data for the get operation. + * Contains response data for the cancel operation. */ -export type SubscriptionsGetResponse = Subscription & { +export type SubscriptionCancelResponse = CanceledSubscriptionId & { /** * The underlying HTTP response. */ @@ -515,14 +335,14 @@ export type SubscriptionsGetResponse = Subscription & { /** * The response body as parsed JSON or XML */ - parsedBody: Subscription; + parsedBody: CanceledSubscriptionId; }; }; /** - * Contains response data for the list operation. + * Contains response data for the rename operation. */ -export type SubscriptionsListResponse = SubscriptionListResult & { +export type SubscriptionRenameResponse = RenamedSubscriptionId & { /** * The underlying HTTP response. */ @@ -535,14 +355,14 @@ export type SubscriptionsListResponse = SubscriptionListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionListResult; + parsedBody: RenamedSubscriptionId; }; }; /** - * Contains response data for the listNext operation. + * Contains response data for the enable operation. */ -export type SubscriptionsListNextResponse = SubscriptionListResult & { +export type SubscriptionEnableResponse = EnabledSubscriptionId & { /** * The underlying HTTP response. */ @@ -555,14 +375,14 @@ export type SubscriptionsListNextResponse = SubscriptionListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionListResult; + parsedBody: EnabledSubscriptionId; }; }; /** - * Contains response data for the get operation. + * Contains response data for the createSubscription operation. */ -export type SubscriptionOperationGetResponse = SubscriptionCreationResult & SubscriptionOperationGetHeaders & { +export type SubscriptionCreateSubscriptionResponse = SubscriptionCreationResult & SubscriptionCreateSubscriptionHeaders & { /** * The underlying HTTP response. */ @@ -570,7 +390,7 @@ export type SubscriptionOperationGetResponse = SubscriptionCreationResult & Subs /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionOperationGetHeaders; + parsedHeaders: SubscriptionCreateSubscriptionHeaders; /** * The response body as text (string format) @@ -585,9 +405,9 @@ export type SubscriptionOperationGetResponse = SubscriptionCreationResult & Subs }; /** - * Contains response data for the createSubscription operation. + * Contains response data for the createCspSubscription operation. */ -export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionHeaders & { +export type SubscriptionCreateCspSubscriptionResponse = SubscriptionCreationResult & SubscriptionCreateCspSubscriptionHeaders & { /** * The underlying HTTP response. */ @@ -595,7 +415,7 @@ export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreation /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionHeaders; + parsedHeaders: SubscriptionCreateCspSubscriptionHeaders; /** * The response body as text (string format) @@ -610,9 +430,9 @@ export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreation }; /** - * Contains response data for the createSubscriptionInEnrollmentAccount operation. + * Contains response data for the get operation. */ -export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders & { +export type SubscriptionOperationGetResponse = SubscriptionCreationResult & SubscriptionOperationGetHeaders & { /** * The underlying HTTP response. */ @@ -620,7 +440,7 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders; + parsedHeaders: SubscriptionOperationGetHeaders; /** * The response body as text (string format) @@ -634,26 +454,6 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S }; }; -/** - * Contains response data for the list operation. - */ -export type SubscriptionOperationsListResponse = SubscriptionOperationListResult & { - /** - * 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: SubscriptionOperationListResult; - }; -}; - /** * Contains response data for the list operation. */ @@ -673,43 +473,3 @@ export type OperationsListResponse = OperationListResult & { parsedBody: OperationListResult; }; }; - -/** - * Contains response data for the list operation. - */ -export type TenantsListResponse = TenantListResult & { - /** - * 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: TenantListResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type TenantsListNextResponse = TenantListResult & { - /** - * 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: TenantListResult; - }; -}; diff --git a/sdk/subscription/arm-subscriptions/src/models/mappers.ts b/sdk/subscription/arm-subscriptions/src/models/mappers.ts index ec04b137a470..6ce8d2762cbd 100644 --- a/sdk/subscription/arm-subscriptions/src/models/mappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/mappers.ts @@ -68,6 +68,23 @@ export const RenamedSubscriptionId: msRest.CompositeMapper = { } }; +export const EnabledSubscriptionId: msRest.CompositeMapper = { + serializedName: "EnabledSubscriptionId", + type: { + name: "Composite", + className: "EnabledSubscriptionId", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + export const SubscriptionName: msRest.CompositeMapper = { serializedName: "SubscriptionName", type: { @@ -163,22 +180,6 @@ export const OperationListResult: msRest.CompositeMapper = { } }; -export const SubscriptionCreationResult: msRest.CompositeMapper = { - serializedName: "SubscriptionCreationResult", - type: { - name: "Composite", - className: "SubscriptionCreationResult", - modelProperties: { - subscriptionLink: { - serializedName: "subscriptionLink", - type: { - name: "String" - } - } - } - } -}; - export const AdPrincipal: msRest.CompositeMapper = { serializedName: "AdPrincipal", type: { @@ -196,88 +197,14 @@ export const AdPrincipal: msRest.CompositeMapper = { } }; -export const ModernSubscriptionCreationParameters: msRest.CompositeMapper = { - serializedName: "ModernSubscriptionCreationParameters", - type: { - name: "Composite", - className: "ModernSubscriptionCreationParameters", - modelProperties: { - displayName: { - required: true, - serializedName: "displayName", - type: { - name: "String" - } - }, - billingProfileId: { - required: true, - serializedName: "billingProfileId", - type: { - name: "String" - } - }, - skuId: { - required: true, - serializedName: "skuId", - type: { - name: "String" - } - }, - costCenter: { - serializedName: "costCenter", - type: { - name: "String" - } - }, - owner: { - serializedName: "owner", - type: { - name: "Composite", - className: "AdPrincipal" - } - }, - managementGroupId: { - serializedName: "managementGroupId", - type: { - name: "String" - } - }, - additionalParameters: { - serializedName: "additionalParameters", - type: { - name: "Dictionary", - value: { - type: { - name: "Object" - } - } - } - } - } - } -}; - -export const SubscriptionOperation: msRest.CompositeMapper = { - serializedName: "SubscriptionOperation", +export const SubscriptionCreationResult: msRest.CompositeMapper = { + serializedName: "SubscriptionCreationResult", type: { name: "Composite", - className: "SubscriptionOperation", + className: "SubscriptionCreationResult", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - statusDetail: { - serializedName: "statusDetail", + subscriptionLink: { + serializedName: "subscriptionLink", type: { name: "String" } @@ -286,28 +213,6 @@ export const SubscriptionOperation: msRest.CompositeMapper = { } }; -export const SubscriptionOperationListResult: msRest.CompositeMapper = { - serializedName: "SubscriptionOperationListResult", - type: { - name: "Composite", - className: "SubscriptionOperationListResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SubscriptionOperation" - } - } - } - } - } - } -}; - export const SubscriptionCreationParameters: msRest.CompositeMapper = { serializedName: "SubscriptionCreationParameters", type: { @@ -320,6 +225,12 @@ export const SubscriptionCreationParameters: msRest.CompositeMapper = { name: "String" } }, + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, owners: { serializedName: "owners", type: { @@ -353,144 +264,82 @@ export const SubscriptionCreationParameters: msRest.CompositeMapper = { } }; -export const Location: msRest.CompositeMapper = { - serializedName: "Location", +export const ModernSubscriptionCreationParameters: msRest.CompositeMapper = { + serializedName: "ModernSubscriptionCreationParameters", type: { name: "Composite", - className: "Location", + className: "ModernSubscriptionCreationParameters", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - subscriptionId: { - readOnly: true, - serializedName: "subscriptionId", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, displayName: { - readOnly: true, + required: true, serializedName: "displayName", type: { name: "String" } }, - latitude: { - readOnly: true, - serializedName: "latitude", + skuId: { + required: true, + serializedName: "skuId", type: { name: "String" } }, - longitude: { - readOnly: true, - serializedName: "longitude", + costCenter: { + serializedName: "costCenter", type: { name: "String" } - } - } - } -}; - -export const SubscriptionPolicies: msRest.CompositeMapper = { - serializedName: "SubscriptionPolicies", - type: { - name: "Composite", - className: "SubscriptionPolicies", - modelProperties: { - locationPlacementId: { - readOnly: true, - serializedName: "locationPlacementId", + }, + owner: { + serializedName: "owner", type: { - name: "String" + name: "Composite", + className: "AdPrincipal" } }, - quotaId: { - readOnly: true, - serializedName: "quotaId", + managementGroupId: { + serializedName: "managementGroupId", type: { name: "String" } }, - spendingLimit: { - readOnly: true, - serializedName: "spendingLimit", + additionalParameters: { + serializedName: "additionalParameters", type: { - name: "Enum", - allowedValues: [ - "On", - "Off", - "CurrentPeriodOff" - ] + name: "Dictionary", + value: { + type: { + name: "Object" + } + } } } } } }; -export const Subscription: msRest.CompositeMapper = { - serializedName: "Subscription", +export const ModernCspSubscriptionCreationParameters: msRest.CompositeMapper = { + serializedName: "ModernCspSubscriptionCreationParameters", type: { name: "Composite", - className: "Subscription", + className: "ModernCspSubscriptionCreationParameters", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - subscriptionId: { - readOnly: true, - serializedName: "subscriptionId", - type: { - name: "String" - } - }, displayName: { - readOnly: true, + required: true, serializedName: "displayName", type: { name: "String" } }, - state: { - readOnly: true, - serializedName: "state", - type: { - name: "Enum", - allowedValues: [ - "Enabled", - "Warned", - "PastDue", - "Disabled", - "Deleted" - ] - } - }, - subscriptionPolicies: { - serializedName: "subscriptionPolicies", + skuId: { + required: true, + serializedName: "skuId", type: { - name: "Composite", - className: "SubscriptionPolicies" + name: "String" } }, - authorizationSource: { - serializedName: "authorizationSource", + resellerId: { + serializedName: "resellerId", type: { name: "String" } @@ -499,22 +348,20 @@ export const Subscription: msRest.CompositeMapper = { } }; -export const TenantIdDescription: msRest.CompositeMapper = { - serializedName: "TenantIdDescription", +export const SubscriptionCreateSubscriptionInEnrollmentAccountHeaders: msRest.CompositeMapper = { + serializedName: "subscription-createsubscriptioninenrollmentaccount-headers", type: { name: "Composite", - className: "TenantIdDescription", + className: "SubscriptionCreateSubscriptionInEnrollmentAccountHeaders", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + location: { + serializedName: "location", type: { name: "String" } }, - tenantId: { - readOnly: true, - serializedName: "tenantId", + retryAfter: { + serializedName: "retry-after", type: { name: "String" } @@ -545,11 +392,11 @@ export const SubscriptionOperationGetHeaders: msRest.CompositeMapper = { } }; -export const SubscriptionFactoryCreateSubscriptionHeaders: msRest.CompositeMapper = { - serializedName: "subscriptionfactory-createsubscription-headers", +export const SubscriptionCreateSubscriptionHeaders: msRest.CompositeMapper = { + serializedName: "subscription-createsubscription-headers", type: { name: "Composite", - className: "SubscriptionFactoryCreateSubscriptionHeaders", + className: "SubscriptionCreateSubscriptionHeaders", modelProperties: { location: { serializedName: "location", @@ -567,11 +414,11 @@ export const SubscriptionFactoryCreateSubscriptionHeaders: msRest.CompositeMappe } }; -export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: msRest.CompositeMapper = { - serializedName: "subscriptionfactory-createsubscriptioninenrollmentaccount-headers", +export const SubscriptionCreateCspSubscriptionHeaders: msRest.CompositeMapper = { + serializedName: "subscription-createcspsubscription-headers", type: { name: "Composite", - className: "SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders", + className: "SubscriptionCreateCspSubscriptionHeaders", modelProperties: { location: { serializedName: "location", @@ -582,87 +429,7 @@ export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: ms retryAfter: { serializedName: "retry-after", type: { - name: "String" - } - } - } - } -}; - -export const LocationListResult: msRest.CompositeMapper = { - serializedName: "LocationListResult", - type: { - name: "Composite", - className: "LocationListResult", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Location" - } - } - } - } - } - } -}; - -export const SubscriptionListResult: msRest.CompositeMapper = { - serializedName: "SubscriptionListResult", - type: { - name: "Composite", - className: "SubscriptionListResult", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Subscription" - } - } - } - }, - nextLink: { - required: true, - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const TenantListResult: msRest.CompositeMapper = { - serializedName: "TenantListResult", - type: { - name: "Composite", - className: "TenantListResult", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TenantIdDescription" - } - } - } - }, - nextLink: { - required: true, - serializedName: "nextLink", - type: { - name: "String" + name: "Number" } } } diff --git a/sdk/subscription/arm-subscriptions/src/models/parameters.ts b/sdk/subscription/arm-subscriptions/src/models/parameters.ts index 0e5e2164d620..9e031714b0a3 100644 --- a/sdk/subscription/arm-subscriptions/src/models/parameters.ts +++ b/sdk/subscription/arm-subscriptions/src/models/parameters.ts @@ -20,59 +20,41 @@ export const acceptLanguage: msRest.OperationParameter = { } } }; -export const apiVersion0: msRest.OperationQueryParameter = { +export const apiVersion: msRest.OperationQueryParameter = { parameterPath: "apiVersion", mapper: { required: true, - isConstant: true, serializedName: "api-version", - defaultValue: '2019-03-01-preview', type: { name: "String" } } }; -export const apiVersion1: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: '2016-06-01', - type: { - name: "String" - } - } -}; -export const apiVersion2: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", +export const billingAccountName: msRest.OperationURLParameter = { + parameterPath: "billingAccountName", mapper: { required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: '2018-11-01-preview', + serializedName: "billingAccountName", type: { name: "String" } } }; -export const apiVersion3: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", +export const billingProfileName: msRest.OperationURLParameter = { + parameterPath: "billingProfileName", mapper: { required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: '2018-03-01-preview', + serializedName: "billingProfileName", type: { name: "String" } } }; -export const billingAccountName: msRest.OperationURLParameter = { - parameterPath: "billingAccountName", +export const customerName: msRest.OperationURLParameter = { + parameterPath: "customerName", mapper: { required: true, - serializedName: "billingAccountName", + serializedName: "customerName", type: { name: "String" } @@ -98,17 +80,6 @@ export const invoiceSectionName: msRest.OperationURLParameter = { } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", - mapper: { - required: true, - serializedName: "nextLink", - type: { - name: "String" - } - }, - skipEncoding: true -}; export const operationId: msRest.OperationURLParameter = { parameterPath: "operationId", mapper: { diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionMappers.ts similarity index 63% rename from sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts rename to sdk/subscription/arm-subscriptions/src/models/subscriptionMappers.ts index b057f11f94b3..53aecbcc175d 100644 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/subscriptionMappers.ts @@ -8,10 +8,16 @@ export { AdPrincipal, + CanceledSubscriptionId, + EnabledSubscriptionId, ErrorResponse, + ModernCspSubscriptionCreationParameters, ModernSubscriptionCreationParameters, + RenamedSubscriptionId, + SubscriptionCreateCspSubscriptionHeaders, + SubscriptionCreateSubscriptionHeaders, + SubscriptionCreateSubscriptionInEnrollmentAccountHeaders, SubscriptionCreationParameters, SubscriptionCreationResult, - SubscriptionFactoryCreateSubscriptionHeaders, - SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders + SubscriptionName } from "../models/mappers"; diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationOperationsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationMappers.ts similarity index 100% rename from sdk/subscription/arm-subscriptions/src/models/subscriptionOperationOperationsMappers.ts rename to sdk/subscription/arm-subscriptions/src/models/subscriptionOperationMappers.ts diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts deleted file mode 100644 index e2ed59bfb39f..000000000000 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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 { - ErrorResponse, - SubscriptionOperation, - SubscriptionOperationListResult -} from "../models/mappers"; diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts deleted file mode 100644 index 5c87e105cba4..000000000000 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { - CanceledSubscriptionId, - CloudError, - ErrorResponse, - Location, - LocationListResult, - RenamedSubscriptionId, - Subscription, - 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 deleted file mode 100644 index 3bb2cb4ae153..000000000000 --- a/sdk/subscription/arm-subscriptions/src/models/tenantsMappers.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * 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 { - CloudError, - TenantIdDescription, - 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 6774c4b687f8..1bf6155e6117 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/index.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/index.ts @@ -8,9 +8,6 @@ * regenerated. */ -export * from "./subscriptions"; -export * from "./subscriptionOperationOperations"; -export * from "./subscriptionFactory"; -export * from "./subscriptionOperations"; +export * from "./subscription"; +export * from "./subscriptionOperation"; export * from "./operations"; -export * from "./tenants"; diff --git a/sdk/subscription/arm-subscriptions/src/operations/operations.ts b/sdk/subscription/arm-subscriptions/src/operations/operations.ts index 5720ebfc56a0..579e185b83f5 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/operations.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/operations.ts @@ -57,7 +57,7 @@ const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "providers/Microsoft.Subscription/operations", queryParameters: [ - Parameters.apiVersion3 + Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscription.ts b/sdk/subscription/arm-subscriptions/src/operations/subscription.ts new file mode 100644 index 000000000000..b4bbbc8a244d --- /dev/null +++ b/sdk/subscription/arm-subscriptions/src/operations/subscription.ts @@ -0,0 +1,409 @@ +/* + * 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 msRestAzure from "@azure/ms-rest-azure-js"; +import * as Models from "../models"; +import * as Mappers from "../models/subscriptionMappers"; +import * as Parameters from "../models/parameters"; +import { SubscriptionClientContext } from "../subscriptionClientContext"; + +/** Class representing a Subscription. */ +export class Subscription { + private readonly client: SubscriptionClientContext; + + /** + * Create a Subscription. + * @param {SubscriptionClientContext} client Reference to the service client. + */ + constructor(client: SubscriptionClientContext) { + this.client = client; + } + + /** + * Creates an Azure subscription + * @param enrollmentAccountName The name of the enrollment account to which the subscription will + * be billed. + * @param body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + createSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * 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; + } + + /** + * The operation to enable a 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; + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which + * you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you + * want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you + * want to create the subscription. + * @param body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + createSubscription(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, body: Models.ModernSubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateSubscription(billingAccountName,billingProfileName,invoiceSectionName,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * The operation to create a new CSP subscription. + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which + * you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + createCspSubscription(billingAccountName: string, customerName: string, body: Models.ModernCspSubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateCspSubscription(billingAccountName,customerName,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 body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + enrollmentAccountName, + body, + options + }, + beginCreateSubscriptionInEnrollmentAccountOperationSpec, + options); + } + + /** + * The operation to create a new WebDirect or EA Azure subscription. + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which + * you want to create the subscription. + * @param billingProfileName The name of the billing profile in the billing account for which you + * want to create the subscription. + * @param invoiceSectionName The name of the invoice section in the billing account for which you + * want to create the subscription. + * @param body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateSubscription(billingAccountName: string, billingProfileName: string, invoiceSectionName: string, body: Models.ModernSubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + billingAccountName, + billingProfileName, + invoiceSectionName, + body, + options + }, + beginCreateSubscriptionOperationSpec, + options); + } + + /** + * The operation to create a new CSP subscription. + * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which + * you want to create the subscription. + * @param customerName The name of the customer. + * @param body The subscription creation parameters. + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateCspSubscription(billingAccountName: string, customerName: string, body: Models.ModernCspSubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + billingAccountName, + customerName, + body, + options + }, + beginCreateCspSubscriptionOperationSpec, + options); + } +} + +// 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.apiVersion + ], + 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.apiVersion + ], + 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.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.EnabledSubscriptionId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const beginCreateSubscriptionInEnrollmentAccountOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription", + urlParameters: [ + Parameters.enrollmentAccountName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.SubscriptionCreationParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.SubscriptionCreationResult, + headersMapper: Mappers.SubscriptionCreateSubscriptionInEnrollmentAccountHeaders + }, + 202: { + headersMapper: Mappers.SubscriptionCreateSubscriptionInEnrollmentAccountHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const beginCreateSubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription", + urlParameters: [ + Parameters.billingAccountName, + Parameters.billingProfileName, + Parameters.invoiceSectionName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.ModernSubscriptionCreationParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.SubscriptionCreationResult, + headersMapper: Mappers.SubscriptionCreateSubscriptionHeaders + }, + 202: { + headersMapper: Mappers.SubscriptionCreateSubscriptionHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const beginCreateCspSubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription", + urlParameters: [ + Parameters.billingAccountName, + Parameters.customerName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.ModernCspSubscriptionCreationParameters, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.SubscriptionCreationResult, + headersMapper: Mappers.SubscriptionCreateCspSubscriptionHeaders + }, + 202: { + headersMapper: Mappers.SubscriptionCreateCspSubscriptionHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptionFactory.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptionFactory.ts deleted file mode 100644 index f7ae7d29a05d..000000000000 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptionFactory.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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 msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/subscriptionFactoryMappers"; -import * as Parameters from "../models/parameters"; -import { SubscriptionClientContext } from "../subscriptionClientContext"; - -/** Class representing a SubscriptionFactory. */ -export class SubscriptionFactory { - private readonly client: SubscriptionClientContext; - - /** - * Create a SubscriptionFactory. - * @param {SubscriptionClientContext} client Reference to the service client. - */ - constructor(client: SubscriptionClientContext) { - this.client = client; - } - - /** - * The operation to create a new Azure subscription - * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which - * you want to create the subscription. - * @param invoiceSectionName The name of the invoice section in the billing account for which you - * want to create the subscription. - * @param body The subscription creation parameters. - * @param [options] The optional parameters - * @returns Promise - */ - createSubscription(billingAccountName: string, invoiceSectionName: string, body: Models.ModernSubscriptionCreationParameters, 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 body The subscription creation parameters. - * @param [options] The optional parameters - * @returns Promise - */ - createSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName,body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * The operation to create a new Azure subscription - * @param billingAccountName The name of the Microsoft Customer Agreement billing account for which - * you want to create the subscription. - * @param invoiceSectionName The name of the invoice section in the billing account for which you - * want to create the subscription. - * @param body The subscription creation parameters. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateSubscription(billingAccountName: string, invoiceSectionName: string, body: Models.ModernSubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - billingAccountName, - invoiceSectionName, - body, - options - }, - beginCreateSubscriptionOperationSpec, - options); - } - - /** - * Creates an Azure subscription - * @param enrollmentAccountName The name of the enrollment account to which the subscription will - * be billed. - * @param body The subscription creation parameters. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateSubscriptionInEnrollmentAccount(enrollmentAccountName: string, body: Models.SubscriptionCreationParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - enrollmentAccountName, - body, - options - }, - beginCreateSubscriptionInEnrollmentAccountOperationSpec, - options); - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const beginCreateSubscriptionOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription", - urlParameters: [ - Parameters.billingAccountName, - Parameters.invoiceSectionName - ], - queryParameters: [ - Parameters.apiVersion2 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.ModernSubscriptionCreationParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.SubscriptionCreationResult, - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionHeaders - }, - 202: { - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionHeaders - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginCreateSubscriptionInEnrollmentAccountOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription", - urlParameters: [ - Parameters.enrollmentAccountName - ], - queryParameters: [ - Parameters.apiVersion3 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.SubscriptionCreationParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.SubscriptionCreationResult, - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders - }, - 202: { - headersMapper: Mappers.SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperationOperations.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperation.ts similarity index 91% rename from sdk/subscription/arm-subscriptions/src/operations/subscriptionOperationOperations.ts rename to sdk/subscription/arm-subscriptions/src/operations/subscriptionOperation.ts index 4dd1d8d3e0e3..73db2fcfac9c 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperationOperations.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperation.ts @@ -10,16 +10,16 @@ import * as msRest from "@azure/ms-rest-js"; import * as Models from "../models"; -import * as Mappers from "../models/subscriptionOperationOperationsMappers"; +import * as Mappers from "../models/subscriptionOperationMappers"; import * as Parameters from "../models/parameters"; import { SubscriptionClientContext } from "../subscriptionClientContext"; -/** Class representing a SubscriptionOperationOperations. */ -export class SubscriptionOperationOperations { +/** Class representing a SubscriptionOperation. */ +export class SubscriptionOperation { private readonly client: SubscriptionClientContext; /** - * Create a SubscriptionOperationOperations. + * Create a SubscriptionOperation. * @param {SubscriptionClientContext} client Reference to the service client. */ constructor(client: SubscriptionClientContext) { @@ -67,7 +67,7 @@ const getOperationSpec: msRest.OperationSpec = { Parameters.operationId ], queryParameters: [ - Parameters.apiVersion2 + Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts deleted file mode 100644 index e898453ec339..000000000000 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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/subscriptionOperationsMappers"; -import * as Parameters from "../models/parameters"; -import { SubscriptionClientContext } from "../subscriptionClientContext"; - -/** Class representing a SubscriptionOperations. */ -export class SubscriptionOperations { - private readonly client: SubscriptionClientContext; - - /** - * Create a SubscriptionOperations. - * @param {SubscriptionClientContext} client Reference to the service client. - */ - constructor(client: SubscriptionClientContext) { - this.client = client; - } - - /** - * Lists all of the available pending Microsoft.Subscription API operations. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Subscription/subscriptionOperations", - queryParameters: [ - Parameters.apiVersion3 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SubscriptionOperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts deleted file mode 100644 index f36dbcf2e2b8..000000000000 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts +++ /dev/null @@ -1,340 +0,0 @@ -/* - * 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/subscriptionsMappers"; -import * as Parameters from "../models/parameters"; -import { SubscriptionClientContext } from "../subscriptionClientContext"; - -/** Class representing a Subscriptions. */ -export class Subscriptions { - private readonly client: SubscriptionClientContext; - - /** - * Create a Subscriptions. - * @param {SubscriptionClientContext} client Reference to the service client. - */ - constructor(client: SubscriptionClientContext) { - 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; - } - - /** - * This operation provides all the locations that are available for resource providers; however, - * each resource provider may support a subset of this list. - * @summary Gets all available geo-locations. - * @param subscriptionId The ID of the target subscription. - * @param [options] The optional parameters - * @returns Promise - */ - listLocations(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId The ID of the target subscription. - * @param callback The callback - */ - listLocations(subscriptionId: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId The ID of the target subscription. - * @param options The optional parameters - * @param callback The callback - */ - listLocations(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listLocations(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - subscriptionId, - options - }, - listLocationsOperationSpec, - callback) as Promise; - } - - /** - * Gets details about a specified subscription. - * @param subscriptionId The ID of the target subscription. - * @param [options] The optional parameters - * @returns Promise - */ - get(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId The ID of the target subscription. - * @param callback The callback - */ - get(subscriptionId: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId The ID of the target subscription. - * @param options The optional parameters - * @param callback The callback - */ - get(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - subscriptionId, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * Gets all subscriptions for a tenant. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * Gets all subscriptions for a tenant. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; - } -} - -// 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 listLocationsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/locations", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.LocationListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.Subscription - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions", - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SubscriptionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SubscriptionListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/subscription/arm-subscriptions/src/operations/tenants.ts b/sdk/subscription/arm-subscriptions/src/operations/tenants.ts deleted file mode 100644 index cd4102be9ebf..000000000000 --- a/sdk/subscription/arm-subscriptions/src/operations/tenants.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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/tenantsMappers"; -import * as Parameters from "../models/parameters"; -import { SubscriptionClientContext } from "../subscriptionClientContext"; - -/** Class representing a Tenants. */ -export class Tenants { - private readonly client: SubscriptionClientContext; - - /** - * Create a Tenants. - * @param {SubscriptionClientContext} client Reference to the service client. - */ - constructor(client: SubscriptionClientContext) { - this.client = client; - } - - /** - * Gets the tenants for your account. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * Gets the tenants for your account. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "tenants", - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.TenantListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.TenantListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts index cb4d83071574..9bbebac95d39 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts @@ -17,12 +17,9 @@ import { SubscriptionClientContext } from "./subscriptionClientContext"; class SubscriptionClient extends SubscriptionClientContext { // Operation groups - subscriptions: operations.Subscriptions; - subscriptionOperation: operations.SubscriptionOperationOperations; - subscriptionFactory: operations.SubscriptionFactory; - subscriptionOperations: operations.SubscriptionOperations; + subscription: operations.Subscription; + subscriptionOperation: operations.SubscriptionOperation; operations: operations.Operations; - tenants: operations.Tenants; /** * Initializes a new instance of the SubscriptionClient class. @@ -31,12 +28,9 @@ class SubscriptionClient extends SubscriptionClientContext { */ constructor(credentials: msRest.ServiceClientCredentials, options?: Models.SubscriptionClientOptions) { super(credentials, options); - this.subscriptions = new operations.Subscriptions(this); - this.subscriptionOperation = new operations.SubscriptionOperationOperations(this); - this.subscriptionFactory = new operations.SubscriptionFactory(this); - this.subscriptionOperations = new operations.SubscriptionOperations(this); + this.subscription = new operations.Subscription(this); + this.subscriptionOperation = new operations.SubscriptionOperation(this); this.operations = new operations.Operations(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 6ecec40b99fb..2e1e1d05499d 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts @@ -17,6 +17,7 @@ const packageVersion = "2.0.0"; export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { credentials: msRest.ServiceClientCredentials; + apiVersion?: string; /** * Initializes a new instance of the SubscriptionClient class. @@ -31,23 +32,24 @@ export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { if (!options) { options = {}; } - if (!options.userAgent) { + if(!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); + this.apiVersion = '2019-10-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; this.requestContentType = "application/json; charset=utf-8"; this.credentials = credentials; - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { this.acceptLanguage = options.acceptLanguage; } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; } }