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..e57ebc12be19 100644 --- a/sdk/subscription/arm-subscriptions/README.md +++ b/sdk/subscription/arm-subscriptions/README.md @@ -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 subscriptionId = "testsubscriptionId"; + client.subscriptions.listLocations(subscriptionId).then((result) => { console.log("The result is:"); console.log(result); }); @@ -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..7c6fb83719c0 100644 --- a/sdk/subscription/arm-subscriptions/src/models/index.ts +++ b/sdk/subscription/arm-subscriptions/src/models/index.ts @@ -11,6 +11,120 @@ import * as msRest from "@azure/ms-rest-js"; export { BaseResource, CloudError }; +/** + * Location information. + */ +export interface Location { + /** + * 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.** + */ + 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 location name. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The display name of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly displayName?: string; + /** + * The latitude of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly latitude?: string; + /** + * The longitude of the location. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly longitude?: string; +} + +/** + * Subscription policies. + */ +export interface SubscriptionPolicies { + /** + * 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.** + */ + readonly locationPlacementId?: string; + /** + * The subscription quota ID. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly quotaId?: 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.** + */ + readonly spendingLimit?: SpendingLimit; +} + +/** + * Subscription information. + */ +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; +} + +/** + * Tenant Id information. + */ +export interface TenantIdDescription { + /** + * 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.** + */ + readonly id?: 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.** + */ + readonly tenantId?: string; +} + /** * Describes the format of Error response. */ @@ -25,6 +139,17 @@ export interface ErrorResponse { message?: string; } +/** + * Error response indicates that the service is not able to process the incoming request. The + * reason is provided in the error message. + */ +export interface ErrorResponseBody { + /** + * The details of the error. + */ + error?: ErrorResponse; +} + /** * The ID of the canceled subscription */ @@ -47,6 +172,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,6 +240,16 @@ export interface OperationListResult { nextLink?: string; } +/** + * Active Directory Principal who’ll get owner access on the new subscription. + */ +export interface AdPrincipal { + /** + * Object id of the Principal + */ + objectId: string; +} + /** * The created subscription object. */ @@ -116,13 +262,33 @@ export interface SubscriptionCreationResult { } /** - * Active Directory Principal who’ll get owner access on the new subscription. + * Subscription Creation Parameters required to create a new Azure subscription. */ -export interface AdPrincipal { +export interface SubscriptionCreationParameters { /** - * Object id of the Principal + * The display name of the subscription. */ - objectId: string; + 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. + */ + owners?: AdPrincipal[]; + /** + * 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; + /** + * Additional, untyped parameters to support custom subscription creation scenarios. + */ + additionalParameters?: { [propertyName: string]: any }; } /** @@ -133,10 +299,6 @@ 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 @@ -163,172 +325,113 @@ export interface ModernSubscriptionCreationParameters { } /** - * status of the subscription POST operation. + * The parameters required to create a new CSP subscription. */ -export interface SubscriptionOperation { +export interface ModernCspSubscriptionCreationParameters { /** - * 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 + * The friendly name of the subscription. */ - status?: string; + displayName: string; /** - * Status Detail of the pending subscription + * 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. */ - statusDetail?: string; -} - -/** - * A list of pending subscription operations. - */ -export interface SubscriptionOperationListResult { + skuId: string; /** - * A list of pending SubscriptionOperations + * Reseller ID, basically MPN Id. */ - value?: SubscriptionOperation[]; + resellerId?: string; } /** - * Subscription Creation Parameters required to create a new Azure subscription. + * Put subscription properties. */ -export interface SubscriptionCreationParameters { +export interface PutAliasRequestProperties { /** - * The display name of the subscription. + * The friendly name of the subscription. */ - displayName?: string; + displayName: 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. + * The workload type of the subscription. It can be either Production or DevTest. Possible values + * include: 'Production', 'DevTest' */ - owners?: AdPrincipal[]; + workloadType: WorkloadType; /** - * 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' + * Determines whether subscription is fieldLed, partnerLed or LegacyEA */ - offerType?: OfferType; + billingScope: string; /** - * Additional, untyped parameters to support custom subscription creation scenarios. + * This parameter can be used to create alias for existing subscription Id */ - additionalParameters?: { [propertyName: string]: any }; + subscriptionId?: string; } /** - * Location information. + * The parameters required to create a new subscription. */ -export interface Location { +export interface PutAliasRequest { /** - * 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.** - */ - 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 location name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The display name of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly displayName?: string; - /** - * The latitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Put alias request properties. */ - readonly latitude?: string; - /** - * The longitude of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly longitude?: string; + properties?: PutAliasRequestProperties; } /** - * Subscription policies. + * Put subscription creation result properties. */ -export interface SubscriptionPolicies { +export interface PutAliasResponseProperties { /** - * 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. + * Newly created subscription Id. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly locationPlacementId?: string; - /** - * The subscription quota ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly quotaId?: string; + readonly subscriptionId?: 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.** + * The provisioning state of the resource. Possible values include: 'Accepted', 'Succeeded', + * 'Failed' */ - readonly spendingLimit?: SpendingLimit; + provisioningState?: ProvisioningState; } /** - * Subscription information. + * Subscription Information with the alias. */ -export interface Subscription { +export interface PutAliasResponse extends BaseResource { /** - * The fully qualified ID for the subscription. For example, - * /subscriptions/00000000-0000-0000-0000-000000000000. + * Fully qualified ID for the alias resource. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly id?: string; /** - * The subscription ID. + * Alias ID. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly subscriptionId?: string; + readonly name?: string; /** - * The subscription display name. + * Resource type, Microsoft.Subscription/aliases. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly displayName?: string; + readonly type?: 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.** + * Put Alias response properties. */ - 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; + properties?: PutAliasResponseProperties; } /** - * Tenant Id information. + * The list of aliases. */ -export interface TenantIdDescription { +export interface PutAliasListResult { /** - * The fully qualified ID of the tenant. For example, - * /tenants/00000000-0000-0000-0000-000000000000. + * The list of alias. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly id?: string; + readonly value?: PutAliasResponse[]; /** - * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * The link (url) to the next page of results. * **NOTE: This property will not be serialized. It can only be populated by the server.** */ - readonly tenantId?: string; + readonly nextLink?: string; } /** @@ -338,6 +441,21 @@ export interface SubscriptionClientOptions extends AzureServiceClientOptions { baseUri?: string; } +/** + * Defines headers for CreateSubscriptionInEnrollmentAccount operation. + */ +export interface SubscriptionCreateSubscriptionInEnrollmentAccountHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + location: string; + /** + * The amount of delay to use while the status of the operation is checked. The value is + * expressed in seconds. + */ + retryAfter: string; +} + /** * Defines headers for Get operation. */ @@ -356,7 +474,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 +487,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,7 +498,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; + retryAfter: number; } /** @@ -415,6 +533,22 @@ export interface TenantListResult extends Array { nextLink: string; } +/** + * 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'; + /** * Defines values for OfferType. * Possible values include: 'MS-AZR-0017P', 'MS-AZR-0148P' @@ -424,25 +558,25 @@ 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' + * Defines values for WorkloadType. + * Possible values include: 'Production', 'DevTest' * @readonly * @enum {string} */ -export type SubscriptionState = 'Enabled' | 'Warned' | 'PastDue' | 'Disabled' | 'Deleted'; +export type WorkloadType = 'Production' | 'DevTest'; /** - * Defines values for SpendingLimit. - * Possible values include: 'On', 'Off', 'CurrentPeriodOff' + * Defines values for ProvisioningState. + * Possible values include: 'Accepted', 'Succeeded', 'Failed' * @readonly * @enum {string} */ -export type SpendingLimit = 'On' | 'Off' | 'CurrentPeriodOff'; +export type ProvisioningState = 'Accepted' | 'Succeeded' | 'Failed'; /** - * Contains response data for the cancel operation. + * Contains response data for the listLocations operation. */ -export type SubscriptionsCancelResponse = CanceledSubscriptionId & { +export type SubscriptionsListLocationsResponse = LocationListResult & { /** * The underlying HTTP response. */ @@ -455,14 +589,14 @@ export type SubscriptionsCancelResponse = CanceledSubscriptionId & { /** * The response body as parsed JSON or XML */ - parsedBody: CanceledSubscriptionId; + parsedBody: LocationListResult; }; }; /** - * Contains response data for the rename operation. + * Contains response data for the get operation. */ -export type SubscriptionsRenameResponse = RenamedSubscriptionId & { +export type SubscriptionsGetResponse = Subscription & { /** * The underlying HTTP response. */ @@ -475,14 +609,14 @@ export type SubscriptionsRenameResponse = RenamedSubscriptionId & { /** * The response body as parsed JSON or XML */ - parsedBody: RenamedSubscriptionId; + parsedBody: Subscription; }; }; /** - * Contains response data for the listLocations operation. + * Contains response data for the list operation. */ -export type SubscriptionsListLocationsResponse = LocationListResult & { +export type SubscriptionsListResponse = SubscriptionListResult & { /** * The underlying HTTP response. */ @@ -495,14 +629,14 @@ export type SubscriptionsListLocationsResponse = LocationListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: LocationListResult; + parsedBody: SubscriptionListResult; }; }; /** - * Contains response data for the get operation. + * Contains response data for the listNext operation. */ -export type SubscriptionsGetResponse = Subscription & { +export type SubscriptionsListNextResponse = SubscriptionListResult & { /** * The underlying HTTP response. */ @@ -515,14 +649,14 @@ export type SubscriptionsGetResponse = Subscription & { /** * The response body as parsed JSON or XML */ - parsedBody: Subscription; + parsedBody: SubscriptionListResult; }; }; /** * Contains response data for the list operation. */ -export type SubscriptionsListResponse = SubscriptionListResult & { +export type TenantsListResponse = TenantListResult & { /** * The underlying HTTP response. */ @@ -535,14 +669,14 @@ export type SubscriptionsListResponse = SubscriptionListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionListResult; + parsedBody: TenantListResult; }; }; /** * Contains response data for the listNext operation. */ -export type SubscriptionsListNextResponse = SubscriptionListResult & { +export type TenantsListNextResponse = TenantListResult & { /** * The underlying HTTP response. */ @@ -555,14 +689,14 @@ export type SubscriptionsListNextResponse = SubscriptionListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionListResult; + parsedBody: TenantListResult; }; }; /** - * Contains response data for the get operation. + * Contains response data for the createSubscriptionInEnrollmentAccount operation. */ -export type SubscriptionOperationGetResponse = SubscriptionCreationResult & SubscriptionOperationGetHeaders & { +export type SubscriptionCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionCreateSubscriptionInEnrollmentAccountHeaders & { /** * The underlying HTTP response. */ @@ -570,7 +704,7 @@ export type SubscriptionOperationGetResponse = SubscriptionCreationResult & Subs /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionOperationGetHeaders; + parsedHeaders: SubscriptionCreateSubscriptionInEnrollmentAccountHeaders; /** * The response body as text (string format) @@ -584,10 +718,70 @@ export type SubscriptionOperationGetResponse = SubscriptionCreationResult & Subs }; }; +/** + * Contains response data for the cancel operation. + */ +export type SubscriptionCancelResponse = 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. + */ +export type SubscriptionRenameResponse = RenamedSubscriptionId & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: RenamedSubscriptionId; + }; +}; + +/** + * Contains response data for the enable operation. + */ +export type SubscriptionEnableResponse = 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: EnabledSubscriptionId; + }; +}; + /** * Contains response data for the createSubscription operation. */ -export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionHeaders & { +export type SubscriptionCreateSubscriptionResponse = SubscriptionCreationResult & SubscriptionCreateSubscriptionHeaders & { /** * The underlying HTTP response. */ @@ -595,7 +789,7 @@ export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreation /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionHeaders; + parsedHeaders: SubscriptionCreateSubscriptionHeaders; /** * The response body as text (string format) @@ -610,9 +804,9 @@ export type SubscriptionFactoryCreateSubscriptionResponse = SubscriptionCreation }; /** - * Contains response data for the createSubscriptionInEnrollmentAccount operation. + * Contains response data for the createCspSubscription operation. */ -export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = SubscriptionCreationResult & SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders & { +export type SubscriptionCreateCspSubscriptionResponse = SubscriptionCreationResult & SubscriptionCreateCspSubscriptionHeaders & { /** * The underlying HTTP response. */ @@ -620,7 +814,7 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S /** * The parsed HTTP response headers. */ - parsedHeaders: SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders; + parsedHeaders: SubscriptionCreateCspSubscriptionHeaders; /** * The response body as text (string format) @@ -635,9 +829,9 @@ export type SubscriptionFactoryCreateSubscriptionInEnrollmentAccountResponse = S }; /** - * Contains response data for the list operation. + * Contains response data for the createAlias operation. */ -export type SubscriptionOperationsListResponse = SubscriptionOperationListResult & { +export type SubscriptionCreateAliasResponse = PutAliasResponse & { /** * The underlying HTTP response. */ @@ -650,14 +844,14 @@ export type SubscriptionOperationsListResponse = SubscriptionOperationListResult /** * The response body as parsed JSON or XML */ - parsedBody: SubscriptionOperationListResult; + parsedBody: PutAliasResponse; }; }; /** - * Contains response data for the list operation. + * Contains response data for the getAlias operation. */ -export type OperationsListResponse = OperationListResult & { +export type SubscriptionGetAliasResponse = PutAliasResponse & { /** * The underlying HTTP response. */ @@ -670,14 +864,14 @@ export type OperationsListResponse = OperationListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: OperationListResult; + parsedBody: PutAliasResponse; }; }; /** - * Contains response data for the list operation. + * Contains response data for the listAlias operation. */ -export type TenantsListResponse = TenantListResult & { +export type SubscriptionListAliasResponse = PutAliasListResult & { /** * The underlying HTTP response. */ @@ -690,14 +884,14 @@ export type TenantsListResponse = TenantListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: TenantListResult; + parsedBody: PutAliasListResult; }; }; /** - * Contains response data for the listNext operation. + * Contains response data for the beginCreateAlias operation. */ -export type TenantsListNextResponse = TenantListResult & { +export type SubscriptionBeginCreateAliasResponse = PutAliasResponse & { /** * The underlying HTTP response. */ @@ -710,6 +904,51 @@ export type TenantsListNextResponse = TenantListResult & { /** * The response body as parsed JSON or XML */ - parsedBody: TenantListResult; + parsedBody: PutAliasResponse; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type SubscriptionOperationGetResponse = SubscriptionCreationResult & SubscriptionOperationGetHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: SubscriptionOperationGetHeaders; + + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SubscriptionCreationResult; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type OperationsListResponse = OperationListResult & { + /** + * 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: OperationListResult; }; }; diff --git a/sdk/subscription/arm-subscriptions/src/models/mappers.ts b/sdk/subscription/arm-subscriptions/src/models/mappers.ts index ec04b137a470..cab4eedafa5d 100644 --- a/sdk/subscription/arm-subscriptions/src/models/mappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/mappers.ts @@ -12,6 +12,176 @@ import * as msRest from "@azure/ms-rest-js"; export const CloudError = CloudErrorMapper; export const BaseResource = BaseResourceMapper; +export const Location: msRest.CompositeMapper = { + serializedName: "Location", + type: { + name: "Composite", + className: "Location", + 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, + serializedName: "displayName", + type: { + name: "String" + } + }, + latitude: { + readOnly: true, + serializedName: "latitude", + type: { + name: "String" + } + }, + longitude: { + readOnly: true, + serializedName: "longitude", + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionPolicies: msRest.CompositeMapper = { + serializedName: "SubscriptionPolicies", + type: { + name: "Composite", + className: "SubscriptionPolicies", + modelProperties: { + locationPlacementId: { + readOnly: true, + serializedName: "locationPlacementId", + type: { + name: "String" + } + }, + quotaId: { + readOnly: true, + serializedName: "quotaId", + type: { + name: "String" + } + }, + spendingLimit: { + readOnly: true, + serializedName: "spendingLimit", + type: { + name: "Enum", + allowedValues: [ + "On", + "Off", + "CurrentPeriodOff" + ] + } + } + } + } +}; + +export const Subscription: msRest.CompositeMapper = { + serializedName: "Subscription", + type: { + name: "Composite", + className: "Subscription", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + subscriptionId: { + readOnly: true, + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + displayName: { + readOnly: true, + serializedName: "displayName", + type: { + name: "String" + } + }, + state: { + readOnly: true, + serializedName: "state", + type: { + name: "Enum", + allowedValues: [ + "Enabled", + "Warned", + "PastDue", + "Disabled", + "Deleted" + ] + } + }, + subscriptionPolicies: { + serializedName: "subscriptionPolicies", + type: { + name: "Composite", + className: "SubscriptionPolicies" + } + }, + authorizationSource: { + serializedName: "authorizationSource", + type: { + name: "String" + } + } + } + } +}; + +export const TenantIdDescription: msRest.CompositeMapper = { + serializedName: "TenantIdDescription", + type: { + name: "Composite", + className: "TenantIdDescription", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + tenantId: { + readOnly: true, + serializedName: "tenantId", + type: { + name: "String" + } + } + } + } +}; + export const ErrorResponse: msRest.CompositeMapper = { serializedName: "ErrorResponse", type: { @@ -34,6 +204,23 @@ export const ErrorResponse: msRest.CompositeMapper = { } }; +export const ErrorResponseBody: msRest.CompositeMapper = { + serializedName: "ErrorResponseBody", + type: { + name: "Composite", + className: "ErrorResponseBody", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + export const CanceledSubscriptionId: msRest.CompositeMapper = { serializedName: "CanceledSubscriptionId", type: { @@ -68,6 +255,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,6 +367,23 @@ export const OperationListResult: msRest.CompositeMapper = { } }; +export const AdPrincipal: msRest.CompositeMapper = { + serializedName: "AdPrincipal", + type: { + name: "Composite", + className: "AdPrincipal", + modelProperties: { + objectId: { + required: true, + serializedName: "objectId", + type: { + name: "String" + } + } + } + } +}; + export const SubscriptionCreationResult: msRest.CompositeMapper = { serializedName: "SubscriptionCreationResult", type: { @@ -179,18 +400,52 @@ export const SubscriptionCreationResult: msRest.CompositeMapper = { } }; -export const AdPrincipal: msRest.CompositeMapper = { - serializedName: "AdPrincipal", +export const SubscriptionCreationParameters: msRest.CompositeMapper = { + serializedName: "SubscriptionCreationParameters", type: { name: "Composite", - className: "AdPrincipal", + className: "SubscriptionCreationParameters", modelProperties: { - objectId: { - required: true, - serializedName: "objectId", + displayName: { + serializedName: "displayName", type: { name: "String" } + }, + managementGroupId: { + serializedName: "managementGroupId", + type: { + name: "String" + } + }, + owners: { + serializedName: "owners", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AdPrincipal" + } + } + } + }, + offerType: { + serializedName: "offerType", + type: { + name: "String" + } + }, + additionalParameters: { + serializedName: "additionalParameters", + type: { + name: "Dictionary", + value: { + type: { + name: "Object" + } + } + } } } } @@ -209,13 +464,6 @@ export const ModernSubscriptionCreationParameters: msRest.CompositeMapper = { name: "String" } }, - billingProfileId: { - required: true, - serializedName: "billingProfileId", - type: { - name: "String" - } - }, skuId: { required: true, serializedName: "skuId", @@ -257,27 +505,28 @@ export const ModernSubscriptionCreationParameters: msRest.CompositeMapper = { } }; -export const SubscriptionOperation: msRest.CompositeMapper = { - serializedName: "SubscriptionOperation", +export const ModernCspSubscriptionCreationParameters: msRest.CompositeMapper = { + serializedName: "ModernCspSubscriptionCreationParameters", type: { name: "Composite", - className: "SubscriptionOperation", + className: "ModernCspSubscriptionCreationParameters", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + displayName: { + required: true, + serializedName: "displayName", type: { name: "String" } }, - status: { - serializedName: "status", + skuId: { + required: true, + serializedName: "skuId", type: { name: "String" } }, - statusDetail: { - serializedName: "statusDetail", + resellerId: { + serializedName: "resellerId", type: { name: "String" } @@ -286,166 +535,88 @@ 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", +export const PutAliasRequestProperties: msRest.CompositeMapper = { + serializedName: "PutAliasRequestProperties", type: { name: "Composite", - className: "SubscriptionCreationParameters", + className: "PutAliasRequestProperties", modelProperties: { displayName: { + required: true, serializedName: "displayName", type: { name: "String" } }, - owners: { - serializedName: "owners", + workloadType: { + required: true, + serializedName: "workloadType", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AdPrincipal" - } - } + name: "String" } }, - offerType: { - serializedName: "offerType", + billingScope: { + required: true, + serializedName: "billingScope", type: { name: "String" } }, - additionalParameters: { - serializedName: "additionalParameters", + subscriptionId: { + serializedName: "subscriptionId", type: { - name: "Dictionary", - value: { - type: { - name: "Object" - } - } + name: "String" } } } } }; -export const Location: msRest.CompositeMapper = { - serializedName: "Location", +export const PutAliasRequest: msRest.CompositeMapper = { + serializedName: "PutAliasRequest", type: { name: "Composite", - className: "Location", + className: "PutAliasRequest", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - subscriptionId: { - readOnly: true, - serializedName: "subscriptionId", + properties: { + serializedName: "properties", type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - displayName: { - readOnly: true, - serializedName: "displayName", - type: { - name: "String" - } - }, - latitude: { - readOnly: true, - serializedName: "latitude", - type: { - name: "String" - } - }, - longitude: { - readOnly: true, - serializedName: "longitude", - type: { - name: "String" + name: "Composite", + className: "PutAliasRequestProperties" } } } } }; -export const SubscriptionPolicies: msRest.CompositeMapper = { - serializedName: "SubscriptionPolicies", +export const PutAliasResponseProperties: msRest.CompositeMapper = { + serializedName: "PutAliasResponseProperties", type: { name: "Composite", - className: "SubscriptionPolicies", + className: "PutAliasResponseProperties", modelProperties: { - locationPlacementId: { + subscriptionId: { readOnly: true, - serializedName: "locationPlacementId", + serializedName: "subscriptionId", type: { name: "String" } }, - quotaId: { - readOnly: true, - serializedName: "quotaId", + provisioningState: { + serializedName: "provisioningState", type: { name: "String" } - }, - spendingLimit: { - readOnly: true, - serializedName: "spendingLimit", - type: { - name: "Enum", - allowedValues: [ - "On", - "Off", - "CurrentPeriodOff" - ] - } } } } }; -export const Subscription: msRest.CompositeMapper = { - serializedName: "Subscription", +export const PutAliasResponse: msRest.CompositeMapper = { + serializedName: "PutAliasResponse", type: { name: "Composite", - className: "Subscription", + className: "PutAliasResponse", modelProperties: { id: { readOnly: true, @@ -454,43 +625,53 @@ export const Subscription: msRest.CompositeMapper = { name: "String" } }, - subscriptionId: { + name: { readOnly: true, - serializedName: "subscriptionId", + serializedName: "name", type: { name: "String" } }, - displayName: { + type: { readOnly: true, - serializedName: "displayName", + serializedName: "type", type: { name: "String" } }, - state: { - readOnly: true, - serializedName: "state", + properties: { + serializedName: "properties", type: { - name: "Enum", - allowedValues: [ - "Enabled", - "Warned", - "PastDue", - "Disabled", - "Deleted" - ] + name: "Composite", + className: "PutAliasResponseProperties" } - }, - subscriptionPolicies: { - serializedName: "subscriptionPolicies", + } + } + } +}; + +export const PutAliasListResult: msRest.CompositeMapper = { + serializedName: "PutAliasListResult", + type: { + name: "Composite", + className: "PutAliasListResult", + modelProperties: { + value: { + readOnly: true, + serializedName: "value", type: { - name: "Composite", - className: "SubscriptionPolicies" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PutAliasResponse" + } + } } }, - authorizationSource: { - serializedName: "authorizationSource", + nextLink: { + readOnly: true, + serializedName: "nextLink", type: { name: "String" } @@ -499,22 +680,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 +724,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 +746,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,7 +761,7 @@ export const SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders: ms retryAfter: { serializedName: "retry-after", 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..df31dffc1885 100644 --- a/sdk/subscription/arm-subscriptions/src/models/parameters.ts +++ b/sdk/subscription/arm-subscriptions/src/models/parameters.ts @@ -20,13 +20,23 @@ export const acceptLanguage: msRest.OperationParameter = { } } }; +export const aliasName: msRest.OperationURLParameter = { + parameterPath: "aliasName", + mapper: { + required: true, + serializedName: "aliasName", + type: { + name: "String" + } + } +}; export const apiVersion0: msRest.OperationQueryParameter = { parameterPath: "apiVersion", mapper: { required: true, isConstant: true, serializedName: "api-version", - defaultValue: '2019-03-01-preview', + defaultValue: '2016-06-01', type: { name: "String" } @@ -38,41 +48,37 @@ export const apiVersion1: msRest.OperationQueryParameter = { required: true, isConstant: true, serializedName: "api-version", - defaultValue: '2016-06-01', + defaultValue: '2019-10-01-preview', 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" } diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts deleted file mode 100644 index b057f11f94b3..000000000000 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionFactoryMappers.ts +++ /dev/null @@ -1,17 +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 { - AdPrincipal, - ErrorResponse, - ModernSubscriptionCreationParameters, - SubscriptionCreationParameters, - SubscriptionCreationResult, - SubscriptionFactoryCreateSubscriptionHeaders, - SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders -} 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 index e2ed59bfb39f..730eef5bc7c4 100644 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/subscriptionOperationsMappers.ts @@ -7,7 +7,24 @@ */ export { + AdPrincipal, + BaseResource, + CanceledSubscriptionId, + EnabledSubscriptionId, ErrorResponse, - SubscriptionOperation, - SubscriptionOperationListResult + ErrorResponseBody, + ModernCspSubscriptionCreationParameters, + ModernSubscriptionCreationParameters, + PutAliasListResult, + PutAliasRequest, + PutAliasRequestProperties, + PutAliasResponse, + PutAliasResponseProperties, + RenamedSubscriptionId, + SubscriptionCreateCspSubscriptionHeaders, + SubscriptionCreateSubscriptionHeaders, + SubscriptionCreateSubscriptionInEnrollmentAccountHeaders, + SubscriptionCreationParameters, + SubscriptionCreationResult, + SubscriptionName } from "../models/mappers"; diff --git a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts b/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts index 5c87e105cba4..496058988f35 100644 --- a/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts +++ b/sdk/subscription/arm-subscriptions/src/models/subscriptionsMappers.ts @@ -7,14 +7,10 @@ */ export { - CanceledSubscriptionId, CloudError, - ErrorResponse, Location, LocationListResult, - RenamedSubscriptionId, Subscription, SubscriptionListResult, - SubscriptionName, SubscriptionPolicies } 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..c20c1b377109 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/index.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/index.ts @@ -9,8 +9,7 @@ */ export * from "./subscriptions"; -export * from "./subscriptionOperationOperations"; -export * from "./subscriptionFactory"; +export * from "./tenants"; export * from "./subscriptionOperations"; +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..a3eb16df3104 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.apiVersion1 ], headerParameters: [ Parameters.acceptLanguage 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 90% rename from sdk/subscription/arm-subscriptions/src/operations/subscriptionOperationOperations.ts rename to sdk/subscription/arm-subscriptions/src/operations/subscriptionOperation.ts index 4dd1d8d3e0e3..3625e7ac8c31 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.apiVersion1 ], headerParameters: [ Parameters.acceptLanguage @@ -81,7 +81,8 @@ const getOperationSpec: msRest.OperationSpec = { headersMapper: Mappers.SubscriptionOperationGetHeaders }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.CloudError, + headersMapper: Mappers.SubscriptionOperationGetHeaders } }, serializer diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts index e898453ec339..c29e89348bd4 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/subscriptionOperations.ts @@ -9,6 +9,7 @@ */ 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/subscriptionOperationsMappers"; import * as Parameters from "../models/parameters"; @@ -27,44 +28,383 @@ export class SubscriptionOperations { } /** - * Lists all of the available pending Microsoft.Subscription API operations. + * 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 + * @returns Promise */ - list(options?: msRest.RequestOptionsBase): 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; + } + + /** + * Create Alias Subscription. + * @param aliasName Alias Name + * @param body + * @param [options] The optional parameters + * @returns Promise + */ + createAlias(aliasName: string, body: Models.PutAliasRequest, options?: msRest.RequestOptionsBase): Promise { + return this.beginCreateAlias(aliasName,body,options) + .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + } + + /** + * Get Alias Subscription. + * @param aliasName Alias Name + * @param [options] The optional parameters + * @returns Promise + */ + getAlias(aliasName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param aliasName Alias Name + * @param callback The callback + */ + getAlias(aliasName: string, callback: msRest.ServiceCallback): void; + /** + * @param aliasName Alias Name + * @param options The optional parameters + * @param callback The callback + */ + getAlias(aliasName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getAlias(aliasName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + aliasName, + options + }, + getAliasOperationSpec, + callback) as Promise; + } + + /** + * Delete Alias. + * @param aliasName Alias Name + * @param [options] The optional parameters + * @returns Promise + */ + deleteAlias(aliasName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param aliasName Alias Name + * @param callback The callback + */ + deleteAlias(aliasName: string, callback: msRest.ServiceCallback): void; + /** + * @param aliasName Alias Name + * @param options The optional parameters + * @param callback The callback + */ + deleteAlias(aliasName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteAlias(aliasName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + aliasName, + options + }, + deleteAliasOperationSpec, + callback); + } + + /** + * Get Alias Subscription. + * @param [options] The optional parameters + * @returns Promise + */ + listAlias(options?: msRest.RequestOptionsBase): Promise; /** * @param callback The callback */ - list(callback: msRest.ServiceCallback): void; + listAlias(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 { + listAlias(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAlias(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { options }, - listOperationSpec, - callback) as Promise; + listAliasOperationSpec, + callback) 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); + } + + /** + * Create Alias Subscription. + * @param aliasName Alias Name + * @param body + * @param [options] The optional parameters + * @returns Promise + */ + beginCreateAlias(aliasName: string, body: Models.PutAliasRequest, options?: msRest.RequestOptionsBase): Promise { + return this.client.sendLRORequest( + { + aliasName, + body, + options + }, + beginCreateAliasOperationSpec, + options); } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Subscription/subscriptionOperations", +const cancelOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel", + urlParameters: [ + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion1 + ], + 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.apiVersion1 + ], + 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.apiVersion3 + Parameters.apiVersion1 ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { - bodyMapper: Mappers.SubscriptionOperationListResult + bodyMapper: Mappers.EnabledSubscriptionId }, default: { bodyMapper: Mappers.ErrorResponse @@ -72,3 +412,209 @@ const listOperationSpec: msRest.OperationSpec = { }, serializer }; + +const getAliasOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Subscription/aliases/{aliasName}", + urlParameters: [ + Parameters.aliasName + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PutAliasResponse + }, + default: { + bodyMapper: Mappers.ErrorResponseBody + } + }, + serializer +}; + +const deleteAliasOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "providers/Microsoft.Subscription/aliases/{aliasName}", + urlParameters: [ + Parameters.aliasName + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponseBody + } + }, + serializer +}; + +const listAliasOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Subscription/aliases", + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.PutAliasListResult + }, + default: { + bodyMapper: Mappers.ErrorResponseBody + } + }, + serializer +}; + +const beginCreateSubscriptionInEnrollmentAccountOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription", + urlParameters: [ + Parameters.enrollmentAccountName + ], + queryParameters: [ + Parameters.apiVersion1 + ], + 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, + headersMapper: Mappers.SubscriptionCreateSubscriptionInEnrollmentAccountHeaders + } + }, + 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.apiVersion1 + ], + 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, + headersMapper: Mappers.SubscriptionCreateSubscriptionHeaders + } + }, + 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.apiVersion1 + ], + 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, + headersMapper: Mappers.SubscriptionCreateCspSubscriptionHeaders + } + }, + serializer +}; + +const beginCreateAliasOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "providers/Microsoft.Subscription/aliases/{aliasName}", + urlParameters: [ + Parameters.aliasName + ], + queryParameters: [ + Parameters.apiVersion1 + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "body", + mapper: { + ...Mappers.PutAliasRequest, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.PutAliasResponse + }, + 201: { + bodyMapper: Mappers.PutAliasResponse + }, + default: { + bodyMapper: Mappers.ErrorResponseBody + } + }, + serializer +}; diff --git a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts b/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts index f36dbcf2e2b8..bc8b22a21b5d 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/subscriptions.ts @@ -26,66 +26,6 @@ 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; - } - /** * This operation provides all the locations that are available for resource providers; however, * each resource provider may support a subset of this list. @@ -199,59 +139,6 @@ 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 listLocationsOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/locations", @@ -259,7 +146,7 @@ const listLocationsOperationSpec: msRest.OperationSpec = { Parameters.subscriptionId ], queryParameters: [ - Parameters.apiVersion1 + Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage @@ -282,7 +169,7 @@ const getOperationSpec: msRest.OperationSpec = { Parameters.subscriptionId ], queryParameters: [ - Parameters.apiVersion1 + Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage @@ -302,7 +189,7 @@ const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions", queryParameters: [ - Parameters.apiVersion1 + Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage diff --git a/sdk/subscription/arm-subscriptions/src/operations/tenants.ts b/sdk/subscription/arm-subscriptions/src/operations/tenants.ts index cd4102be9ebf..2c8fe0e433ec 100644 --- a/sdk/subscription/arm-subscriptions/src/operations/tenants.ts +++ b/sdk/subscription/arm-subscriptions/src/operations/tenants.ts @@ -85,7 +85,7 @@ const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "tenants", queryParameters: [ - Parameters.apiVersion1 + Parameters.apiVersion0 ], headerParameters: [ Parameters.acceptLanguage diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts index cb4d83071574..bc08d3f4ce11 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClient.ts @@ -18,11 +18,10 @@ import { SubscriptionClientContext } from "./subscriptionClientContext"; class SubscriptionClient extends SubscriptionClientContext { // Operation groups subscriptions: operations.Subscriptions; - subscriptionOperation: operations.SubscriptionOperationOperations; - subscriptionFactory: operations.SubscriptionFactory; - subscriptionOperations: operations.SubscriptionOperations; - operations: operations.Operations; tenants: operations.Tenants; + subscription: operations.SubscriptionOperations; + subscriptionOperation: operations.SubscriptionOperation; + operations: operations.Operations; /** * Initializes a new instance of the SubscriptionClient class. @@ -32,11 +31,10 @@ 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.operations = new operations.Operations(this); this.tenants = new operations.Tenants(this); + this.subscription = new operations.SubscriptionOperations(this); + this.subscriptionOperation = new operations.SubscriptionOperation(this); + this.operations = new operations.Operations(this); } } diff --git a/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts b/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts index 6ecec40b99fb..393212e111b5 100644 --- a/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts +++ b/sdk/subscription/arm-subscriptions/src/subscriptionClientContext.ts @@ -31,7 +31,7 @@ export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { if (!options) { options = {}; } - if (!options.userAgent) { + if(!options.userAgent) { const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } @@ -44,10 +44,10 @@ export class SubscriptionClientContext extends msRestAzure.AzureServiceClient { 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; } }