UNPKG

@azure/arm-compute

Version:
160 lines 7.08 kB
"use strict"; /* * 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. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SoftDeletedResourceImpl = void 0; const tslib_1 = require("tslib"); const pagingHelper_js_1 = require("../pagingHelper.js"); const coreClient = tslib_1.__importStar(require("@azure/core-client")); const Mappers = tslib_1.__importStar(require("../models/mappers.js")); const Parameters = tslib_1.__importStar(require("../models/parameters.js")); /// <reference lib="esnext.asynciterable" /> /** Class containing SoftDeletedResource operations. */ class SoftDeletedResourceImpl { client; /** * Initialize a new instance of the class SoftDeletedResource class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image * version of an image. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param galleryName The name of the Shared Image Gallery. * @param artifactType The type of the artifact to be listed, such as gallery image version. * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact * name should be the gallery image name. * @param options The options parameters. */ listByArtifactName(resourceGroupName, galleryName, artifactType, artifactName, options) { const iter = this.listByArtifactNamePagingAll(resourceGroupName, galleryName, artifactType, artifactName, 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.listByArtifactNamePagingPage(resourceGroupName, galleryName, artifactType, artifactName, options, settings); }, }; } async *listByArtifactNamePagingPage(resourceGroupName, galleryName, artifactType, artifactName, options, settings) { let result; let continuationToken = settings?.continuationToken; if (!continuationToken) { result = await this._listByArtifactName(resourceGroupName, galleryName, artifactType, artifactName, options); let page = result.value || []; continuationToken = result.nextLink; (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken); yield page; } while (continuationToken) { result = await this._listByArtifactNameNext(resourceGroupName, galleryName, artifactType, artifactName, continuationToken, options); continuationToken = result.nextLink; let page = result.value || []; (0, pagingHelper_js_1.setContinuationToken)(page, continuationToken); yield page; } } async *listByArtifactNamePagingAll(resourceGroupName, galleryName, artifactType, artifactName, options) { for await (const page of this.listByArtifactNamePagingPage(resourceGroupName, galleryName, artifactType, artifactName, options)) { yield* page; } } /** * List soft-deleted resources of an artifact in the gallery, such as soft-deleted gallery image * version of an image. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param galleryName The name of the Shared Image Gallery. * @param artifactType The type of the artifact to be listed, such as gallery image version. * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact * name should be the gallery image name. * @param options The options parameters. */ _listByArtifactName(resourceGroupName, galleryName, artifactType, artifactName, options) { return this.client.sendOperationRequest({ resourceGroupName, galleryName, artifactType, artifactName, options }, listByArtifactNameOperationSpec); } /** * ListByArtifactNameNext * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param galleryName The name of the Shared Image Gallery. * @param artifactType The type of the artifact to be listed, such as gallery image version. * @param artifactName The artifact name to be listed. If artifact type is Images, then the artifact * name should be the gallery image name. * @param nextLink The nextLink from the previous successful call to the ListByArtifactName method. * @param options The options parameters. */ _listByArtifactNameNext(resourceGroupName, galleryName, artifactType, artifactName, nextLink, options) { return this.client.sendOperationRequest({ resourceGroupName, galleryName, artifactType, artifactName, nextLink, options, }, listByArtifactNameNextOperationSpec); } } exports.SoftDeletedResourceImpl = SoftDeletedResourceImpl; // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listByArtifactNameOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/softdeletedartifacttypes/{artifactType}/artifacts/{artifactName}/versions", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.GallerySoftDeletedResourceList, }, default: { bodyMapper: Mappers.CloudError, }, }, queryParameters: [Parameters.apiVersion3], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.galleryName, Parameters.artifactType, Parameters.artifactName, ], headerParameters: [Parameters.accept], serializer, }; const listByArtifactNameNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.GallerySoftDeletedResourceList, }, default: { bodyMapper: Mappers.CloudError, }, }, urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.galleryName, Parameters.artifactType, Parameters.artifactName, ], headerParameters: [Parameters.accept], serializer, }; //# sourceMappingURL=softDeletedResource.js.map