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
@@ -0,0 +1,941 @@
/*
* 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 { DeploymentOperations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import {
DeploymentOperation,
DeploymentOperationsListAtScopeNextOptionalParams,
DeploymentOperationsListAtScopeOptionalParams,
DeploymentOperationsListAtTenantScopeNextOptionalParams,
DeploymentOperationsListAtTenantScopeOptionalParams,
DeploymentOperationsListAtManagementGroupScopeNextOptionalParams,
DeploymentOperationsListAtManagementGroupScopeOptionalParams,
DeploymentOperationsListAtSubscriptionScopeNextOptionalParams,
DeploymentOperationsListAtSubscriptionScopeOptionalParams,
DeploymentOperationsListNextOptionalParams,
DeploymentOperationsListOptionalParams,
DeploymentOperationsGetAtScopeOptionalParams,
DeploymentOperationsGetAtScopeResponse,
DeploymentOperationsListAtScopeResponse,
DeploymentOperationsGetAtTenantScopeOptionalParams,
DeploymentOperationsGetAtTenantScopeResponse,
DeploymentOperationsListAtTenantScopeResponse,
DeploymentOperationsGetAtManagementGroupScopeOptionalParams,
DeploymentOperationsGetAtManagementGroupScopeResponse,
DeploymentOperationsListAtManagementGroupScopeResponse,
DeploymentOperationsGetAtSubscriptionScopeOptionalParams,
DeploymentOperationsGetAtSubscriptionScopeResponse,
DeploymentOperationsListAtSubscriptionScopeResponse,
DeploymentOperationsGetOptionalParams,
DeploymentOperationsGetResponse,
DeploymentOperationsListResponse,
DeploymentOperationsListAtScopeNextResponse,
DeploymentOperationsListAtTenantScopeNextResponse,
DeploymentOperationsListAtManagementGroupScopeNextResponse,
DeploymentOperationsListAtSubscriptionScopeNextResponse,
DeploymentOperationsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing DeploymentOperations operations. */
export class DeploymentOperationsImpl implements DeploymentOperations {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class DeploymentOperations class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* Gets all deployments operations for a deployment.
* @param scope The resource scope.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
public listAtScope(
scope: string,
deploymentName: string,
options?: DeploymentOperationsListAtScopeOptionalParams
): PagedAsyncIterableIterator<DeploymentOperation> {
const iter = this.listAtScopePagingAll(scope, deploymentName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAtScopePagingPage(scope, deploymentName, options);
}
};
}
private async *listAtScopePagingPage(
scope: string,
deploymentName: string,
options?: DeploymentOperationsListAtScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation[]> {
let result = await this._listAtScope(scope, deploymentName, options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listAtScopeNext(
scope,
deploymentName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listAtScopePagingAll(
scope: string,
deploymentName: string,
options?: DeploymentOperationsListAtScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation> {
for await (const page of this.listAtScopePagingPage(
scope,
deploymentName,
options
)) {
yield* page;
}
}
/**
* Gets all deployments operations for a deployment.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
public listAtTenantScope(
deploymentName: string,
options?: DeploymentOperationsListAtTenantScopeOptionalParams
): PagedAsyncIterableIterator<DeploymentOperation> {
const iter = this.listAtTenantScopePagingAll(deploymentName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAtTenantScopePagingPage(deploymentName, options);
}
};
}
private async *listAtTenantScopePagingPage(
deploymentName: string,
options?: DeploymentOperationsListAtTenantScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation[]> {
let result = await this._listAtTenantScope(deploymentName, options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listAtTenantScopeNext(
deploymentName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listAtTenantScopePagingAll(
deploymentName: string,
options?: DeploymentOperationsListAtTenantScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation> {
for await (const page of this.listAtTenantScopePagingPage(
deploymentName,
options
)) {
yield* page;
}
}
/**
* Gets all deployments operations for a deployment.
* @param groupId The management group ID.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
public listAtManagementGroupScope(
groupId: string,
deploymentName: string,
options?: DeploymentOperationsListAtManagementGroupScopeOptionalParams
): PagedAsyncIterableIterator<DeploymentOperation> {
const iter = this.listAtManagementGroupScopePagingAll(
groupId,
deploymentName,
options
);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAtManagementGroupScopePagingPage(
groupId,
deploymentName,
options
);
}
};
}
private async *listAtManagementGroupScopePagingPage(
groupId: string,
deploymentName: string,
options?: DeploymentOperationsListAtManagementGroupScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation[]> {
let result = await this._listAtManagementGroupScope(
groupId,
deploymentName,
options
);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listAtManagementGroupScopeNext(
groupId,
deploymentName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listAtManagementGroupScopePagingAll(
groupId: string,
deploymentName: string,
options?: DeploymentOperationsListAtManagementGroupScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation> {
for await (const page of this.listAtManagementGroupScopePagingPage(
groupId,
deploymentName,
options
)) {
yield* page;
}
}
/**
* Gets all deployments operations for a deployment.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
public listAtSubscriptionScope(
deploymentName: string,
options?: DeploymentOperationsListAtSubscriptionScopeOptionalParams
): PagedAsyncIterableIterator<DeploymentOperation> {
const iter = this.listAtSubscriptionScopePagingAll(deploymentName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAtSubscriptionScopePagingPage(deploymentName, options);
}
};
}
private async *listAtSubscriptionScopePagingPage(
deploymentName: string,
options?: DeploymentOperationsListAtSubscriptionScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation[]> {
let result = await this._listAtSubscriptionScope(deploymentName, options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listAtSubscriptionScopeNext(
deploymentName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listAtSubscriptionScopePagingAll(
deploymentName: string,
options?: DeploymentOperationsListAtSubscriptionScopeOptionalParams
): AsyncIterableIterator<DeploymentOperation> {
for await (const page of this.listAtSubscriptionScopePagingPage(
deploymentName,
options
)) {
yield* page;
}
}
/**
* Gets all deployments operations for a deployment.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
public list(
resourceGroupName: string,
deploymentName: string,
options?: DeploymentOperationsListOptionalParams
): PagedAsyncIterableIterator<DeploymentOperation> {
const iter = this.listPagingAll(resourceGroupName, deploymentName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(resourceGroupName, deploymentName, options);
}
};
}
private async *listPagingPage(
resourceGroupName: string,
deploymentName: string,
options?: DeploymentOperationsListOptionalParams
): AsyncIterableIterator<DeploymentOperation[]> {
let result = await this._list(resourceGroupName, deploymentName, options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(
resourceGroupName,
deploymentName,
continuationToken,
options
);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
resourceGroupName: string,
deploymentName: string,
options?: DeploymentOperationsListOptionalParams
): AsyncIterableIterator<DeploymentOperation> {
for await (const page of this.listPagingPage(
resourceGroupName,
deploymentName,
options
)) {
yield* page;
}
}
/**
* Gets a deployments operation.
* @param scope The resource scope.
* @param deploymentName The name of the deployment.
* @param operationId The ID of the operation to get.
* @param options The options parameters.
*/
getAtScope(
scope: string,
deploymentName: string,
operationId: string,
options?: DeploymentOperationsGetAtScopeOptionalParams
): Promise<DeploymentOperationsGetAtScopeResponse> {
return this.client.sendOperationRequest(
{ scope, deploymentName, operationId, options },
getAtScopeOperationSpec
);
}
/**
* Gets all deployments operations for a deployment.
* @param scope The resource scope.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
private _listAtScope(
scope: string,
deploymentName: string,
options?: DeploymentOperationsListAtScopeOptionalParams
): Promise<DeploymentOperationsListAtScopeResponse> {
return this.client.sendOperationRequest(
{ scope, deploymentName, options },
listAtScopeOperationSpec
);
}
/**
* Gets a deployments operation.
* @param deploymentName The name of the deployment.
* @param operationId The ID of the operation to get.
* @param options The options parameters.
*/
getAtTenantScope(
deploymentName: string,
operationId: string,
options?: DeploymentOperationsGetAtTenantScopeOptionalParams
): Promise<DeploymentOperationsGetAtTenantScopeResponse> {
return this.client.sendOperationRequest(
{ deploymentName, operationId, options },
getAtTenantScopeOperationSpec
);
}
/**
* Gets all deployments operations for a deployment.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
private _listAtTenantScope(
deploymentName: string,
options?: DeploymentOperationsListAtTenantScopeOptionalParams
): Promise<DeploymentOperationsListAtTenantScopeResponse> {
return this.client.sendOperationRequest(
{ deploymentName, options },
listAtTenantScopeOperationSpec
);
}
/**
* Gets a deployments operation.
* @param groupId The management group ID.
* @param deploymentName The name of the deployment.
* @param operationId The ID of the operation to get.
* @param options The options parameters.
*/
getAtManagementGroupScope(
groupId: string,
deploymentName: string,
operationId: string,
options?: DeploymentOperationsGetAtManagementGroupScopeOptionalParams
): Promise<DeploymentOperationsGetAtManagementGroupScopeResponse> {
return this.client.sendOperationRequest(
{ groupId, deploymentName, operationId, options },
getAtManagementGroupScopeOperationSpec
);
}
/**
* Gets all deployments operations for a deployment.
* @param groupId The management group ID.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
private _listAtManagementGroupScope(
groupId: string,
deploymentName: string,
options?: DeploymentOperationsListAtManagementGroupScopeOptionalParams
): Promise<DeploymentOperationsListAtManagementGroupScopeResponse> {
return this.client.sendOperationRequest(
{ groupId, deploymentName, options },
listAtManagementGroupScopeOperationSpec
);
}
/**
* Gets a deployments operation.
* @param deploymentName The name of the deployment.
* @param operationId The ID of the operation to get.
* @param options The options parameters.
*/
getAtSubscriptionScope(
deploymentName: string,
operationId: string,
options?: DeploymentOperationsGetAtSubscriptionScopeOptionalParams
): Promise<DeploymentOperationsGetAtSubscriptionScopeResponse> {
return this.client.sendOperationRequest(
{ deploymentName, operationId, options },
getAtSubscriptionScopeOperationSpec
);
}
/**
* Gets all deployments operations for a deployment.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
private _listAtSubscriptionScope(
deploymentName: string,
options?: DeploymentOperationsListAtSubscriptionScopeOptionalParams
): Promise<DeploymentOperationsListAtSubscriptionScopeResponse> {
return this.client.sendOperationRequest(
{ deploymentName, options },
listAtSubscriptionScopeOperationSpec
);
}
/**
* Gets a deployments operation.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentName The name of the deployment.
* @param operationId The ID of the operation to get.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
deploymentName: string,
operationId: string,
options?: DeploymentOperationsGetOptionalParams
): Promise<DeploymentOperationsGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, deploymentName, operationId, options },
getOperationSpec
);
}
/**
* Gets all deployments operations for a deployment.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentName The name of the deployment.
* @param options The options parameters.
*/
private _list(
resourceGroupName: string,
deploymentName: string,
options?: DeploymentOperationsListOptionalParams
): Promise<DeploymentOperationsListResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, deploymentName, options },
listOperationSpec
);
}
/**
* ListAtScopeNext
* @param scope The resource scope.
* @param deploymentName The name of the deployment.
* @param nextLink The nextLink from the previous successful call to the ListAtScope method.
* @param options The options parameters.
*/
private _listAtScopeNext(
scope: string,
deploymentName: string,
nextLink: string,
options?: DeploymentOperationsListAtScopeNextOptionalParams
): Promise<DeploymentOperationsListAtScopeNextResponse> {
return this.client.sendOperationRequest(
{ scope, deploymentName, nextLink, options },
listAtScopeNextOperationSpec
);
}
/**
* ListAtTenantScopeNext
* @param deploymentName The name of the deployment.
* @param nextLink The nextLink from the previous successful call to the ListAtTenantScope method.
* @param options The options parameters.
*/
private _listAtTenantScopeNext(
deploymentName: string,
nextLink: string,
options?: DeploymentOperationsListAtTenantScopeNextOptionalParams
): Promise<DeploymentOperationsListAtTenantScopeNextResponse> {
return this.client.sendOperationRequest(
{ deploymentName, nextLink, options },
listAtTenantScopeNextOperationSpec
);
}
/**
* ListAtManagementGroupScopeNext
* @param groupId The management group ID.
* @param deploymentName The name of the deployment.
* @param nextLink The nextLink from the previous successful call to the ListAtManagementGroupScope
* method.
* @param options The options parameters.
*/
private _listAtManagementGroupScopeNext(
groupId: string,
deploymentName: string,
nextLink: string,
options?: DeploymentOperationsListAtManagementGroupScopeNextOptionalParams
): Promise<DeploymentOperationsListAtManagementGroupScopeNextResponse> {
return this.client.sendOperationRequest(
{ groupId, deploymentName, nextLink, options },
listAtManagementGroupScopeNextOperationSpec
);
}
/**
* ListAtSubscriptionScopeNext
* @param deploymentName The name of the deployment.
* @param nextLink The nextLink from the previous successful call to the ListAtSubscriptionScope
* method.
* @param options The options parameters.
*/
private _listAtSubscriptionScopeNext(
deploymentName: string,
nextLink: string,
options?: DeploymentOperationsListAtSubscriptionScopeNextOptionalParams
): Promise<DeploymentOperationsListAtSubscriptionScopeNextResponse> {
return this.client.sendOperationRequest(
{ deploymentName, nextLink, options },
listAtSubscriptionScopeNextOperationSpec
);
}
/**
* ListNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param deploymentName The name of the deployment.
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
resourceGroupName: string,
deploymentName: string,
nextLink: string,
options?: DeploymentOperationsListNextOptionalParams
): Promise<DeploymentOperationsListNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, deploymentName, nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getAtScopeOperationSpec: coreClient.OperationSpec = {
path:
"/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.deploymentName,
Parameters.operationId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtScopeOperationSpec: coreClient.OperationSpec = {
path:
"/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.scope,
Parameters.deploymentName
],
headerParameters: [Parameters.accept],
serializer
};
const getAtTenantScopeOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.operationId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtTenantScopeOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Resources/deployments/{deploymentName}/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [Parameters.$host, Parameters.deploymentName],
headerParameters: [Parameters.accept],
serializer
};
const getAtManagementGroupScopeOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.groupId,
Parameters.operationId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtManagementGroupScopeOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.groupId
],
headerParameters: [Parameters.accept],
serializer
};
const getAtSubscriptionScopeOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.subscriptionId,
Parameters.operationId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtSubscriptionScopeOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperation
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.operationId
],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.deploymentName,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const listAtScopeNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.scope,
Parameters.deploymentName
],
headerParameters: [Parameters.accept],
serializer
};
const listAtTenantScopeNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.deploymentName
],
headerParameters: [Parameters.accept],
serializer
};
const listAtManagementGroupScopeNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.deploymentName,
Parameters.groupId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtSubscriptionScopeNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.deploymentName,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.DeploymentOperationsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.deploymentName,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
/*
* 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 "./operations";
export * from "./deployments";
export * from "./providers";
export * from "./providerResourceTypes";
export * from "./resources";
export * from "./resourceGroups";
export * from "./tagsOperations";
export * from "./deploymentOperations";
+137
View File
@@ -0,0 +1,137 @@
/*
* 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 { Operations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import {
Operation,
OperationsListNextOptionalParams,
OperationsListOptionalParams,
OperationsListResponse,
OperationsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Operations operations. */
export class OperationsImpl implements Operations {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class Operations class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* Lists all of the available Microsoft.Resources REST 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: () => {
return this.listPagingPage(options);
}
};
}
private async *listPagingPage(
options?: OperationsListOptionalParams
): AsyncIterableIterator<Operation[]> {
let result = await this._list(options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
options?: OperationsListOptionalParams
): AsyncIterableIterator<Operation> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Lists all of the available Microsoft.Resources REST 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.Resources/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
@@ -0,0 +1,69 @@
/*
* 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 { ProviderResourceTypes } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import {
ProviderResourceTypesListOptionalParams,
ProviderResourceTypesListResponse
} from "../models";
/** Class containing ProviderResourceTypes operations. */
export class ProviderResourceTypesImpl implements ProviderResourceTypes {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class ProviderResourceTypes class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* List the resource types for a specified resource provider.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param options The options parameters.
*/
list(
resourceProviderNamespace: string,
options?: ProviderResourceTypesListOptionalParams
): Promise<ProviderResourceTypesListResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
listOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderResourceTypeListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept],
serializer
};
+470
View File
@@ -0,0 +1,470 @@
/*
* 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 { Providers } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import {
Provider,
ProvidersListNextOptionalParams,
ProvidersListOptionalParams,
ProvidersListAtTenantScopeNextOptionalParams,
ProvidersListAtTenantScopeOptionalParams,
ProvidersUnregisterOptionalParams,
ProvidersUnregisterResponse,
ProvidersRegisterAtManagementGroupScopeOptionalParams,
ProvidersProviderPermissionsOptionalParams,
ProvidersProviderPermissionsResponse,
ProvidersRegisterOptionalParams,
ProvidersRegisterResponse,
ProvidersListResponse,
ProvidersListAtTenantScopeResponse,
ProvidersGetOptionalParams,
ProvidersGetResponse,
ProvidersGetAtTenantScopeOptionalParams,
ProvidersGetAtTenantScopeResponse,
ProvidersListNextResponse,
ProvidersListAtTenantScopeNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Providers operations. */
export class ProvidersImpl implements Providers {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class Providers class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* Gets all resource providers for a subscription.
* @param options The options parameters.
*/
public list(
options?: ProvidersListOptionalParams
): PagedAsyncIterableIterator<Provider> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(options);
}
};
}
private async *listPagingPage(
options?: ProvidersListOptionalParams
): AsyncIterableIterator<Provider[]> {
let result = await this._list(options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
options?: ProvidersListOptionalParams
): AsyncIterableIterator<Provider> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Gets all resource providers for the tenant.
* @param options The options parameters.
*/
public listAtTenantScope(
options?: ProvidersListAtTenantScopeOptionalParams
): PagedAsyncIterableIterator<Provider> {
const iter = this.listAtTenantScopePagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listAtTenantScopePagingPage(options);
}
};
}
private async *listAtTenantScopePagingPage(
options?: ProvidersListAtTenantScopeOptionalParams
): AsyncIterableIterator<Provider[]> {
let result = await this._listAtTenantScope(options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listAtTenantScopeNext(continuationToken, options);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listAtTenantScopePagingAll(
options?: ProvidersListAtTenantScopeOptionalParams
): AsyncIterableIterator<Provider> {
for await (const page of this.listAtTenantScopePagingPage(options)) {
yield* page;
}
}
/**
* Unregisters a subscription from a resource provider.
* @param resourceProviderNamespace The namespace of the resource provider to unregister.
* @param options The options parameters.
*/
unregister(
resourceProviderNamespace: string,
options?: ProvidersUnregisterOptionalParams
): Promise<ProvidersUnregisterResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
unregisterOperationSpec
);
}
/**
* Registers a management group with a resource provider.
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param groupId The management group ID.
* @param options The options parameters.
*/
registerAtManagementGroupScope(
resourceProviderNamespace: string,
groupId: string,
options?: ProvidersRegisterAtManagementGroupScopeOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, groupId, options },
registerAtManagementGroupScopeOperationSpec
);
}
/**
* Get the provider permissions.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param options The options parameters.
*/
providerPermissions(
resourceProviderNamespace: string,
options?: ProvidersProviderPermissionsOptionalParams
): Promise<ProvidersProviderPermissionsResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
providerPermissionsOperationSpec
);
}
/**
* Registers a subscription with a resource provider.
* @param resourceProviderNamespace The namespace of the resource provider to register.
* @param options The options parameters.
*/
register(
resourceProviderNamespace: string,
options?: ProvidersRegisterOptionalParams
): Promise<ProvidersRegisterResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
registerOperationSpec
);
}
/**
* Gets all resource providers for a subscription.
* @param options The options parameters.
*/
private _list(
options?: ProvidersListOptionalParams
): Promise<ProvidersListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* Gets all resource providers for the tenant.
* @param options The options parameters.
*/
private _listAtTenantScope(
options?: ProvidersListAtTenantScopeOptionalParams
): Promise<ProvidersListAtTenantScopeResponse> {
return this.client.sendOperationRequest(
{ options },
listAtTenantScopeOperationSpec
);
}
/**
* Gets the specified resource provider.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param options The options parameters.
*/
get(
resourceProviderNamespace: string,
options?: ProvidersGetOptionalParams
): Promise<ProvidersGetResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
getOperationSpec
);
}
/**
* Gets the specified resource provider at the tenant level.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param options The options parameters.
*/
getAtTenantScope(
resourceProviderNamespace: string,
options?: ProvidersGetAtTenantScopeOptionalParams
): Promise<ProvidersGetAtTenantScopeResponse> {
return this.client.sendOperationRequest(
{ resourceProviderNamespace, options },
getAtTenantScopeOperationSpec
);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: ProvidersListNextOptionalParams
): Promise<ProvidersListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
/**
* ListAtTenantScopeNext
* @param nextLink The nextLink from the previous successful call to the ListAtTenantScope method.
* @param options The options parameters.
*/
private _listAtTenantScopeNext(
nextLink: string,
options?: ProvidersListAtTenantScopeNextOptionalParams
): Promise<ProvidersListAtTenantScopeNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listAtTenantScopeNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const unregisterOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.Provider
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept],
serializer
};
const registerAtManagementGroupScopeOperationSpec: coreClient.OperationSpec = {
path:
"/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register",
httpMethod: "POST",
responses: {
200: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.groupId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept],
serializer
};
const providerPermissionsOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderPermissionListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept],
serializer
};
const registerOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.Provider
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.properties,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listAtTenantScopeOperationSpec: coreClient.OperationSpec = {
path: "/providers",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Provider
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceProviderNamespace
],
headerParameters: [Parameters.accept],
serializer
};
const getAtTenantScopeOperationSpec: coreClient.OperationSpec = {
path: "/providers/{resourceProviderNamespace}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Provider
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [Parameters.$host, Parameters.resourceProviderNamespace],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
const listAtTenantScopeNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ProviderListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.expand],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer
};
+527
View File
@@ -0,0 +1,527 @@
/*
* 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 { ResourceGroups } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
import { LroImpl } from "../lroImpl";
import {
ResourceGroup,
ResourceGroupsListNextOptionalParams,
ResourceGroupsListOptionalParams,
ResourceGroupsCheckExistenceOptionalParams,
ResourceGroupsCheckExistenceResponse,
ResourceGroupsCreateOrUpdateOptionalParams,
ResourceGroupsCreateOrUpdateResponse,
ResourceGroupsDeleteOptionalParams,
ResourceGroupsGetOptionalParams,
ResourceGroupsGetResponse,
ResourceGroupPatchable,
ResourceGroupsUpdateOptionalParams,
ResourceGroupsUpdateResponse,
ExportTemplateRequest,
ResourceGroupsExportTemplateOptionalParams,
ResourceGroupsExportTemplateResponse,
ResourceGroupsListResponse,
ResourceGroupsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing ResourceGroups operations. */
export class ResourceGroupsImpl implements ResourceGroups {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class ResourceGroups class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* Gets all the resource groups for a subscription.
* @param options The options parameters.
*/
public list(
options?: ResourceGroupsListOptionalParams
): PagedAsyncIterableIterator<ResourceGroup> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(options);
}
};
}
private async *listPagingPage(
options?: ResourceGroupsListOptionalParams
): AsyncIterableIterator<ResourceGroup[]> {
let result = await this._list(options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
options?: ResourceGroupsListOptionalParams
): AsyncIterableIterator<ResourceGroup> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* Checks whether a resource group exists.
* @param resourceGroupName The name of the resource group to check. The name is case insensitive.
* @param options The options parameters.
*/
checkExistence(
resourceGroupName: string,
options?: ResourceGroupsCheckExistenceOptionalParams
): Promise<ResourceGroupsCheckExistenceResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
checkExistenceOperationSpec
);
}
/**
* Creates or updates a resource group.
* @param resourceGroupName The name of the resource group to create or update. Can include
* alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that
* match the allowed characters.
* @param parameters Parameters supplied to the create or update a resource group.
* @param options The options parameters.
*/
createOrUpdate(
resourceGroupName: string,
parameters: ResourceGroup,
options?: ResourceGroupsCreateOrUpdateOptionalParams
): Promise<ResourceGroupsCreateOrUpdateResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, parameters, options },
createOrUpdateOperationSpec
);
}
/**
* When you delete a resource group, all of its resources are also deleted. Deleting a resource group
* deletes all of its template deployments and currently stored operations.
* @param resourceGroupName The name of the resource group to delete. The name is case insensitive.
* @param options The options parameters.
*/
async beginDelete(
resourceGroupName: string,
options?: ResourceGroupsDeleteOptionalParams
): Promise<PollerLike<PollOperationState<void>, void>> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<void> => {
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,
{ resourceGroupName, options },
deleteOperationSpec
);
const poller = new LroEngine(lro, {
resumeFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs
});
await poller.poll();
return poller;
}
/**
* When you delete a resource group, all of its resources are also deleted. Deleting a resource group
* deletes all of its template deployments and currently stored operations.
* @param resourceGroupName The name of the resource group to delete. The name is case insensitive.
* @param options The options parameters.
*/
async beginDeleteAndWait(
resourceGroupName: string,
options?: ResourceGroupsDeleteOptionalParams
): Promise<void> {
const poller = await this.beginDelete(resourceGroupName, options);
return poller.pollUntilDone();
}
/**
* Gets a resource group.
* @param resourceGroupName The name of the resource group to get. The name is case insensitive.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
options?: ResourceGroupsGetOptionalParams
): Promise<ResourceGroupsGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
getOperationSpec
);
}
/**
* Resource groups can be updated through a simple PATCH operation to a group address. The format of
* the request is the same as that for creating a resource group. If a field is unspecified, the
* current value is retained.
* @param resourceGroupName The name of the resource group to update. The name is case insensitive.
* @param parameters Parameters supplied to update a resource group.
* @param options The options parameters.
*/
update(
resourceGroupName: string,
parameters: ResourceGroupPatchable,
options?: ResourceGroupsUpdateOptionalParams
): Promise<ResourceGroupsUpdateResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, parameters, options },
updateOperationSpec
);
}
/**
* Captures the specified resource group as a template.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param parameters Parameters for exporting the template.
* @param options The options parameters.
*/
async beginExportTemplate(
resourceGroupName: string,
parameters: ExportTemplateRequest,
options?: ResourceGroupsExportTemplateOptionalParams
): Promise<
PollerLike<
PollOperationState<ResourceGroupsExportTemplateResponse>,
ResourceGroupsExportTemplateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec
): Promise<ResourceGroupsExportTemplateResponse> => {
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,
{ resourceGroupName, parameters, options },
exportTemplateOperationSpec
);
const poller = new LroEngine(lro, {
resumeFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
lroResourceLocationConfig: "location"
});
await poller.poll();
return poller;
}
/**
* Captures the specified resource group as a template.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param parameters Parameters for exporting the template.
* @param options The options parameters.
*/
async beginExportTemplateAndWait(
resourceGroupName: string,
parameters: ExportTemplateRequest,
options?: ResourceGroupsExportTemplateOptionalParams
): Promise<ResourceGroupsExportTemplateResponse> {
const poller = await this.beginExportTemplate(
resourceGroupName,
parameters,
options
);
return poller.pollUntilDone();
}
/**
* Gets all the resource groups for a subscription.
* @param options The options parameters.
*/
private _list(
options?: ResourceGroupsListOptionalParams
): Promise<ResourceGroupsListResponse> {
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?: ResourceGroupsListNextOptionalParams
): Promise<ResourceGroupsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const checkExistenceOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}",
httpMethod: "HEAD",
responses: {
204: {},
404: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.ResourceGroup
},
201: {
bodyMapper: Mappers.ResourceGroup
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters6,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}",
httpMethod: "DELETE",
responses: {
200: {},
201: {},
202: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.forceDeletionTypes],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceGroup
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept],
serializer
};
const updateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.ResourceGroup
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters7,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const exportTemplateOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate",
httpMethod: "POST",
responses: {
200: {
bodyMapper: Mappers.ResourceGroupExportResult
},
201: {
bodyMapper: Mappers.ResourceGroupExportResult
},
202: {
bodyMapper: Mappers.ResourceGroupExportResult
},
204: {
bodyMapper: Mappers.ResourceGroupExportResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters8,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName1
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourcegroups",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceGroupListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ResourceGroupListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};
File diff suppressed because it is too large Load Diff
+451
View File
@@ -0,0 +1,451 @@
/*
* 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 { TagsOperations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { ResourceManagementClient } from "../resourceManagementClient";
import {
TagDetails,
TagsListNextOptionalParams,
TagsListOptionalParams,
TagsDeleteValueOptionalParams,
TagsCreateOrUpdateValueOptionalParams,
TagsCreateOrUpdateValueResponse,
TagsCreateOrUpdateOptionalParams,
TagsCreateOrUpdateResponse,
TagsDeleteOptionalParams,
TagsListResponse,
TagsResource,
TagsCreateOrUpdateAtScopeOptionalParams,
TagsCreateOrUpdateAtScopeResponse,
TagsPatchResource,
TagsUpdateAtScopeOptionalParams,
TagsUpdateAtScopeResponse,
TagsGetAtScopeOptionalParams,
TagsGetAtScopeResponse,
TagsDeleteAtScopeOptionalParams,
TagsListNextResponse
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing TagsOperations operations. */
export class TagsOperationsImpl implements TagsOperations {
private readonly client: ResourceManagementClient;
/**
* Initialize a new instance of the class TagsOperations class.
* @param client Reference to the service client
*/
constructor(client: ResourceManagementClient) {
this.client = client;
}
/**
* This operation performs a union of predefined tags, resource tags, resource group tags and
* subscription tags, and returns a summary of usage for each tag name and value under the given
* subscription. In case of a large number of tags, this operation may return a previously cached
* result.
* @param options The options parameters.
*/
public list(
options?: TagsListOptionalParams
): PagedAsyncIterableIterator<TagDetails> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: () => {
return this.listPagingPage(options);
}
};
}
private async *listPagingPage(
options?: TagsListOptionalParams
): AsyncIterableIterator<TagDetails[]> {
let result = await this._list(options);
yield result.value || [];
let continuationToken = result.nextLink;
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
yield result.value || [];
}
}
private async *listPagingAll(
options?: TagsListOptionalParams
): AsyncIterableIterator<TagDetails> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* This operation allows deleting a value from the list of predefined values for an existing predefined
* tag name. The value being deleted must not be in use as a tag value for the given tag name for any
* resource.
* @param tagName The name of the tag.
* @param tagValue The value of the tag to delete.
* @param options The options parameters.
*/
deleteValue(
tagName: string,
tagValue: string,
options?: TagsDeleteValueOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ tagName, tagValue, options },
deleteValueOperationSpec
);
}
/**
* This operation allows adding a value to the list of predefined values for an existing predefined tag
* name. A tag value can have a maximum of 256 characters.
* @param tagName The name of the tag.
* @param tagValue The value of the tag to create.
* @param options The options parameters.
*/
createOrUpdateValue(
tagName: string,
tagValue: string,
options?: TagsCreateOrUpdateValueOptionalParams
): Promise<TagsCreateOrUpdateValueResponse> {
return this.client.sendOperationRequest(
{ tagName, tagValue, options },
createOrUpdateValueOperationSpec
);
}
/**
* This operation allows adding a name to the list of predefined tag names for the given subscription.
* A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the
* following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'.
* @param tagName The name of the tag to create.
* @param options The options parameters.
*/
createOrUpdate(
tagName: string,
options?: TagsCreateOrUpdateOptionalParams
): Promise<TagsCreateOrUpdateResponse> {
return this.client.sendOperationRequest(
{ tagName, options },
createOrUpdateOperationSpec
);
}
/**
* This operation allows deleting a name from the list of predefined tag names for the given
* subscription. The name being deleted must not be in use as a tag name for any resource. All
* predefined values for the given name must have already been deleted.
* @param tagName The name of the tag.
* @param options The options parameters.
*/
delete(tagName: string, options?: TagsDeleteOptionalParams): Promise<void> {
return this.client.sendOperationRequest(
{ tagName, options },
deleteOperationSpec
);
}
/**
* This operation performs a union of predefined tags, resource tags, resource group tags and
* subscription tags, and returns a summary of usage for each tag name and value under the given
* subscription. In case of a large number of tags, this operation may return a previously cached
* result.
* @param options The options parameters.
*/
private _list(options?: TagsListOptionalParams): Promise<TagsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* This operation allows adding or replacing the entire set of tags on the specified resource or
* subscription. The specified entity can have a maximum of 50 tags.
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param options The options parameters.
*/
createOrUpdateAtScope(
scope: string,
parameters: TagsResource,
options?: TagsCreateOrUpdateAtScopeOptionalParams
): Promise<TagsCreateOrUpdateAtScopeResponse> {
return this.client.sendOperationRequest(
{ scope, parameters, options },
createOrUpdateAtScopeOperationSpec
);
}
/**
* This operation allows replacing, merging or selectively deleting tags on the specified resource or
* subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The
* 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows
* adding tags with new names and updating the values of tags with existing names. The 'delete' option
* allows selectively deleting tags based on given names or name/value pairs.
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param options The options parameters.
*/
updateAtScope(
scope: string,
parameters: TagsPatchResource,
options?: TagsUpdateAtScopeOptionalParams
): Promise<TagsUpdateAtScopeResponse> {
return this.client.sendOperationRequest(
{ scope, parameters, options },
updateAtScopeOperationSpec
);
}
/**
* Gets the entire set of tags on a resource or subscription.
* @param scope The resource scope.
* @param options The options parameters.
*/
getAtScope(
scope: string,
options?: TagsGetAtScopeOptionalParams
): Promise<TagsGetAtScopeResponse> {
return this.client.sendOperationRequest(
{ scope, options },
getAtScopeOperationSpec
);
}
/**
* Deletes the entire set of tags on a resource or subscription.
* @param scope The resource scope.
* @param options The options parameters.
*/
deleteAtScope(
scope: string,
options?: TagsDeleteAtScopeOptionalParams
): Promise<void> {
return this.client.sendOperationRequest(
{ scope, options },
deleteAtScopeOperationSpec
);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: TagsListNextOptionalParams
): Promise<TagsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const deleteValueOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.tagName,
Parameters.tagValue
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateValueOperationSpec: coreClient.OperationSpec = {
path:
"/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.TagValue
},
201: {
bodyMapper: Mappers.TagValue
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.tagName,
Parameters.tagValue
],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/tagNames/{tagName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.TagDetails
},
201: {
bodyMapper: Mappers.TagDetails
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.tagName
],
headerParameters: [Parameters.accept],
serializer
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/tagNames/{tagName}",
httpMethod: "DELETE",
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.tagName
],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/tagNames",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.TagsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer
};
const createOrUpdateAtScopeOperationSpec: coreClient.OperationSpec = {
path: "/{scope}/providers/Microsoft.Resources/tags/default",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.TagsResource
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters9,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const updateAtScopeOperationSpec: coreClient.OperationSpec = {
path: "/{scope}/providers/Microsoft.Resources/tags/default",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.TagsResource
},
default: {
bodyMapper: Mappers.CloudError
}
},
requestBody: Parameters.parameters10,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer
};
const getAtScopeOperationSpec: coreClient.OperationSpec = {
path: "/{scope}/providers/Microsoft.Resources/tags/default",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.TagsResource
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
const deleteAtScopeOperationSpec: coreClient.OperationSpec = {
path: "/{scope}/providers/Microsoft.Resources/tags/default",
httpMethod: "DELETE",
responses: {
200: {},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.scope],
headerParameters: [Parameters.accept],
serializer
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.TagsListResult
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId
],
headerParameters: [Parameters.accept],
serializer
};