Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
/*
* 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.
*/
/// <reference lib="esnext.asynciterable" />
export { getContinuationToken } from "./pagingHelper";
export * from "./models";
export { SubscriptionClient } from "./subscriptionClient";
export * from "./operationsInterfaces";
+34
View File
@@ -0,0 +1,34 @@
/*
* 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.
*/
import { LongRunningOperation, LroResponse } from "@azure/core-lro";
export class LroImpl<T> implements LongRunningOperation<T> {
constructor(
private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
private args: Record<string, unknown>,
private spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>,
public requestPath: string = spec.path!,
public requestMethod: string = spec.httpMethod
) {}
public async sendInitialRequest(): Promise<LroResponse<T>> {
return this.sendOperationFn(this.args, this.spec);
}
public async sendPollRequest(path: string): Promise<LroResponse<T>> {
const { requestBody, ...restSpec } = this.spec;
return this.sendOperationFn(this.args, {
...restSpec,
path,
httpMethod: "GET"
});
}
}
+828
View File
@@ -0,0 +1,828 @@
/*
* 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.
*/
import * as coreClient from "@azure/core-client";
/** Location list operation response. */
export interface LocationListResult {
/** An array of locations. */
value?: Location[];
}
/** 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 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.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly state?: SubscriptionState;
/**
* 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;
/** Tags for the subscription */
tags?: { [propertyName: string]: string };
/** 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;
}
/** 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.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly spendingLimit?: SpendingLimit;
}
/** Subscription list operation response. */
export interface SubscriptionListResult {
/** An array of subscriptions. */
value?: Subscription[];
/** The URL to get the next set of results. */
nextLink?: string;
}
/** Tenant Ids information. */
export interface TenantListResult {
/** An array of tenants. */
value?: TenantIdDescription[];
/** The URL to use for getting the next set of results. */
nextLink: 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;
/**
* The category of the tenant. Possible values are TenantCategoryHome,TenantCategoryProjectedBy,TenantCategoryManagedBy
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly tenantCategory?: string;
/**
* The country/region name of the address for the tenant.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly country?: string;
/**
* The Country/region abbreviation for the tenant.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly countryCode?: string;
/**
* The display name of the tenant.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly displayName?: string;
/**
* The list of domains for the tenant.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly domains?: string;
/**
* The default domain for the tenant.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly defaultDomain?: string;
/**
* The tenant type. Only available for Home tenant category.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly tenantType?: string;
}
/** The ID of the canceled subscription */
export interface CanceledSubscriptionId {
/**
* The ID of the canceled subscription
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly subscriptionId?: 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;
/** Error code */
code?: string;
/** Error message indicating why the operation failed. */
message?: string;
}
/** Describes the format of Error response. */
export interface ErrorResponse {
/** Error code */
code?: string;
/** Error message indicating why the operation failed. */
message?: string;
}
/** The new name of the subscription. */
export interface SubscriptionName {
/** New subscription name */
subscriptionName?: string;
}
/** The ID of the subscriptions that is being renamed */
export interface RenamedSubscriptionId {
/**
* The ID of the subscriptions that is being renamed
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly subscriptionId?: 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 subscriptionId?: string;
}
/** Result of the request to list operations. It contains a list of operations and a URL link to get the next set of results. */
export interface OperationListResult {
/** List of operations. */
value?: Operation[];
/** URL to get the next set of operation list results if there are any. */
nextLink?: string;
}
/** REST API operation */
export interface Operation {
/** Operation name: {provider}/{resource}/{operation} */
name?: string;
/** Indicates whether the operation is a data action */
isDataAction?: boolean;
/** The object that represents the operation. */
display?: OperationDisplay;
}
/** The object that represents the operation. */
export interface OperationDisplay {
/** Service provider: Microsoft.Subscription */
provider?: string;
/** Resource on which the operation is performed: Profile, endpoint, etc. */
resource?: string;
/** Operation type: Read, write, delete, etc. */
operation?: string;
/** Localized friendly description for the operation */
description?: string;
}
/** The parameters required to create a new subscription. */
export interface PutAliasRequest {
/** Put alias request properties. */
properties?: PutAliasRequestProperties;
}
/** Put subscription properties. */
export interface PutAliasRequestProperties {
/** The friendly name of the subscription. */
displayName?: string;
/** The workload type of the subscription. It can be either Production or DevTest. */
workload?: Workload;
/**
* Billing scope of the subscription.
* For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}
* For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}
* For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}
*/
billingScope?: string;
/** This parameter can be used to create alias for existing subscription Id */
subscriptionId?: string;
/** Reseller Id */
resellerId?: string;
/** Put alias request additional properties. */
additionalProperties?: PutAliasRequestAdditionalProperties;
}
/** Put subscription additional properties. */
export interface PutAliasRequestAdditionalProperties {
/** Management group Id for the subscription. */
managementGroupId?: string;
/** Tenant Id of the subscription */
subscriptionTenantId?: string;
/** Owner Id of the subscription */
subscriptionOwnerId?: string;
/** Tags for the subscription */
tags?: { [propertyName: string]: string };
}
/** Subscription Information with the alias. */
export interface SubscriptionAliasResponse {
/**
* 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;
/**
* Alias ID.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* Resource type, Microsoft.Subscription/aliases.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/** Subscription Alias response properties. */
properties?: SubscriptionAliasResponseProperties;
/**
* Metadata pertaining to creation and last modification of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly systemData?: SystemData;
}
/** Put subscription creation result properties. */
export interface SubscriptionAliasResponseProperties {
/**
* Newly created subscription Id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly subscriptionId?: string;
/** The display name of the subscription. */
displayName?: string;
/** The provisioning state of the resource. */
provisioningState?: ProvisioningState;
/**
* Url to accept ownership of the subscription.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly acceptOwnershipUrl?: string;
/**
* The accept ownership state of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly acceptOwnershipState?: AcceptOwnership;
/**
* Billing scope of the subscription.
* For CustomerLed and FieldLed - /billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}
* For PartnerLed - /billingAccounts/{billingAccountName}/customers/{customerName}
* For Legacy EA - /billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}
*/
billingScope?: string;
/** The workload type of the subscription. It can be either Production or DevTest. */
workload?: Workload;
/** Reseller Id */
resellerId?: string;
/** Owner Id of the subscription */
subscriptionOwnerId?: string;
/** The Management Group Id. */
managementGroupId?: string;
/** Created Time */
createdTime?: string;
/** Tags for the subscription */
tags?: { [propertyName: string]: string };
}
/** Metadata pertaining to creation and last modification of the resource. */
export interface SystemData {
/** The identity that created the resource. */
createdBy?: string;
/** The type of identity that created the resource. */
createdByType?: CreatedByType;
/** The timestamp of resource creation (UTC). */
createdAt?: Date;
/** The identity that last modified the resource. */
lastModifiedBy?: string;
/** The type of identity that last modified the resource. */
lastModifiedByType?: CreatedByType;
/** The timestamp of resource last modification (UTC) */
lastModifiedAt?: Date;
}
/** The list of aliases. */
export interface SubscriptionAliasListResult {
/**
* The list of alias.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly value?: SubscriptionAliasResponse[];
/**
* 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 nextLink?: string;
}
/** The parameters required to accept subscription ownership. */
export interface AcceptOwnershipRequest {
/** Accept subscription ownership request properties. */
properties?: AcceptOwnershipRequestProperties;
}
/** Accept subscription ownership request properties. */
export interface AcceptOwnershipRequestProperties {
/** The friendly name of the subscription. */
displayName: string;
/** Management group Id for the subscription. */
managementGroupId?: string;
/** Tags for the subscription */
tags?: { [propertyName: string]: string };
}
/** Subscription Accept Ownership Response */
export interface AcceptOwnershipStatusResponse {
/**
* Newly created subscription Id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly subscriptionId?: string;
/**
* The accept ownership state of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly acceptOwnershipState?: AcceptOwnership;
/**
* The provisioning state of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provisioningState?: Provisioning;
/**
* UPN of the billing owner
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly billingOwner?: string;
/** Tenant Id of the subscription */
subscriptionTenantId?: string;
/** The display name of the subscription. */
displayName?: string;
/** Tags for the subscription */
tags?: { [propertyName: string]: string };
}
/** Put tenant policy request properties. */
export interface PutTenantPolicyRequestProperties {
/** Blocks the leaving of subscriptions from user's tenant. */
blockSubscriptionsLeavingTenant?: boolean;
/** Blocks the entering of subscriptions into user's tenant. */
blockSubscriptionsIntoTenant?: boolean;
/** List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. */
exemptedPrincipals?: string[];
}
/** Tenant policy Information. */
export interface GetTenantPolicyResponse {
/**
* Policy Id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly id?: string;
/**
* Policy name.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* Resource type.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/** Tenant policy properties. */
properties?: TenantPolicy;
/**
* Metadata pertaining to creation and last modification of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly systemData?: SystemData;
}
/** Tenant policy. */
export interface TenantPolicy {
/**
* Policy Id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly policyId?: string;
/** Blocks the leaving of subscriptions from user's tenant. */
blockSubscriptionsLeavingTenant?: boolean;
/** Blocks the entering of subscriptions into user's tenant. */
blockSubscriptionsIntoTenant?: boolean;
/** List of user objectIds that are exempted from the set subscription tenant policies for the user's tenant. */
exemptedPrincipals?: string[];
}
/** Tenant policy information list. */
export interface GetTenantPolicyListResponse {
/**
* The list of tenant policies.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly value?: GetTenantPolicyResponse[];
/**
* 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 nextLink?: string;
}
/** Billing account policies information. */
export interface BillingAccountPoliciesResponse {
/**
* Fully qualified ID for the policy.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly id?: string;
/**
* Policy name.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* Resource type.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/** Billing account policies response properties. */
properties?: BillingAccountPoliciesResponseProperties;
/**
* Metadata pertaining to creation and last modification of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly systemData?: SystemData;
}
/** Put billing account policies response properties. */
export interface BillingAccountPoliciesResponseProperties {
/** Service tenant for the billing account. */
serviceTenants?: ServiceTenantResponse[];
/** Determine if the transfers are allowed for the billing account */
allowTransfers?: boolean;
}
/** Billing account service tenant. */
export interface ServiceTenantResponse {
/** Service tenant id. */
tenantId?: string;
/** Service tenant name. */
tenantName?: string;
}
/** Defines headers for Subscription_acceptOwnership operation. */
export interface SubscriptionAcceptOwnershipHeaders {
/** 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?: number;
}
/** Known values of {@link Workload} that the service accepts. */
export enum KnownWorkload {
/** Production */
Production = "Production",
/** DevTest */
DevTest = "DevTest"
}
/**
* Defines values for Workload. \
* {@link KnownWorkload} can be used interchangeably with Workload,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Production** \
* **DevTest**
*/
export type Workload = string;
/** Known values of {@link ProvisioningState} that the service accepts. */
export enum KnownProvisioningState {
/** Accepted */
Accepted = "Accepted",
/** Succeeded */
Succeeded = "Succeeded",
/** Failed */
Failed = "Failed"
}
/**
* Defines values for ProvisioningState. \
* {@link KnownProvisioningState} can be used interchangeably with ProvisioningState,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Accepted** \
* **Succeeded** \
* **Failed**
*/
export type ProvisioningState = string;
/** Known values of {@link AcceptOwnership} that the service accepts. */
export enum KnownAcceptOwnership {
/** Pending */
Pending = "Pending",
/** Completed */
Completed = "Completed",
/** Expired */
Expired = "Expired"
}
/**
* Defines values for AcceptOwnership. \
* {@link KnownAcceptOwnership} can be used interchangeably with AcceptOwnership,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Pending** \
* **Completed** \
* **Expired**
*/
export type AcceptOwnership = string;
/** Known values of {@link CreatedByType} that the service accepts. */
export enum KnownCreatedByType {
/** User */
User = "User",
/** Application */
Application = "Application",
/** ManagedIdentity */
ManagedIdentity = "ManagedIdentity",
/** Key */
Key = "Key"
}
/**
* Defines values for CreatedByType. \
* {@link KnownCreatedByType} can be used interchangeably with CreatedByType,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **User** \
* **Application** \
* **ManagedIdentity** \
* **Key**
*/
export type CreatedByType = string;
/** Known values of {@link Provisioning} that the service accepts. */
export enum KnownProvisioning {
/** Pending */
Pending = "Pending",
/** Accepted */
Accepted = "Accepted",
/** Succeeded */
Succeeded = "Succeeded"
}
/**
* Defines values for Provisioning. \
* {@link KnownProvisioning} can be used interchangeably with Provisioning,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Pending** \
* **Accepted** \
* **Succeeded**
*/
export type Provisioning = string;
/** Defines values for SubscriptionState. */
export type SubscriptionState =
| "Enabled"
| "Warned"
| "PastDue"
| "Disabled"
| "Deleted";
/** Defines values for SpendingLimit. */
export type SpendingLimit = "On" | "Off" | "CurrentPeriodOff";
/** Optional parameters. */
export interface SubscriptionsListLocationsOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listLocations operation. */
export type SubscriptionsListLocationsResponse = LocationListResult;
/** Optional parameters. */
export interface SubscriptionsGetOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type SubscriptionsGetResponse = Subscription;
/** Optional parameters. */
export interface SubscriptionsListOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type SubscriptionsListResponse = SubscriptionListResult;
/** Optional parameters. */
export interface SubscriptionsListNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listNext operation. */
export type SubscriptionsListNextResponse = SubscriptionListResult;
/** Optional parameters. */
export interface TenantsListOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type TenantsListResponse = TenantListResult;
/** Optional parameters. */
export interface TenantsListNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listNext operation. */
export type TenantsListNextResponse = TenantListResult;
/** Optional parameters. */
export interface SubscriptionCancelOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the cancel operation. */
export type SubscriptionCancelResponse = CanceledSubscriptionId;
/** Optional parameters. */
export interface SubscriptionRenameOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the rename operation. */
export type SubscriptionRenameResponse = RenamedSubscriptionId;
/** Optional parameters. */
export interface SubscriptionEnableOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the enable operation. */
export type SubscriptionEnableResponse = EnabledSubscriptionId;
/** Optional parameters. */
export interface SubscriptionAcceptOwnershipOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the acceptOwnership operation. */
export type SubscriptionAcceptOwnershipResponse = SubscriptionAcceptOwnershipHeaders;
/** Optional parameters. */
export interface SubscriptionAcceptOwnershipStatusOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the acceptOwnershipStatus operation. */
export type SubscriptionAcceptOwnershipStatusResponse = AcceptOwnershipStatusResponse;
/** Optional parameters. */
export interface OperationsListOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type OperationsListResponse = OperationListResult;
/** Optional parameters. */
export interface OperationsListNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listNext operation. */
export type OperationsListNextResponse = OperationListResult;
/** Optional parameters. */
export interface AliasCreateOptionalParams extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the create operation. */
export type AliasCreateResponse = SubscriptionAliasResponse;
/** Optional parameters. */
export interface AliasGetOptionalParams extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type AliasGetResponse = SubscriptionAliasResponse;
/** Optional parameters. */
export interface AliasDeleteOptionalParams
extends coreClient.OperationOptions {}
/** Optional parameters. */
export interface AliasListOptionalParams extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type AliasListResponse = SubscriptionAliasListResult;
/** Optional parameters. */
export interface SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the addUpdatePolicyForTenant operation. */
export type SubscriptionPolicyAddUpdatePolicyForTenantResponse = GetTenantPolicyResponse;
/** Optional parameters. */
export interface SubscriptionPolicyGetPolicyForTenantOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the getPolicyForTenant operation. */
export type SubscriptionPolicyGetPolicyForTenantResponse = GetTenantPolicyResponse;
/** Optional parameters. */
export interface SubscriptionPolicyListPolicyForTenantOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listPolicyForTenant operation. */
export type SubscriptionPolicyListPolicyForTenantResponse = GetTenantPolicyListResponse;
/** Optional parameters. */
export interface SubscriptionPolicyListPolicyForTenantNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listPolicyForTenantNext operation. */
export type SubscriptionPolicyListPolicyForTenantNextResponse = GetTenantPolicyListResponse;
/** Optional parameters. */
export interface BillingAccountGetPolicyOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the getPolicy operation. */
export type BillingAccountGetPolicyResponse = BillingAccountPoliciesResponse;
/** Optional parameters. */
export interface SubscriptionClientOptionalParams
extends coreClient.ServiceClientOptions {
/** server parameter */
$host?: string;
/** Overrides client endpoint. */
endpoint?: string;
}
File diff suppressed because it is too large Load Diff
+144
View File
@@ -0,0 +1,144 @@
/*
* 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.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter
} from "@azure/core-client";
import {
SubscriptionName as SubscriptionNameMapper,
AcceptOwnershipRequest as AcceptOwnershipRequestMapper,
PutAliasRequest as PutAliasRequestMapper,
PutTenantPolicyRequestProperties as PutTenantPolicyRequestPropertiesMapper
} from "../models/mappers";
export const accept: OperationParameter = {
parameterPath: "accept",
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Accept",
type: {
name: "String"
}
}
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const subscriptionId: OperationURLParameter = {
parameterPath: "subscriptionId",
mapper: {
serializedName: "subscriptionId",
required: true,
type: {
name: "String"
}
}
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2016-06-01",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const apiVersion1: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2021-10-01",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const contentType: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const body: OperationParameter = {
parameterPath: "body",
mapper: SubscriptionNameMapper
};
export const body1: OperationParameter = {
parameterPath: "body",
mapper: AcceptOwnershipRequestMapper
};
export const body2: OperationParameter = {
parameterPath: "body",
mapper: PutAliasRequestMapper
};
export const aliasName: OperationURLParameter = {
parameterPath: "aliasName",
mapper: {
serializedName: "aliasName",
required: true,
type: {
name: "String"
}
}
};
export const body3: OperationParameter = {
parameterPath: "body",
mapper: PutTenantPolicyRequestPropertiesMapper
};
export const billingAccountId: OperationURLParameter = {
parameterPath: "billingAccountId",
mapper: {
serializedName: "billingAccountId",
required: true,
type: {
name: "String"
}
}
};
+241
View File
@@ -0,0 +1,241 @@
/*
* 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.
*/
import { Alias } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
import { LroImpl } from "../lroImpl";
import {
PutAliasRequest,
AliasCreateOptionalParams,
AliasCreateResponse,
AliasGetOptionalParams,
AliasGetResponse,
AliasDeleteOptionalParams,
AliasListOptionalParams,
AliasListResponse
} from "../models";
/** Class containing Alias operations. */
export class AliasImpl implements Alias {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class Alias class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
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 doesnt 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.
*/
async beginCreate(
aliasName: string,
body: PutAliasRequest,
options?: AliasCreateOptionalParams
): Promise<
PollerLike<PollOperationState<AliasCreateResponse>, AliasCreateResponse>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<AliasCreateResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await 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 LroEngine(lro, {
resumeFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await 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 doesnt 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.
*/
async beginCreateAndWait(
aliasName: string,
body: PutAliasRequest,
options?: AliasCreateOptionalParams
): Promise<AliasCreateResponse> {
const poller = await 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 doesnt have any other lifecycle need beyond the request for
* subscription creation.
* @param options The options parameters.
*/
get(
aliasName: string,
options?: AliasGetOptionalParams
): Promise<AliasGetResponse> {
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 doesnt have any other lifecycle need beyond the request for
* subscription creation.
* @param options The options parameters.
*/
delete(
aliasName: string,
options?: AliasDeleteOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ aliasName, options },
deleteOperationSpec
);
}
/**
* List Alias Subscription.
* @param options The options parameters.
*/
list(options?: AliasListOptionalParams): Promise<AliasListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const createOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/aliases/{aliasName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.SubscriptionAliasResponse
},
201: {
bodyMapper: Mappers.SubscriptionAliasResponse
},
202: {
bodyMapper: Mappers.SubscriptionAliasResponse
},
204: {
bodyMapper: Mappers.SubscriptionAliasResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
requestBody: Parameters.body2,
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.aliasName],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/aliases/{aliasName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SubscriptionAliasResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.aliasName],
headerParameters: [Parameters.accept],
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/aliases/{aliasName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.aliasName],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/aliases",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SubscriptionAliasListResult
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
+65
View File
@@ -0,0 +1,65 @@
/*
* 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.
*/
import { BillingAccount } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import {
BillingAccountGetPolicyOptionalParams,
BillingAccountGetPolicyResponse
} from "../models";
/** Class containing BillingAccount operations. */
export class BillingAccountImpl implements BillingAccount {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class BillingAccount class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
this.client = client;
}
/**
* Get Billing Account Policy.
* @param billingAccountId Billing Account Id.
* @param options The options parameters.
*/
getPolicy(
billingAccountId: string,
options?: BillingAccountGetPolicyOptionalParams
): Promise<BillingAccountGetPolicyResponse> {
return this.client.sendOperationRequest(
{ billingAccountId, options },
getPolicyOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getPolicyOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Subscription/policies/default",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.BillingAccountPoliciesResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.billingAccountId],
headerParameters: [Parameters.accept],
serializer
};
+15
View File
@@ -0,0 +1,15 @@
/*
* 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.
*/
export * from "./subscriptions";
export * from "./tenants";
export * from "./subscriptionOperations";
export * from "./operations";
export * from "./alias";
export * from "./subscriptionPolicy";
export * from "./billingAccount";
+150
View File
@@ -0,0 +1,150 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Operations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import {
Operation,
OperationsListNextOptionalParams,
OperationsListOptionalParams,
OperationsListResponse,
OperationsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Operations operations. */
export class OperationsImpl implements Operations {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class Operations class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
this.client = client;
}
/**
* Lists all of the available Microsoft.Subscription API operations.
* @param options The options parameters.
*/
public list(
options?: OperationsListOptionalParams
): PagedAsyncIterableIterator<Operation> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
}
};
}
private async *listPagingPage(
options?: OperationsListOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<Operation[]> {
let result: OperationsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: OperationsListOptionalParams
): AsyncIterableIterator<Operation> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Lists all of the available Microsoft.Subscription API operations.
* @param options The options parameters.
*/
private _list(
options?: OperationsListOptionalParams
): Promise<OperationsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: OperationsListNextOptionalParams
): Promise<OperationsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
@@ -0,0 +1,292 @@
/*
* 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.
*/
import { SubscriptionOperations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
import { LroImpl } from "../lroImpl";
import {
SubscriptionCancelOptionalParams,
SubscriptionCancelResponse,
SubscriptionName,
SubscriptionRenameOptionalParams,
SubscriptionRenameResponse,
SubscriptionEnableOptionalParams,
SubscriptionEnableResponse,
AcceptOwnershipRequest,
SubscriptionAcceptOwnershipOptionalParams,
SubscriptionAcceptOwnershipResponse,
SubscriptionAcceptOwnershipStatusOptionalParams,
SubscriptionAcceptOwnershipStatusResponse
} from "../models";
/** Class containing SubscriptionOperations operations. */
export class SubscriptionOperationsImpl implements SubscriptionOperations {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class SubscriptionOperations class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
this.client = client;
}
/**
* The operation to cancel a subscription
* @param subscriptionId Subscription Id.
* @param options The options parameters.
*/
cancel(
subscriptionId: string,
options?: SubscriptionCancelOptionalParams
): Promise<SubscriptionCancelResponse> {
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: string,
body: SubscriptionName,
options?: SubscriptionRenameOptionalParams
): Promise<SubscriptionRenameResponse> {
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: string,
options?: SubscriptionEnableOptionalParams
): Promise<SubscriptionEnableResponse> {
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.
*/
async beginAcceptOwnership(
subscriptionId: string,
body: AcceptOwnershipRequest,
options?: SubscriptionAcceptOwnershipOptionalParams
): Promise<
PollerLike<
PollOperationState<SubscriptionAcceptOwnershipResponse>,
SubscriptionAcceptOwnershipResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<SubscriptionAcceptOwnershipResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
) => {
let currentRawResponse:
| coreClient.FullOperationResponse
| undefined = undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback
}
};
const flatResponse = await 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 LroEngine(lro, {
resumeFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await 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.
*/
async beginAcceptOwnershipAndWait(
subscriptionId: string,
body: AcceptOwnershipRequest,
options?: SubscriptionAcceptOwnershipOptionalParams
): Promise<SubscriptionAcceptOwnershipResponse> {
const poller = await this.beginAcceptOwnership(
subscriptionId,
body,
options
);
return poller.pollUntilDone();
}
/**
* Accept subscription ownership status.
* @param subscriptionId Subscription Id.
* @param options The options parameters.
*/
acceptOwnershipStatus(
subscriptionId: string,
options?: SubscriptionAcceptOwnershipStatusOptionalParams
): Promise<SubscriptionAcceptOwnershipStatusResponse> {
return this.client.sendOperationRequest(
{ subscriptionId, options },
acceptOwnershipStatusOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const cancelOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.CanceledSubscriptionId
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const renameOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.RenamedSubscriptionId
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
requestBody: Parameters.body,
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const enableOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.EnabledSubscriptionId
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const acceptOwnershipOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnership",
httpMethod: "POST",
responses: {
200: {
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
},
201: {
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
},
202: {
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
},
204: {
headersMapper: Mappers.SubscriptionAcceptOwnershipHeaders
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
requestBody: Parameters.body1,
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const acceptOwnershipStatusOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Subscription/subscriptions/{subscriptionId}/acceptOwnershipStatus",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AcceptOwnershipStatusResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
@@ -0,0 +1,220 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { SubscriptionPolicy } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import {
GetTenantPolicyResponse,
SubscriptionPolicyListPolicyForTenantNextOptionalParams,
SubscriptionPolicyListPolicyForTenantOptionalParams,
SubscriptionPolicyListPolicyForTenantResponse,
PutTenantPolicyRequestProperties,
SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams,
SubscriptionPolicyAddUpdatePolicyForTenantResponse,
SubscriptionPolicyGetPolicyForTenantOptionalParams,
SubscriptionPolicyGetPolicyForTenantResponse,
SubscriptionPolicyListPolicyForTenantNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing SubscriptionPolicy operations. */
export class SubscriptionPolicyImpl implements SubscriptionPolicy {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class SubscriptionPolicy class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
this.client = client;
}
/**
* Get the subscription tenant policy for the user's tenant.
* @param options The options parameters.
*/
public listPolicyForTenant(
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
): PagedAsyncIterableIterator<GetTenantPolicyResponse> {
const iter = this.listPolicyForTenantPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPolicyForTenantPagingPage(options, settings);
}
};
}
private async *listPolicyForTenantPagingPage(
options?: SubscriptionPolicyListPolicyForTenantOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<GetTenantPolicyResponse[]> {
let result: SubscriptionPolicyListPolicyForTenantResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listPolicyForTenant(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listPolicyForTenantNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPolicyForTenantPagingAll(
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
): AsyncIterableIterator<GetTenantPolicyResponse> {
for await (const page of this.listPolicyForTenantPagingPage(options)) {
yield* page;
}
}
/**
* Create or Update Subscription tenant policy for user's tenant.
* @param body Put tenant policy request properties.
* @param options The options parameters.
*/
addUpdatePolicyForTenant(
body: PutTenantPolicyRequestProperties,
options?: SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams
): Promise<SubscriptionPolicyAddUpdatePolicyForTenantResponse> {
return this.client.sendOperationRequest(
{ body, options },
addUpdatePolicyForTenantOperationSpec
);
}
/**
* Get the subscription tenant policy for the user's tenant.
* @param options The options parameters.
*/
getPolicyForTenant(
options?: SubscriptionPolicyGetPolicyForTenantOptionalParams
): Promise<SubscriptionPolicyGetPolicyForTenantResponse> {
return this.client.sendOperationRequest(
{ options },
getPolicyForTenantOperationSpec
);
}
/**
* Get the subscription tenant policy for the user's tenant.
* @param options The options parameters.
*/
private _listPolicyForTenant(
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
): Promise<SubscriptionPolicyListPolicyForTenantResponse> {
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.
*/
private _listPolicyForTenantNext(
nextLink: string,
options?: SubscriptionPolicyListPolicyForTenantNextOptionalParams
): Promise<SubscriptionPolicyListPolicyForTenantNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listPolicyForTenantNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const addUpdatePolicyForTenantOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/policies/default",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.GetTenantPolicyResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
requestBody: Parameters.body3,
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const getPolicyForTenantOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/policies/default",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GetTenantPolicyResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listPolicyForTenantOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.Subscription/policies",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GetTenantPolicyListResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listPolicyForTenantNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GetTenantPolicyListResponse
},
default: {
bodyMapper: Mappers.ErrorResponseBody
}
},
queryParameters: [Parameters.apiVersion1],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
+255
View File
@@ -0,0 +1,255 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Subscriptions } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import {
Location,
SubscriptionsListLocationsOptionalParams,
SubscriptionsListLocationsResponse,
Subscription,
SubscriptionsListNextOptionalParams,
SubscriptionsListOptionalParams,
SubscriptionsListResponse,
SubscriptionsGetOptionalParams,
SubscriptionsGetResponse,
SubscriptionsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Subscriptions operations. */
export class SubscriptionsImpl implements Subscriptions {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class Subscriptions class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
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.
*/
public listLocations(
subscriptionId: string,
options?: SubscriptionsListLocationsOptionalParams
): PagedAsyncIterableIterator<Location> {
const iter = this.listLocationsPagingAll(subscriptionId, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listLocationsPagingPage(subscriptionId, options, settings);
}
};
}
private async *listLocationsPagingPage(
subscriptionId: string,
options?: SubscriptionsListLocationsOptionalParams,
_settings?: PageSettings
): AsyncIterableIterator<Location[]> {
let result: SubscriptionsListLocationsResponse;
result = await this._listLocations(subscriptionId, options);
yield result.value || [];
}
private async *listLocationsPagingAll(
subscriptionId: string,
options?: SubscriptionsListLocationsOptionalParams
): AsyncIterableIterator<Location> {
for await (const page of this.listLocationsPagingPage(
subscriptionId,
options
)) {
yield* page;
}
}
/**
* Gets all subscriptions for a tenant.
* @param options The options parameters.
*/
public list(
options?: SubscriptionsListOptionalParams
): PagedAsyncIterableIterator<Subscription> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
}
};
}
private async *listPagingPage(
options?: SubscriptionsListOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<Subscription[]> {
let result: SubscriptionsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: SubscriptionsListOptionalParams
): AsyncIterableIterator<Subscription> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* 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.
*/
private _listLocations(
subscriptionId: string,
options?: SubscriptionsListLocationsOptionalParams
): Promise<SubscriptionsListLocationsResponse> {
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: string,
options?: SubscriptionsGetOptionalParams
): Promise<SubscriptionsGetResponse> {
return this.client.sendOperationRequest(
{ subscriptionId, options },
getOperationSpec
);
}
/**
* Gets all subscriptions for a tenant.
* @param options The options parameters.
*/
private _list(
options?: SubscriptionsListOptionalParams
): Promise<SubscriptionsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: SubscriptionsListNextOptionalParams
): Promise<SubscriptionsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listLocationsOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/locations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.LocationListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Subscription
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SubscriptionListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.SubscriptionListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
+144
View File
@@ -0,0 +1,144 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Tenants } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SubscriptionClient } from "../subscriptionClient";
import {
TenantIdDescription,
TenantsListNextOptionalParams,
TenantsListOptionalParams,
TenantsListResponse,
TenantsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Tenants operations. */
export class TenantsImpl implements Tenants {
private readonly client: SubscriptionClient;
/**
* Initialize a new instance of the class Tenants class.
* @param client Reference to the service client
*/
constructor(client: SubscriptionClient) {
this.client = client;
}
/**
* Gets the tenants for your account.
* @param options The options parameters.
*/
public list(
options?: TenantsListOptionalParams
): PagedAsyncIterableIterator<TenantIdDescription> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
}
};
}
private async *listPagingPage(
options?: TenantsListOptionalParams,
settings?: PageSettings
): AsyncIterableIterator<TenantIdDescription[]> {
let result: TenantsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: TenantsListOptionalParams
): AsyncIterableIterator<TenantIdDescription> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Gets the tenants for your account.
* @param options The options parameters.
*/
private _list(
options?: TenantsListOptionalParams
): Promise<TenantsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: TenantsListNextOptionalParams
): Promise<TenantsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/tenants",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.TenantListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.TenantListResult
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
@@ -0,0 +1,75 @@
/*
* 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.
*/
import { PollerLike, PollOperationState } from "@azure/core-lro";
import {
PutAliasRequest,
AliasCreateOptionalParams,
AliasCreateResponse,
AliasGetOptionalParams,
AliasGetResponse,
AliasDeleteOptionalParams,
AliasListOptionalParams,
AliasListResponse
} from "../models";
/** Interface representing a Alias. */
export interface Alias {
/**
* 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 doesnt 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: string,
body: PutAliasRequest,
options?: AliasCreateOptionalParams
): Promise<
PollerLike<PollOperationState<AliasCreateResponse>, AliasCreateResponse>
>;
/**
* 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 doesnt 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: string,
body: PutAliasRequest,
options?: AliasCreateOptionalParams
): Promise<AliasCreateResponse>;
/**
* 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 doesnt have any other lifecycle need beyond the request for
* subscription creation.
* @param options The options parameters.
*/
get(
aliasName: string,
options?: AliasGetOptionalParams
): Promise<AliasGetResponse>;
/**
* 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 doesnt have any other lifecycle need beyond the request for
* subscription creation.
* @param options The options parameters.
*/
delete(aliasName: string, options?: AliasDeleteOptionalParams): Promise<void>;
/**
* List Alias Subscription.
* @param options The options parameters.
*/
list(options?: AliasListOptionalParams): Promise<AliasListResponse>;
}
@@ -0,0 +1,25 @@
/*
* 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.
*/
import {
BillingAccountGetPolicyOptionalParams,
BillingAccountGetPolicyResponse
} from "../models";
/** Interface representing a BillingAccount. */
export interface BillingAccount {
/**
* Get Billing Account Policy.
* @param billingAccountId Billing Account Id.
* @param options The options parameters.
*/
getPolicy(
billingAccountId: string,
options?: BillingAccountGetPolicyOptionalParams
): Promise<BillingAccountGetPolicyResponse>;
}
@@ -0,0 +1,15 @@
/*
* 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.
*/
export * from "./subscriptions";
export * from "./tenants";
export * from "./subscriptionOperations";
export * from "./operations";
export * from "./alias";
export * from "./subscriptionPolicy";
export * from "./billingAccount";
@@ -0,0 +1,22 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { Operation, OperationsListOptionalParams } from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Operations. */
export interface Operations {
/**
* Lists all of the available Microsoft.Subscription API operations.
* @param options The options parameters.
*/
list(
options?: OperationsListOptionalParams
): PagedAsyncIterableIterator<Operation>;
}
@@ -0,0 +1,92 @@
/*
* 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.
*/
import { PollerLike, PollOperationState } from "@azure/core-lro";
import {
SubscriptionCancelOptionalParams,
SubscriptionCancelResponse,
SubscriptionName,
SubscriptionRenameOptionalParams,
SubscriptionRenameResponse,
SubscriptionEnableOptionalParams,
SubscriptionEnableResponse,
AcceptOwnershipRequest,
SubscriptionAcceptOwnershipOptionalParams,
SubscriptionAcceptOwnershipResponse,
SubscriptionAcceptOwnershipStatusOptionalParams,
SubscriptionAcceptOwnershipStatusResponse
} from "../models";
/** Interface representing a SubscriptionOperations. */
export interface SubscriptionOperations {
/**
* The operation to cancel a subscription
* @param subscriptionId Subscription Id.
* @param options The options parameters.
*/
cancel(
subscriptionId: string,
options?: SubscriptionCancelOptionalParams
): Promise<SubscriptionCancelResponse>;
/**
* The operation to rename a subscription
* @param subscriptionId Subscription Id.
* @param body Subscription Name
* @param options The options parameters.
*/
rename(
subscriptionId: string,
body: SubscriptionName,
options?: SubscriptionRenameOptionalParams
): Promise<SubscriptionRenameResponse>;
/**
* The operation to enable a subscription
* @param subscriptionId Subscription Id.
* @param options The options parameters.
*/
enable(
subscriptionId: string,
options?: SubscriptionEnableOptionalParams
): Promise<SubscriptionEnableResponse>;
/**
* Accept subscription ownership.
* @param subscriptionId Subscription Id.
* @param body The parameters required to accept subscription ownership.
* @param options The options parameters.
*/
beginAcceptOwnership(
subscriptionId: string,
body: AcceptOwnershipRequest,
options?: SubscriptionAcceptOwnershipOptionalParams
): Promise<
PollerLike<
PollOperationState<SubscriptionAcceptOwnershipResponse>,
SubscriptionAcceptOwnershipResponse
>
>;
/**
* Accept subscription ownership.
* @param subscriptionId Subscription Id.
* @param body The parameters required to accept subscription ownership.
* @param options The options parameters.
*/
beginAcceptOwnershipAndWait(
subscriptionId: string,
body: AcceptOwnershipRequest,
options?: SubscriptionAcceptOwnershipOptionalParams
): Promise<SubscriptionAcceptOwnershipResponse>;
/**
* Accept subscription ownership status.
* @param subscriptionId Subscription Id.
* @param options The options parameters.
*/
acceptOwnershipStatus(
subscriptionId: string,
options?: SubscriptionAcceptOwnershipStatusOptionalParams
): Promise<SubscriptionAcceptOwnershipStatusResponse>;
}
@@ -0,0 +1,46 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import {
GetTenantPolicyResponse,
SubscriptionPolicyListPolicyForTenantOptionalParams,
PutTenantPolicyRequestProperties,
SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams,
SubscriptionPolicyAddUpdatePolicyForTenantResponse,
SubscriptionPolicyGetPolicyForTenantOptionalParams,
SubscriptionPolicyGetPolicyForTenantResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a SubscriptionPolicy. */
export interface SubscriptionPolicy {
/**
* Get the subscription tenant policy for the user's tenant.
* @param options The options parameters.
*/
listPolicyForTenant(
options?: SubscriptionPolicyListPolicyForTenantOptionalParams
): PagedAsyncIterableIterator<GetTenantPolicyResponse>;
/**
* Create or Update Subscription tenant policy for user's tenant.
* @param body Put tenant policy request properties.
* @param options The options parameters.
*/
addUpdatePolicyForTenant(
body: PutTenantPolicyRequestProperties,
options?: SubscriptionPolicyAddUpdatePolicyForTenantOptionalParams
): Promise<SubscriptionPolicyAddUpdatePolicyForTenantResponse>;
/**
* Get the subscription tenant policy for the user's tenant.
* @param options The options parameters.
*/
getPolicyForTenant(
options?: SubscriptionPolicyGetPolicyForTenantOptionalParams
): Promise<SubscriptionPolicyGetPolicyForTenantResponse>;
}
@@ -0,0 +1,48 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import {
Location,
SubscriptionsListLocationsOptionalParams,
Subscription,
SubscriptionsListOptionalParams,
SubscriptionsGetOptionalParams,
SubscriptionsGetResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Subscriptions. */
export interface Subscriptions {
/**
* 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: string,
options?: SubscriptionsListLocationsOptionalParams
): PagedAsyncIterableIterator<Location>;
/**
* Gets all subscriptions for a tenant.
* @param options The options parameters.
*/
list(
options?: SubscriptionsListOptionalParams
): PagedAsyncIterableIterator<Subscription>;
/**
* Gets details about a specified subscription.
* @param subscriptionId The ID of the target subscription.
* @param options The options parameters.
*/
get(
subscriptionId: string,
options?: SubscriptionsGetOptionalParams
): Promise<SubscriptionsGetResponse>;
}
@@ -0,0 +1,22 @@
/*
* 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.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { TenantIdDescription, TenantsListOptionalParams } from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Tenants. */
export interface Tenants {
/**
* Gets the tenants for your account.
* @param options The options parameters.
*/
list(
options?: TenantsListOptionalParams
): PagedAsyncIterableIterator<TenantIdDescription>;
}
+39
View File
@@ -0,0 +1,39 @@
/*
* 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.
*/
export interface PageInfo {
continuationToken?: string;
}
const pageMap = new WeakMap<object, PageInfo>();
/**
* 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().
*/
export function getContinuationToken(page: unknown): string | undefined {
if (typeof page !== "object" || page === null) {
return undefined;
}
return pageMap.get(page)?.continuationToken;
}
export function setContinuationToken(
page: unknown,
continuationToken: string | undefined
): void {
if (typeof page !== "object" || page === null || !continuationToken) {
return;
}
const pageInfo = pageMap.get(page) ?? {};
pageInfo.continuationToken = continuationToken;
pageMap.set(page, pageInfo);
}
+124
View File
@@ -0,0 +1,124 @@
/*
* 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.
*/
import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
SubscriptionsImpl,
TenantsImpl,
SubscriptionOperationsImpl,
OperationsImpl,
AliasImpl,
SubscriptionPolicyImpl,
BillingAccountImpl
} from "./operations";
import {
Subscriptions,
Tenants,
SubscriptionOperations,
Operations,
Alias,
SubscriptionPolicy,
BillingAccount
} from "./operationsInterfaces";
import { SubscriptionClientOptionalParams } from "./models";
export class SubscriptionClient extends coreClient.ServiceClient {
$host: string;
/**
* Initializes a new instance of the SubscriptionClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param options The parameter options
*/
constructor(
credentials: coreAuth.TokenCredential,
options?: SubscriptionClientOptionalParams
) {
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
const defaults: SubscriptionClientOptionalParams = {
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 = {
...defaults,
...options,
userAgentOptions: {
userAgentPrefix
},
endpoint:
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
};
super(optionsWithDefaults);
let bearerTokenAuthenticationPolicyFound: boolean = false;
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName
);
}
if (
!options ||
!options.pipeline ||
options.pipeline.getOrderedPolicies().length == 0 ||
!bearerTokenAuthenticationPolicyFound
) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
credential: credentials,
scopes:
optionsWithDefaults.credentialScopes ??
`${optionsWithDefaults.endpoint}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.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);
}
subscriptions: Subscriptions;
tenants: Tenants;
subscriptionOperations: SubscriptionOperations;
operations: Operations;
alias: Alias;
subscriptionPolicy: SubscriptionPolicy;
billingAccount: BillingAccount;
}