'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var coreClient = require('@azure/core-client'); var coreRestPipeline = require('@azure/core-rest-pipeline'); var tslib = require('tslib'); var coreLro = require('@azure/core-lro'); function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n["default"] = e; return Object.freeze(n); } var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient); var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline); /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ const pageMap = new WeakMap(); /** * Given a result page from a pageable operation, returns a * continuation token that can be used to begin paging from * that point later. * @param page A result object from calling .byPage() on a paged operation. * @returns The continuation token that can be passed into byPage(). */ function getContinuationToken(page) { var _a; if (typeof page !== "object" || page === null) { return undefined; } return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken; } function setContinuationToken(page, continuationToken) { var _a; if (typeof page !== "object" || page === null || !continuationToken) { return; } const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {}; pageInfo.continuationToken = continuationToken; pageMap.set(page, pageInfo); } /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /** Known values of {@link Workload} that the service accepts. */ exports.KnownWorkload = void 0; (function (KnownWorkload) { /** Production */ KnownWorkload["Production"] = "Production"; /** DevTest */ KnownWorkload["DevTest"] = "DevTest"; })(exports.KnownWorkload || (exports.KnownWorkload = {})); /** Known values of {@link ProvisioningState} that the service accepts. */ exports.KnownProvisioningState = void 0; (function (KnownProvisioningState) { /** Accepted */ KnownProvisioningState["Accepted"] = "Accepted"; /** Succeeded */ KnownProvisioningState["Succeeded"] = "Succeeded"; /** Failed */ KnownProvisioningState["Failed"] = "Failed"; })(exports.KnownProvisioningState || (exports.KnownProvisioningState = {})); /** Known values of {@link AcceptOwnership} that the service accepts. */ exports.KnownAcceptOwnership = void 0; (function (KnownAcceptOwnership) { /** Pending */ KnownAcceptOwnership["Pending"] = "Pending"; /** Completed */ KnownAcceptOwnership["Completed"] = "Completed"; /** Expired */ KnownAcceptOwnership["Expired"] = "Expired"; })(exports.KnownAcceptOwnership || (exports.KnownAcceptOwnership = {})); /** Known values of {@link CreatedByType} that the service accepts. */ exports.KnownCreatedByType = void 0; (function (KnownCreatedByType) { /** User */ KnownCreatedByType["User"] = "User"; /** Application */ KnownCreatedByType["Application"] = "Application"; /** ManagedIdentity */ KnownCreatedByType["ManagedIdentity"] = "ManagedIdentity"; /** Key */ KnownCreatedByType["Key"] = "Key"; })(exports.KnownCreatedByType || (exports.KnownCreatedByType = {})); /** Known values of {@link Provisioning} that the service accepts. */ exports.KnownProvisioning = void 0; (function (KnownProvisioning) { /** Pending */ KnownProvisioning["Pending"] = "Pending"; /** Accepted */ KnownProvisioning["Accepted"] = "Accepted"; /** Succeeded */ KnownProvisioning["Succeeded"] = "Succeeded"; })(exports.KnownProvisioning || (exports.KnownProvisioning = {})); /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ const LocationListResult = { type: { name: "Composite", className: "LocationListResult", modelProperties: { value: { serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", className: "Location" } } } } } } }; const Location = { type: { name: "Composite", className: "Location", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } }, name: { serializedName: "name", readOnly: true, type: { name: "String" } }, displayName: { serializedName: "displayName", readOnly: true, type: { name: "String" } }, latitude: { serializedName: "latitude", readOnly: true, type: { name: "String" } }, longitude: { serializedName: "longitude", readOnly: true, type: { name: "String" } } } } }; const Subscription = { type: { name: "Composite", className: "Subscription", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } }, displayName: { serializedName: "displayName", readOnly: true, type: { name: "String" } }, state: { serializedName: "state", readOnly: true, type: { name: "Enum", allowedValues: ["Enabled", "Warned", "PastDue", "Disabled", "Deleted"] } }, tenantId: { serializedName: "tenantId", readOnly: true, type: { name: "String" } }, tags: { serializedName: "tags", type: { name: "Dictionary", value: { type: { name: "String" } } } }, subscriptionPolicies: { serializedName: "subscriptionPolicies", type: { name: "Composite", className: "SubscriptionPolicies" } }, authorizationSource: { serializedName: "authorizationSource", type: { name: "String" } } } } }; const SubscriptionPolicies = { type: { name: "Composite", className: "SubscriptionPolicies", modelProperties: { locationPlacementId: { serializedName: "locationPlacementId", readOnly: true, type: { name: "String" } }, quotaId: { serializedName: "quotaId", readOnly: true, type: { name: "String" } }, spendingLimit: { serializedName: "spendingLimit", readOnly: true, type: { name: "Enum", allowedValues: ["On", "Off", "CurrentPeriodOff"] } } } } }; const SubscriptionListResult = { type: { name: "Composite", className: "SubscriptionListResult", modelProperties: { value: { serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", className: "Subscription" } } } }, nextLink: { serializedName: "nextLink", type: { name: "String" } } } } }; const TenantListResult = { type: { name: "Composite", className: "TenantListResult", modelProperties: { value: { serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", className: "TenantIdDescription" } } } }, nextLink: { serializedName: "nextLink", required: true, type: { name: "String" } } } } }; const TenantIdDescription = { type: { name: "Composite", className: "TenantIdDescription", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, tenantId: { serializedName: "tenantId", readOnly: true, type: { name: "String" } }, tenantCategory: { serializedName: "tenantCategory", readOnly: true, type: { name: "String" } }, country: { serializedName: "country", readOnly: true, type: { name: "String" } }, countryCode: { serializedName: "countryCode", readOnly: true, type: { name: "String" } }, displayName: { serializedName: "displayName", readOnly: true, type: { name: "String" } }, domains: { serializedName: "domains", readOnly: true, type: { name: "String" } }, defaultDomain: { serializedName: "defaultDomain", readOnly: true, type: { name: "String" } }, tenantType: { serializedName: "tenantType", readOnly: true, type: { name: "String" } } } } }; const CanceledSubscriptionId = { type: { name: "Composite", className: "CanceledSubscriptionId", modelProperties: { subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } } } } }; const ErrorResponseBody = { type: { name: "Composite", className: "ErrorResponseBody", modelProperties: { error: { serializedName: "error", type: { name: "Composite", className: "ErrorResponse" } }, code: { serializedName: "code", type: { name: "String" } }, message: { serializedName: "message", type: { name: "String" } } } } }; const ErrorResponse = { type: { name: "Composite", className: "ErrorResponse", modelProperties: { code: { serializedName: "code", type: { name: "String" } }, message: { serializedName: "message", type: { name: "String" } } } } }; const SubscriptionName = { type: { name: "Composite", className: "SubscriptionName", modelProperties: { subscriptionName: { serializedName: "subscriptionName", type: { name: "String" } } } } }; const RenamedSubscriptionId = { type: { name: "Composite", className: "RenamedSubscriptionId", modelProperties: { subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } } } } }; const EnabledSubscriptionId = { type: { name: "Composite", className: "EnabledSubscriptionId", modelProperties: { subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } } } } }; const OperationListResult = { type: { name: "Composite", className: "OperationListResult", modelProperties: { value: { serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", className: "Operation" } } } }, nextLink: { serializedName: "nextLink", type: { name: "String" } } } } }; const Operation = { type: { name: "Composite", className: "Operation", modelProperties: { name: { serializedName: "name", type: { name: "String" } }, isDataAction: { serializedName: "isDataAction", type: { name: "Boolean" } }, display: { serializedName: "display", type: { name: "Composite", className: "OperationDisplay" } } } } }; const OperationDisplay = { type: { name: "Composite", className: "OperationDisplay", modelProperties: { provider: { serializedName: "provider", type: { name: "String" } }, resource: { serializedName: "resource", type: { name: "String" } }, operation: { serializedName: "operation", type: { name: "String" } }, description: { serializedName: "description", type: { name: "String" } } } } }; const PutAliasRequest = { type: { name: "Composite", className: "PutAliasRequest", modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", className: "PutAliasRequestProperties" } } } } }; const PutAliasRequestProperties = { type: { name: "Composite", className: "PutAliasRequestProperties", modelProperties: { displayName: { serializedName: "displayName", type: { name: "String" } }, workload: { serializedName: "workload", type: { name: "String" } }, billingScope: { serializedName: "billingScope", type: { name: "String" } }, subscriptionId: { serializedName: "subscriptionId", type: { name: "String" } }, resellerId: { serializedName: "resellerId", type: { name: "String" } }, additionalProperties: { serializedName: "additionalProperties", type: { name: "Composite", className: "PutAliasRequestAdditionalProperties" } } } } }; const PutAliasRequestAdditionalProperties = { type: { name: "Composite", className: "PutAliasRequestAdditionalProperties", modelProperties: { managementGroupId: { serializedName: "managementGroupId", type: { name: "String" } }, subscriptionTenantId: { serializedName: "subscriptionTenantId", type: { name: "String" } }, subscriptionOwnerId: { serializedName: "subscriptionOwnerId", type: { name: "String" } }, tags: { serializedName: "tags", type: { name: "Dictionary", value: { type: { name: "String" } } } } } } }; const SubscriptionAliasResponse = { type: { name: "Composite", className: "SubscriptionAliasResponse", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, name: { serializedName: "name", readOnly: true, type: { name: "String" } }, type: { serializedName: "type", readOnly: true, type: { name: "String" } }, properties: { serializedName: "properties", type: { name: "Composite", className: "SubscriptionAliasResponseProperties" } }, systemData: { serializedName: "systemData", type: { name: "Composite", className: "SystemData" } } } } }; const SubscriptionAliasResponseProperties = { type: { name: "Composite", className: "SubscriptionAliasResponseProperties", modelProperties: { subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } }, displayName: { serializedName: "displayName", type: { name: "String" } }, provisioningState: { serializedName: "provisioningState", type: { name: "String" } }, acceptOwnershipUrl: { serializedName: "acceptOwnershipUrl", readOnly: true, type: { name: "String" } }, acceptOwnershipState: { serializedName: "acceptOwnershipState", readOnly: true, type: { name: "String" } }, billingScope: { serializedName: "billingScope", type: { name: "String" } }, workload: { serializedName: "workload", type: { name: "String" } }, resellerId: { serializedName: "resellerId", type: { name: "String" } }, subscriptionOwnerId: { serializedName: "subscriptionOwnerId", type: { name: "String" } }, managementGroupId: { serializedName: "managementGroupId", type: { name: "String" } }, createdTime: { serializedName: "createdTime", type: { name: "String" } }, tags: { serializedName: "tags", type: { name: "Dictionary", value: { type: { name: "String" } } } } } } }; const SystemData = { type: { name: "Composite", className: "SystemData", modelProperties: { createdBy: { serializedName: "createdBy", type: { name: "String" } }, createdByType: { serializedName: "createdByType", type: { name: "String" } }, createdAt: { serializedName: "createdAt", type: { name: "DateTime" } }, lastModifiedBy: { serializedName: "lastModifiedBy", type: { name: "String" } }, lastModifiedByType: { serializedName: "lastModifiedByType", type: { name: "String" } }, lastModifiedAt: { serializedName: "lastModifiedAt", type: { name: "DateTime" } } } } }; const SubscriptionAliasListResult = { type: { name: "Composite", className: "SubscriptionAliasListResult", modelProperties: { value: { serializedName: "value", readOnly: true, type: { name: "Sequence", element: { type: { name: "Composite", className: "SubscriptionAliasResponse" } } } }, nextLink: { serializedName: "nextLink", readOnly: true, type: { name: "String" } } } } }; const AcceptOwnershipRequest = { type: { name: "Composite", className: "AcceptOwnershipRequest", modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", className: "AcceptOwnershipRequestProperties" } } } } }; const AcceptOwnershipRequestProperties = { type: { name: "Composite", className: "AcceptOwnershipRequestProperties", modelProperties: { displayName: { serializedName: "displayName", required: true, type: { name: "String" } }, managementGroupId: { serializedName: "managementGroupId", type: { name: "String" } }, tags: { serializedName: "tags", type: { name: "Dictionary", value: { type: { name: "String" } } } } } } }; const AcceptOwnershipStatusResponse = { type: { name: "Composite", className: "AcceptOwnershipStatusResponse", modelProperties: { subscriptionId: { serializedName: "subscriptionId", readOnly: true, type: { name: "String" } }, acceptOwnershipState: { serializedName: "acceptOwnershipState", readOnly: true, type: { name: "String" } }, provisioningState: { serializedName: "provisioningState", readOnly: true, type: { name: "String" } }, billingOwner: { serializedName: "billingOwner", readOnly: true, type: { name: "String" } }, subscriptionTenantId: { serializedName: "subscriptionTenantId", type: { name: "String" } }, displayName: { serializedName: "displayName", type: { name: "String" } }, tags: { serializedName: "tags", type: { name: "Dictionary", value: { type: { name: "String" } } } } } } }; const PutTenantPolicyRequestProperties = { type: { name: "Composite", className: "PutTenantPolicyRequestProperties", modelProperties: { blockSubscriptionsLeavingTenant: { serializedName: "blockSubscriptionsLeavingTenant", type: { name: "Boolean" } }, blockSubscriptionsIntoTenant: { serializedName: "blockSubscriptionsIntoTenant", type: { name: "Boolean" } }, exemptedPrincipals: { serializedName: "exemptedPrincipals", type: { name: "Sequence", element: { type: { name: "Uuid" } } } } } } }; const GetTenantPolicyResponse = { type: { name: "Composite", className: "GetTenantPolicyResponse", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, name: { serializedName: "name", readOnly: true, type: { name: "String" } }, type: { serializedName: "type", readOnly: true, type: { name: "String" } }, properties: { serializedName: "properties", type: { name: "Composite", className: "TenantPolicy" } }, systemData: { serializedName: "systemData", type: { name: "Composite", className: "SystemData" } } } } }; const TenantPolicy = { type: { name: "Composite", className: "TenantPolicy", modelProperties: { policyId: { serializedName: "policyId", readOnly: true, type: { name: "String" } }, blockSubscriptionsLeavingTenant: { serializedName: "blockSubscriptionsLeavingTenant", type: { name: "Boolean" } }, blockSubscriptionsIntoTenant: { serializedName: "blockSubscriptionsIntoTenant", type: { name: "Boolean" } }, exemptedPrincipals: { serializedName: "exemptedPrincipals", type: { name: "Sequence", element: { type: { name: "Uuid" } } } } } } }; const GetTenantPolicyListResponse = { type: { name: "Composite", className: "GetTenantPolicyListResponse", modelProperties: { value: { serializedName: "value", readOnly: true, type: { name: "Sequence", element: { type: { name: "Composite", className: "GetTenantPolicyResponse" } } } }, nextLink: { serializedName: "nextLink", readOnly: true, type: { name: "String" } } } } }; const BillingAccountPoliciesResponse = { type: { name: "Composite", className: "BillingAccountPoliciesResponse", modelProperties: { id: { serializedName: "id", readOnly: true, type: { name: "String" } }, name: { serializedName: "name", readOnly: true, type: { name: "String" } }, type: { serializedName: "type", readOnly: true, type: { name: "String" } }, properties: { serializedName: "properties", type: { name: "Composite", className: "BillingAccountPoliciesResponseProperties" } }, systemData: { serializedName: "systemData", type: { name: "Composite", className: "SystemData" } } } } }; const BillingAccountPoliciesResponseProperties = { type: { name: "Composite", className: "BillingAccountPoliciesResponseProperties", modelProperties: { serviceTenants: { serializedName: "serviceTenants", type: { name: "Sequence", element: { type: { name: "Composite", className: "ServiceTenantResponse" } } } }, allowTransfers: { serializedName: "allowTransfers", type: { name: "Boolean" } } } } }; const ServiceTenantResponse = { type: { name: "Composite", className: "ServiceTenantResponse", modelProperties: { tenantId: { serializedName: "tenantId", type: { name: "String" } }, tenantName: { serializedName: "tenantName", type: { name: "String" } } } } }; const SubscriptionAcceptOwnershipHeaders = { type: { name: "Composite", className: "SubscriptionAcceptOwnershipHeaders", modelProperties: { location: { serializedName: "location", type: { name: "String" } }, retryAfter: { serializedName: "retry-after", type: { name: "Number" } } } } }; var Mappers = /*#__PURE__*/Object.freeze({ __proto__: null, LocationListResult: LocationListResult, Location: Location, Subscription: Subscription, SubscriptionPolicies: SubscriptionPolicies, SubscriptionListResult: SubscriptionListResult, TenantListResult: TenantListResult, TenantIdDescription: TenantIdDescription, CanceledSubscriptionId: CanceledSubscriptionId, ErrorResponseBody: ErrorResponseBody, ErrorResponse: ErrorResponse, SubscriptionName: SubscriptionName, RenamedSubscriptionId: RenamedSubscriptionId, EnabledSubscriptionId: EnabledSubscriptionId, OperationListResult: OperationListResult, Operation: Operation, OperationDisplay: OperationDisplay, PutAliasRequest: PutAliasRequest, PutAliasRequestProperties: PutAliasRequestProperties, PutAliasRequestAdditionalProperties: PutAliasRequestAdditionalProperties, SubscriptionAliasResponse: SubscriptionAliasResponse, SubscriptionAliasResponseProperties: SubscriptionAliasResponseProperties, SystemData: SystemData, SubscriptionAliasListResult: SubscriptionAliasListResult, AcceptOwnershipRequest: AcceptOwnershipRequest, AcceptOwnershipRequestProperties: AcceptOwnershipRequestProperties, AcceptOwnershipStatusResponse: AcceptOwnershipStatusResponse, PutTenantPolicyRequestProperties: PutTenantPolicyRequestProperties, GetTenantPolicyResponse: GetTenantPolicyResponse, TenantPolicy: TenantPolicy, GetTenantPolicyListResponse: GetTenantPolicyListResponse, BillingAccountPoliciesResponse: BillingAccountPoliciesResponse, BillingAccountPoliciesResponseProperties: BillingAccountPoliciesResponseProperties, ServiceTenantResponse: ServiceTenantResponse, SubscriptionAcceptOwnershipHeaders: SubscriptionAcceptOwnershipHeaders }); /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ const accept = { parameterPath: "accept", mapper: { defaultValue: "application/json", isConstant: true, serializedName: "Accept", type: { name: "String" } } }; const $host = { parameterPath: "$host", mapper: { serializedName: "$host", required: true, type: { name: "String" } }, skipEncoding: true }; const subscriptionId = { parameterPath: "subscriptionId", mapper: { serializedName: "subscriptionId", required: true, type: { name: "String" } } }; const apiVersion = { parameterPath: "apiVersion", mapper: { defaultValue: "2016-06-01", isConstant: true, serializedName: "api-version", type: { name: "String" } } }; const nextLink = { parameterPath: "nextLink", mapper: { serializedName: "nextLink", required: true, type: { name: "String" } }, skipEncoding: true }; const apiVersion1 = { parameterPath: "apiVersion", mapper: { defaultValue: "2021-10-01", isConstant: true, serializedName: "api-version", type: { name: "String" } } }; const contentType = { parameterPath: ["options", "contentType"], mapper: { defaultValue: "application/json", isConstant: true, serializedName: "Content-Type", type: { name: "String" } } }; const body = { parameterPath: "body", mapper: SubscriptionName }; const body1 = { parameterPath: "body", mapper: AcceptOwnershipRequest }; const body2 = { parameterPath: "body", mapper: PutAliasRequest }; const aliasName = { parameterPath: "aliasName", mapper: { serializedName: "aliasName", required: true, type: { name: "String" } } }; const body3 = { parameterPath: "body", mapper: PutTenantPolicyRequestProperties }; const billingAccountId = { parameterPath: "billingAccountId", mapper: { serializedName: "billingAccountId", required: true, type: { name: "String" } } }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /// /** Class containing Subscriptions operations. */ class SubscriptionsImpl { /** * Initialize a new instance of the class Subscriptions class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * This operation provides all the locations that are available for resource providers; however, each * resource provider may support a subset of this list. * @param subscriptionId The ID of the target subscription. * @param options The options parameters. */ listLocations(subscriptionId, options) { const iter = this.listLocationsPagingAll(subscriptionId, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listLocationsPagingPage(subscriptionId, options, settings); } }; } listLocationsPagingPage(subscriptionId, options, _settings) { return tslib.__asyncGenerator(this, arguments, function* listLocationsPagingPage_1() { let result; result = yield tslib.__await(this._listLocations(subscriptionId, options)); yield yield tslib.__await(result.value || []); }); } listLocationsPagingAll(subscriptionId, options) { return tslib.__asyncGenerator(this, arguments, function* listLocationsPagingAll_1() { var e_1, _a; try { for (var _b = tslib.__asyncValues(this.listLocationsPagingPage(subscriptionId, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) { const page = _c.value; yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Gets all subscriptions for a tenant. * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listPagingPage(options, settings); } }; } listPagingPage(options, settings) { return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield tslib.__await(this._list(options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } while (continuationToken) { result = yield tslib.__await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } }); } listPagingAll(options) { return tslib.__asyncGenerator(this, arguments, function* listPagingAll_1() { var e_2, _a; try { for (var _b = tslib.__asyncValues(this.listPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) { const page = _c.value; yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b)); } finally { if (e_2) throw e_2.error; } } }); } /** * This operation provides all the locations that are available for resource providers; however, each * resource provider may support a subset of this list. * @param subscriptionId The ID of the target subscription. * @param options The options parameters. */ _listLocations(subscriptionId, options) { return this.client.sendOperationRequest({ subscriptionId, options }, listLocationsOperationSpec); } /** * Gets details about a specified subscription. * @param subscriptionId The ID of the target subscription. * @param options The options parameters. */ get(subscriptionId, options) { return this.client.sendOperationRequest({ subscriptionId, options }, getOperationSpec$1); } /** * Gets all subscriptions for a tenant. * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec$3); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec$2); } } // Operation Specifications const serializer$6 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const listLocationsOperationSpec = { path: "/subscriptions/{subscriptionId}/locations", httpMethod: "GET", responses: { 200: { bodyMapper: LocationListResult } }, queryParameters: [apiVersion], urlParameters: [$host, subscriptionId], headerParameters: [accept], serializer: serializer$6 }; const getOperationSpec$1 = { path: "/subscriptions/{subscriptionId}", httpMethod: "GET", responses: { 200: { bodyMapper: Subscription } }, queryParameters: [apiVersion], urlParameters: [$host, subscriptionId], headerParameters: [accept], serializer: serializer$6 }; const listOperationSpec$3 = { path: "/subscriptions", httpMethod: "GET", responses: { 200: { bodyMapper: SubscriptionListResult } }, queryParameters: [apiVersion], urlParameters: [$host], headerParameters: [accept], serializer: serializer$6 }; const listNextOperationSpec$2 = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: SubscriptionListResult } }, queryParameters: [apiVersion], urlParameters: [$host, nextLink], headerParameters: [accept], serializer: serializer$6 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /// /** Class containing Tenants operations. */ class TenantsImpl { /** * Initialize a new instance of the class Tenants class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Gets the tenants for your account. * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listPagingPage(options, settings); } }; } listPagingPage(options, settings) { return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield tslib.__await(this._list(options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } while (continuationToken) { result = yield tslib.__await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } }); } listPagingAll(options) { return tslib.__asyncGenerator(this, arguments, function* listPagingAll_1() { var e_1, _a; try { for (var _b = tslib.__asyncValues(this.listPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) { const page = _c.value; yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Gets the tenants for your account. * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec$2); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec$1); } } // Operation Specifications const serializer$5 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const listOperationSpec$2 = { path: "/tenants", httpMethod: "GET", responses: { 200: { bodyMapper: TenantListResult } }, queryParameters: [apiVersion], urlParameters: [$host], headerParameters: [accept], serializer: serializer$5 }; const listNextOperationSpec$1 = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: TenantListResult } }, queryParameters: [apiVersion], urlParameters: [$host, nextLink], headerParameters: [accept], serializer: serializer$5 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ class LroImpl { constructor(sendOperationFn, args, spec, requestPath = spec.path, requestMethod = spec.httpMethod) { this.sendOperationFn = sendOperationFn; this.args = args; this.spec = spec; this.requestPath = requestPath; this.requestMethod = requestMethod; } sendInitialRequest() { return tslib.__awaiter(this, void 0, void 0, function* () { return this.sendOperationFn(this.args, this.spec); }); } sendPollRequest(path) { return tslib.__awaiter(this, void 0, void 0, function* () { const _a = this.spec, restSpec = tslib.__rest(_a, ["requestBody"]); return this.sendOperationFn(this.args, Object.assign(Object.assign({}, restSpec), { path, httpMethod: "GET" })); }); } } /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /** Class containing SubscriptionOperations operations. */ class SubscriptionOperationsImpl { /** * Initialize a new instance of the class SubscriptionOperations class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * The operation to cancel a subscription * @param subscriptionId Subscription Id. * @param options The options parameters. */ cancel(subscriptionId, options) { return this.client.sendOperationRequest({ subscriptionId, options }, cancelOperationSpec); } /** * The operation to rename a subscription * @param subscriptionId Subscription Id. * @param body Subscription Name * @param options The options parameters. */ rename(subscriptionId, body, options) { return this.client.sendOperationRequest({ subscriptionId, body, options }, renameOperationSpec); } /** * The operation to enable a subscription * @param subscriptionId Subscription Id. * @param options The options parameters. */ enable(subscriptionId, options) { return this.client.sendOperationRequest({ subscriptionId, options }, enableOperationSpec); } /** * Accept subscription ownership. * @param subscriptionId Subscription Id. * @param body The parameters required to accept subscription ownership. * @param options The options parameters. */ beginAcceptOwnership(subscriptionId, body, options) { return tslib.__awaiter(this, void 0, void 0, function* () { const directSendOperation = (args, spec) => tslib.__awaiter(this, void 0, void 0, function* () { return this.client.sendOperationRequest(args, spec); }); const sendOperation = (args, spec) => tslib.__awaiter(this, void 0, void 0, function* () { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = yield directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON() } }; }); const lro = new LroImpl(sendOperation, { subscriptionId, body, options }, acceptOwnershipOperationSpec); const poller = new coreLro.LroEngine(lro, { resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs }); yield poller.poll(); return poller; }); } /** * Accept subscription ownership. * @param subscriptionId Subscription Id. * @param body The parameters required to accept subscription ownership. * @param options The options parameters. */ beginAcceptOwnershipAndWait(subscriptionId, body, options) { return tslib.__awaiter(this, void 0, void 0, function* () { const poller = yield this.beginAcceptOwnership(subscriptionId, body, options); return poller.pollUntilDone(); }); } /** * Accept subscription ownership status. * @param subscriptionId Subscription Id. * @param options The options parameters. */ acceptOwnershipStatus(subscriptionId, options) { return this.client.sendOperationRequest({ subscriptionId, options }, acceptOwnershipStatusOperationSpec); } } // Operation Specifications const serializer$4 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const cancelOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel", httpMethod: "POST", responses: { 200: { bodyMapper: CanceledSubscriptionId }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, subscriptionId], headerParameters: [accept], serializer: serializer$4 }; const renameOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename", httpMethod: "POST", responses: { 200: { bodyMapper: RenamedSubscriptionId }, default: { bodyMapper: ErrorResponseBody } }, requestBody: body, queryParameters: [apiVersion1], urlParameters: [$host, subscriptionId], headerParameters: [accept, contentType], mediaType: "json", serializer: serializer$4 }; const enableOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable", httpMethod: "POST", responses: { 200: { bodyMapper: EnabledSubscriptionId }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, subscriptionId], headerParameters: [accept], serializer: serializer$4 }; const acceptOwnershipOperationSpec = { path: "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership", httpMethod: "POST", responses: { 200: { headersMapper: SubscriptionAcceptOwnershipHeaders }, 201: { headersMapper: SubscriptionAcceptOwnershipHeaders }, 202: { headersMapper: SubscriptionAcceptOwnershipHeaders }, 204: { headersMapper: SubscriptionAcceptOwnershipHeaders }, default: { bodyMapper: ErrorResponseBody } }, requestBody: body1, queryParameters: [apiVersion1], urlParameters: [$host, subscriptionId], headerParameters: [accept, contentType], mediaType: "json", serializer: serializer$4 }; const acceptOwnershipStatusOperationSpec = { path: "/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus", httpMethod: "GET", responses: { 200: { bodyMapper: AcceptOwnershipStatusResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, subscriptionId], headerParameters: [accept], serializer: serializer$4 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /// /** Class containing Operations operations. */ class OperationsImpl { /** * Initialize a new instance of the class Operations class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Lists all of the available Microsoft.Subscription API operations. * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listPagingPage(options, settings); } }; } listPagingPage(options, settings) { return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield tslib.__await(this._list(options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } while (continuationToken) { result = yield tslib.__await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } }); } listPagingAll(options) { return tslib.__asyncGenerator(this, arguments, function* listPagingAll_1() { var e_1, _a; try { for (var _b = tslib.__asyncValues(this.listPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) { const page = _c.value; yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Lists all of the available Microsoft.Subscription API operations. * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec$1); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); } } // Operation Specifications const serializer$3 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const listOperationSpec$1 = { path: "/providers/Microsoft.Subscription/operations", httpMethod: "GET", responses: { 200: { bodyMapper: OperationListResult }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host], headerParameters: [accept], serializer: serializer$3 }; const listNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: OperationListResult }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, nextLink], headerParameters: [accept], serializer: serializer$3 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /** Class containing Alias operations. */ class AliasImpl { /** * Initialize a new instance of the class Alias class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Create Alias Subscription. * @param aliasName AliasName is the name for the subscription creation request. Note that this is not * the same as subscription name and this doesn’t have any other lifecycle need beyond the request for * subscription creation. * @param body The parameters required to create a new subscription. * @param options The options parameters. */ beginCreate(aliasName, body, options) { return tslib.__awaiter(this, void 0, void 0, function* () { const directSendOperation = (args, spec) => tslib.__awaiter(this, void 0, void 0, function* () { return this.client.sendOperationRequest(args, spec); }); const sendOperation = (args, spec) => tslib.__awaiter(this, void 0, void 0, function* () { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = yield directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON() } }; }); const lro = new LroImpl(sendOperation, { aliasName, body, options }, createOperationSpec); const poller = new coreLro.LroEngine(lro, { resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs }); yield poller.poll(); return poller; }); } /** * Create Alias Subscription. * @param aliasName AliasName is the name for the subscription creation request. Note that this is not * the same as subscription name and this doesn’t have any other lifecycle need beyond the request for * subscription creation. * @param body The parameters required to create a new subscription. * @param options The options parameters. */ beginCreateAndWait(aliasName, body, options) { return tslib.__awaiter(this, void 0, void 0, function* () { const poller = yield this.beginCreate(aliasName, body, options); return poller.pollUntilDone(); }); } /** * Get Alias Subscription. * @param aliasName AliasName is the name for the subscription creation request. Note that this is not * the same as subscription name and this doesn’t have any other lifecycle need beyond the request for * subscription creation. * @param options The options parameters. */ get(aliasName, options) { return this.client.sendOperationRequest({ aliasName, options }, getOperationSpec); } /** * Delete Alias. * @param aliasName AliasName is the name for the subscription creation request. Note that this is not * the same as subscription name and this doesn’t have any other lifecycle need beyond the request for * subscription creation. * @param options The options parameters. */ delete(aliasName, options) { return this.client.sendOperationRequest({ aliasName, options }, deleteOperationSpec); } /** * List Alias Subscription. * @param options The options parameters. */ list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec); } } // Operation Specifications const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const createOperationSpec = { path: "/providers/Microsoft.Subscription/aliases/{aliasName}", httpMethod: "PUT", responses: { 200: { bodyMapper: SubscriptionAliasResponse }, 201: { bodyMapper: SubscriptionAliasResponse }, 202: { bodyMapper: SubscriptionAliasResponse }, 204: { bodyMapper: SubscriptionAliasResponse }, default: { bodyMapper: ErrorResponseBody } }, requestBody: body2, queryParameters: [apiVersion1], urlParameters: [$host, aliasName], headerParameters: [accept, contentType], mediaType: "json", serializer: serializer$2 }; const getOperationSpec = { path: "/providers/Microsoft.Subscription/aliases/{aliasName}", httpMethod: "GET", responses: { 200: { bodyMapper: SubscriptionAliasResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, aliasName], headerParameters: [accept], serializer: serializer$2 }; const deleteOperationSpec = { path: "/providers/Microsoft.Subscription/aliases/{aliasName}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, aliasName], headerParameters: [accept], serializer: serializer$2 }; const listOperationSpec = { path: "/providers/Microsoft.Subscription/aliases", httpMethod: "GET", responses: { 200: { bodyMapper: SubscriptionAliasListResult }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host], headerParameters: [accept], serializer: serializer$2 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /// /** Class containing SubscriptionPolicy operations. */ class SubscriptionPolicyImpl { /** * Initialize a new instance of the class SubscriptionPolicy class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Get the subscription tenant policy for the user's tenant. * @param options The options parameters. */ listPolicyForTenant(options) { const iter = this.listPolicyForTenantPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: (settings) => { if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) { throw new Error("maxPageSize is not supported by this operation."); } return this.listPolicyForTenantPagingPage(options, settings); } }; } listPolicyForTenantPagingPage(options, settings) { return tslib.__asyncGenerator(this, arguments, function* listPolicyForTenantPagingPage_1() { let result; let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken; if (!continuationToken) { result = yield tslib.__await(this._listPolicyForTenant(options)); let page = result.value || []; continuationToken = result.nextLink; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } while (continuationToken) { result = yield tslib.__await(this._listPolicyForTenantNext(continuationToken, options)); continuationToken = result.nextLink; let page = result.value || []; setContinuationToken(page, continuationToken); yield yield tslib.__await(page); } }); } listPolicyForTenantPagingAll(options) { return tslib.__asyncGenerator(this, arguments, function* listPolicyForTenantPagingAll_1() { var e_1, _a; try { for (var _b = tslib.__asyncValues(this.listPolicyForTenantPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) { const page = _c.value; yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Create or Update Subscription tenant policy for user's tenant. * @param body Put tenant policy request properties. * @param options The options parameters. */ addUpdatePolicyForTenant(body, options) { return this.client.sendOperationRequest({ body, options }, addUpdatePolicyForTenantOperationSpec); } /** * Get the subscription tenant policy for the user's tenant. * @param options The options parameters. */ getPolicyForTenant(options) { return this.client.sendOperationRequest({ options }, getPolicyForTenantOperationSpec); } /** * Get the subscription tenant policy for the user's tenant. * @param options The options parameters. */ _listPolicyForTenant(options) { return this.client.sendOperationRequest({ options }, listPolicyForTenantOperationSpec); } /** * ListPolicyForTenantNext * @param nextLink The nextLink from the previous successful call to the ListPolicyForTenant method. * @param options The options parameters. */ _listPolicyForTenantNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listPolicyForTenantNextOperationSpec); } } // Operation Specifications const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const addUpdatePolicyForTenantOperationSpec = { path: "/providers/Microsoft.Subscription/policies/default", httpMethod: "PUT", responses: { 200: { bodyMapper: GetTenantPolicyResponse }, default: { bodyMapper: ErrorResponseBody } }, requestBody: body3, queryParameters: [apiVersion1], urlParameters: [$host], headerParameters: [accept, contentType], mediaType: "json", serializer: serializer$1 }; const getPolicyForTenantOperationSpec = { path: "/providers/Microsoft.Subscription/policies/default", httpMethod: "GET", responses: { 200: { bodyMapper: GetTenantPolicyResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host], headerParameters: [accept], serializer: serializer$1 }; const listPolicyForTenantOperationSpec = { path: "/providers/Microsoft.Subscription/policies", httpMethod: "GET", responses: { 200: { bodyMapper: GetTenantPolicyListResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host], headerParameters: [accept], serializer: serializer$1 }; const listPolicyForTenantNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: GetTenantPolicyListResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, nextLink], headerParameters: [accept], serializer: serializer$1 }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ /** Class containing BillingAccount operations. */ class BillingAccountImpl { /** * Initialize a new instance of the class BillingAccount class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Get Billing Account Policy. * @param billingAccountId Billing Account Id. * @param options The options parameters. */ getPolicy(billingAccountId, options) { return this.client.sendOperationRequest({ billingAccountId, options }, getPolicyOperationSpec); } } // Operation Specifications const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false); const getPolicyOperationSpec = { path: "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default", httpMethod: "GET", responses: { 200: { bodyMapper: BillingAccountPoliciesResponse }, default: { bodyMapper: ErrorResponseBody } }, queryParameters: [apiVersion1], urlParameters: [$host, billingAccountId], headerParameters: [accept], serializer }; /* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ class SubscriptionClient extends coreClient__namespace.ServiceClient { /** * Initializes a new instance of the SubscriptionClient class. * @param credentials Subscription credentials which uniquely identify client subscription. * @param options The parameter options */ constructor(credentials, options) { var _a, _b, _c; if (credentials === undefined) { throw new Error("'credentials' cannot be null"); } // Initializing default values for options if (!options) { options = {}; } const defaults = { requestContentType: "application/json; charset=utf-8", credential: credentials }; const packageDetails = `azsdk-js-arm-subscriptions/5.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: { userAgentPrefix }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" }); super(optionsWithDefaults); let bearerTokenAuthenticationPolicyFound = false; if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) { const pipelinePolicies = options.pipeline.getOrderedPolicies(); bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name === coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName); } if (!options || !options.pipeline || options.pipeline.getOrderedPolicies().length == 0 || !bearerTokenAuthenticationPolicyFound) { this.pipeline.removePolicy({ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName }); this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({ credential: credentials, scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge } })); } // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; this.subscriptions = new SubscriptionsImpl(this); this.tenants = new TenantsImpl(this); this.subscriptionOperations = new SubscriptionOperationsImpl(this); this.operations = new OperationsImpl(this); this.alias = new AliasImpl(this); this.subscriptionPolicy = new SubscriptionPolicyImpl(this); this.billingAccount = new BillingAccountImpl(this); } } exports.SubscriptionClient = SubscriptionClient; exports.getContinuationToken = getContinuationToken; //# sourceMappingURL=index.js.map