@azure/arm-compute
Version:
A generated SDK for ComputeManagementClient.
514 lines • 24 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { setContinuationToken } from "../pagingHelper.js";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers.js";
import * as Parameters from "../models/parameters.js";
import { createHttpPoller } from "@azure/core-lro";
import { createLroSpec } from "../lroImpl.js";
/// <reference lib="esnext.asynciterable" />
/** Class containing GalleryInVMAccessControlProfileVersions operations. */
export class GalleryInVMAccessControlProfileVersionsImpl {
client;
/**
* Initialize a new instance of the class GalleryInVMAccessControlProfileVersions class.
* @param client Reference to the service client
*/
constructor(client) {
this.client = client;
}
/**
* List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param options The options parameters.
*/
listByGalleryInVMAccessControlProfile(resourceGroupName, galleryName, inVMAccessControlProfileName, options) {
const iter = this.listByGalleryInVMAccessControlProfilePagingAll(resourceGroupName, galleryName, inVMAccessControlProfileName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByGalleryInVMAccessControlProfilePagingPage(resourceGroupName, galleryName, inVMAccessControlProfileName, options, settings);
},
};
}
async *listByGalleryInVMAccessControlProfilePagingPage(resourceGroupName, galleryName, inVMAccessControlProfileName, options, settings) {
let result;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByGalleryInVMAccessControlProfile(resourceGroupName, galleryName, inVMAccessControlProfileName, options);
const page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByGalleryInVMAccessControlProfileNext(resourceGroupName, galleryName, inVMAccessControlProfileName, continuationToken, options);
continuationToken = result.nextLink;
const page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
async *listByGalleryInVMAccessControlProfilePagingAll(resourceGroupName, galleryName, inVMAccessControlProfileName, options) {
for await (const page of this.listByGalleryInVMAccessControlProfilePagingPage(resourceGroupName, galleryName, inVMAccessControlProfileName, options)) {
yield* page;
}
}
/**
* List gallery inVMAccessControlProfile versions in a gallery inVMAccessControlProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param options The options parameters.
*/
_listByGalleryInVMAccessControlProfile(resourceGroupName, galleryName, inVMAccessControlProfileName, options) {
return this.client.sendOperationRequest({ resourceGroupName, galleryName, inVMAccessControlProfileName, options }, listByGalleryInVMAccessControlProfileOperationSpec);
}
/**
* Retrieves information about a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param options The options parameters.
*/
get(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, options) {
return this.client.sendOperationRequest({
resourceGroupName,
galleryName,
inVMAccessControlProfileName,
inVMAccessControlProfileVersionName,
options,
}, getOperationSpec);
}
/**
* Create or update a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param galleryInVMAccessControlProfileVersion Parameters supplied to the create or update gallery
* inVMAccessControlProfile version operation.
* @param options The options parameters.
*/
async beginCreateOrUpdate(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options) {
const directSendOperation = async (args, spec) => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (args, spec) => {
let currentRawResponse = undefined;
const providedCallback = args.options?.onResponse;
const callback = (rawResponse, flatResponse) => {
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 = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
galleryName,
inVMAccessControlProfileName,
inVMAccessControlProfileVersionName,
galleryInVMAccessControlProfileVersion,
options,
},
spec: createOrUpdateOperationSpec,
});
const poller = await createHttpPoller(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Create or update a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param galleryInVMAccessControlProfileVersion Parameters supplied to the create or update gallery
* inVMAccessControlProfile version operation.
* @param options The options parameters.
*/
async beginCreateOrUpdateAndWait(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options) {
const poller = await this.beginCreateOrUpdate(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options);
return poller.pollUntilDone();
}
/**
* Update a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param galleryInVMAccessControlProfileVersion Parameters supplied to the update gallery
* inVMAccessControlProfile version operation.
* @param options The options parameters.
*/
async beginUpdate(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options) {
const directSendOperation = async (args, spec) => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (args, spec) => {
let currentRawResponse = undefined;
const providedCallback = args.options?.onResponse;
const callback = (rawResponse, flatResponse) => {
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 = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
galleryName,
inVMAccessControlProfileName,
inVMAccessControlProfileVersionName,
galleryInVMAccessControlProfileVersion,
options,
},
spec: updateOperationSpec,
});
const poller = await createHttpPoller(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Update a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param galleryInVMAccessControlProfileVersion Parameters supplied to the update gallery
* inVMAccessControlProfile version operation.
* @param options The options parameters.
*/
async beginUpdateAndWait(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options) {
const poller = await this.beginUpdate(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, galleryInVMAccessControlProfileVersion, options);
return poller.pollUntilDone();
}
/**
* Delete a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param options The options parameters.
*/
async beginDelete(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, options) {
const directSendOperation = async (args, spec) => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (args, spec) => {
let currentRawResponse = undefined;
const providedCallback = args.options?.onResponse;
const callback = (rawResponse, flatResponse) => {
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 = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
galleryName,
inVMAccessControlProfileName,
inVMAccessControlProfileVersionName,
options,
},
spec: deleteOperationSpec,
});
const poller = await createHttpPoller(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Delete a gallery inVMAccessControlProfile version.
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param inVMAccessControlProfileVersionName The name of the gallery inVMAccessControlProfile version
* to be retrieved.
* @param options The options parameters.
*/
async beginDeleteAndWait(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, options) {
const poller = await this.beginDelete(resourceGroupName, galleryName, inVMAccessControlProfileName, inVMAccessControlProfileVersionName, options);
return poller.pollUntilDone();
}
/**
* ListByGalleryInVMAccessControlProfileNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param galleryName The name of the Shared Image Gallery.
* @param inVMAccessControlProfileName The name of the gallery inVMAccessControlProfile to be
* retrieved.
* @param nextLink The nextLink from the previous successful call to the
* ListByGalleryInVMAccessControlProfile method.
* @param options The options parameters.
*/
_listByGalleryInVMAccessControlProfileNext(resourceGroupName, galleryName, inVMAccessControlProfileName, nextLink, options) {
return this.client.sendOperationRequest({
resourceGroupName,
galleryName,
inVMAccessControlProfileName,
nextLink,
options,
}, listByGalleryInVMAccessControlProfileNextOperationSpec);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listByGalleryInVMAccessControlProfileOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersionList,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const getOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
Parameters.inVMAccessControlProfileVersionName,
],
headerParameters: [Parameters.accept],
serializer,
};
const createOrUpdateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
},
201: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
},
202: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
},
204: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
requestBody: Parameters.galleryInVMAccessControlProfileVersion,
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
Parameters.inVMAccessControlProfileVersionName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const updateOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsUpdateHeaders,
},
201: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsUpdateHeaders,
},
202: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsUpdateHeaders,
},
204: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersion,
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsUpdateHeaders,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
requestBody: Parameters.galleryInVMAccessControlProfileVersion1,
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
Parameters.inVMAccessControlProfileVersionName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const deleteOperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/inVMAccessControlProfiles/{inVMAccessControlProfileName}/versions/{inVMAccessControlProfileVersionName}",
httpMethod: "DELETE",
responses: {
200: {
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsDeleteHeaders,
},
201: {
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsDeleteHeaders,
},
202: {
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsDeleteHeaders,
},
204: {
headersMapper: Mappers.GalleryInVMAccessControlProfileVersionsDeleteHeaders,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
queryParameters: [Parameters.apiVersion3],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
Parameters.inVMAccessControlProfileVersionName,
],
headerParameters: [Parameters.accept],
serializer,
};
const listByGalleryInVMAccessControlProfileNextOperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.GalleryInVMAccessControlProfileVersionList,
},
default: {
bodyMapper: Mappers.CloudError,
},
},
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.galleryName,
Parameters.inVMAccessControlProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
//# sourceMappingURL=galleryInVMAccessControlProfileVersions.js.map