import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { GalleryApplicationVersions } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { ComputeManagementClient } from "../computeManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { GalleryApplicationVersion , GalleryApplicationVersionsListByGalleryApplicationNextOptionalParams , GalleryApplicationVersionsListByGalleryApplicationOptionalParams , GalleryApplicationVersionsCreateOrUpdateOptionalParams , GalleryApplicationVersionsCreateOrUpdateResponse , GalleryApplicationVersionUpdate , GalleryApplicationVersionsUpdateOptionalParams , GalleryApplicationVersionsUpdateResponse , GalleryApplicationVersionsGetOptionalParams , GalleryApplicationVersionsGetResponse , GalleryApplicationVersionsDeleteOptionalParams , GalleryApplicationVersionsListByGalleryApplicationResponse , GalleryApplicationVersionsListByGalleryApplicationNextResponse } from "../models" ; /** Class containing GalleryApplicationVersions operations. */ export class GalleryApplicationVersionsImpl implements GalleryApplicationVersions { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param galleryName param galleryApplicationName param options public listByGalleryApplication ( resourceGroupName , galleryName , galleryApplicationName , options ? ) { const iter = this . listByGalleryApplicationPagingAll ( resourceGroupName , galleryName , galleryApplicationName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByGalleryApplicationPagingPage ( resourceGroupName , galleryName , galleryApplicationName , options ) ; } } ; } private async * listByGalleryApplicationPagingPage ( resourceGroupName , galleryName , galleryApplicationName , options ? ) { let result = await this . _listByGalleryApplication ( resourceGroupName , galleryName , galleryApplicationName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByGalleryApplicationNext ( resourceGroupName , galleryName , galleryApplicationName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByGalleryApplicationPagingAll ( resourceGroupName , galleryName , galleryApplicationName , options ? ) { for await ( const page of this . listByGalleryApplicationPagingPage ( resourceGroupName , galleryName , galleryApplicationName , options ) ) { yield * page ; } } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param galleryApplicationVersion param options async beginCreateOrUpdate ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ? ) { const directSendOperation = async ( args , spec ) : Promise < GalleryApplicationVersionsCreateOrUpdateResponse > => { return this . client . sendOperationRequest ( args , spec ) ; } ; const sendOperation = 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 = new LroImpl ( sendOperation , { resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param galleryApplicationVersion param options async beginCreateOrUpdateAndWait ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param galleryApplicationVersion param options async beginUpdate ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ? ) { const directSendOperation = async ( args , spec ) : Promise < GalleryApplicationVersionsUpdateResponse > => { return this . client . sendOperationRequest ( args , spec ) ; } ; const sendOperation = 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 = new LroImpl ( sendOperation , { resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options } , updateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param galleryApplicationVersion param options async beginUpdateAndWait ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ? ) { const poller = await this . beginUpdate ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , galleryApplicationVersion , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param options get ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options } , getOperationSpec ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param options async beginDelete ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options ? ) { const directSendOperation = async ( args , spec ) : Promise < void > => { return this . client . sendOperationRequest ( args , spec ) ; } ; const sendOperation = 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 = new LroImpl ( sendOperation , { resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param galleryName param galleryApplicationName param galleryApplicationVersionName param options async beginDeleteAndWait ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , galleryName , galleryApplicationName , galleryApplicationVersionName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param galleryName param galleryApplicationName param options private _listByGalleryApplication ( resourceGroupName , galleryName , galleryApplicationName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , galleryName , galleryApplicationName , options } , listByGalleryApplicationOperationSpec ) ; } param resourceGroupName param galleryName param galleryApplicationName param nextLink param options private _listByGalleryApplicationNext ( resourceGroupName , galleryName , galleryApplicationName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , galleryName , galleryApplicationName , nextLink , options } , listByGalleryApplicationNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . GalleryApplicationVersion } , 201 : { bodyMapper : Mappers . GalleryApplicationVersion } , 202 : { bodyMapper : Mappers . GalleryApplicationVersion } , 204 : { bodyMapper : Mappers . GalleryApplicationVersion } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . galleryApplicationVersion , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . galleryName , Parameters . galleryApplicationName , Parameters . galleryApplicationVersionName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . GalleryApplicationVersion } , 201 : { bodyMapper : Mappers . GalleryApplicationVersion } , 202 : { bodyMapper : Mappers . GalleryApplicationVersion } , 204 : { bodyMapper : Mappers . GalleryApplicationVersion } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . galleryApplicationVersion1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . galleryName , Parameters . galleryApplicationName , Parameters . galleryApplicationVersionName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . GalleryApplicationVersion } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . expand7 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . galleryName , Parameters . galleryApplicationName , Parameters . galleryApplicationVersionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . galleryName , Parameters . galleryApplicationName , Parameters . galleryApplicationVersionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByGalleryApplicationOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . GalleryApplicationVersionList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . galleryName , Parameters . galleryApplicationName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByGalleryApplicationNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . GalleryApplicationVersionList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . galleryName , Parameters . galleryApplicationName ] , headerParameters : [ Parameters . accept ] , serializer } ;