import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { DiskEncryptionSets } 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 { DiskEncryptionSet , DiskEncryptionSetsListByResourceGroupNextOptionalParams , DiskEncryptionSetsListByResourceGroupOptionalParams , DiskEncryptionSetsListNextOptionalParams , DiskEncryptionSetsListOptionalParams , DiskEncryptionSetsListAssociatedResourcesNextOptionalParams , DiskEncryptionSetsListAssociatedResourcesOptionalParams , DiskEncryptionSetsCreateOrUpdateOptionalParams , DiskEncryptionSetsCreateOrUpdateResponse , DiskEncryptionSetUpdate , DiskEncryptionSetsUpdateOptionalParams , DiskEncryptionSetsUpdateResponse , DiskEncryptionSetsGetOptionalParams , DiskEncryptionSetsGetResponse , DiskEncryptionSetsDeleteOptionalParams , DiskEncryptionSetsListByResourceGroupResponse , DiskEncryptionSetsListResponse , DiskEncryptionSetsListAssociatedResourcesResponse , DiskEncryptionSetsListByResourceGroupNextResponse , DiskEncryptionSetsListNextResponse , DiskEncryptionSetsListAssociatedResourcesNextResponse } from "../models" ; /** Class containing DiskEncryptionSets operations. */ export class DiskEncryptionSetsImpl implements DiskEncryptionSets { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param options public listByResourceGroup ( resourceGroupName , options ? ) { const iter = this . listByResourceGroupPagingAll ( resourceGroupName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listByResourceGroupPagingPage ( resourceGroupName , options ) ; } } ; } private async * listByResourceGroupPagingPage ( resourceGroupName , options ? ) { let result = await this . _listByResourceGroup ( resourceGroupName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listByResourceGroupNext ( resourceGroupName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listByResourceGroupPagingAll ( resourceGroupName , options ? ) { for await ( const page of this . listByResourceGroupPagingPage ( resourceGroupName , options ) ) { yield * page ; } } param options public list ( options ? ) { const iter = this . listPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( options ) ; } } ; } private async * listPagingPage ( options ? ) { 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 ? ) { for await ( const page of this . listPagingPage ( options ) ) { yield * page ; } } param resourceGroupName param diskEncryptionSetName param options public listAssociatedResources ( resourceGroupName , diskEncryptionSetName , options ? ) { const iter = this . listAssociatedResourcesPagingAll ( resourceGroupName , diskEncryptionSetName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAssociatedResourcesPagingPage ( resourceGroupName , diskEncryptionSetName , options ) ; } } ; } private async * listAssociatedResourcesPagingPage ( resourceGroupName , diskEncryptionSetName , options ? ) { let result = await this . _listAssociatedResources ( resourceGroupName , diskEncryptionSetName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAssociatedResourcesNext ( resourceGroupName , diskEncryptionSetName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAssociatedResourcesPagingAll ( resourceGroupName , diskEncryptionSetName , options ? ) { for await ( const page of this . listAssociatedResourcesPagingPage ( resourceGroupName , diskEncryptionSetName , options ) ) { yield * page ; } } param resourceGroupName param diskEncryptionSetName param diskEncryptionSet param options async beginCreateOrUpdate ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ? ) { const directSendOperation = async ( args , spec ) : Promise < DiskEncryptionSetsCreateOrUpdateResponse > => { 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 , diskEncryptionSetName , diskEncryptionSet , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param diskEncryptionSetName param diskEncryptionSet param options async beginCreateOrUpdateAndWait ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param diskEncryptionSetName param diskEncryptionSet param options async beginUpdate ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ? ) { const directSendOperation = async ( args , spec ) : Promise < DiskEncryptionSetsUpdateResponse > => { 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 , diskEncryptionSetName , diskEncryptionSet , options } , updateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param diskEncryptionSetName param diskEncryptionSet param options async beginUpdateAndWait ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ? ) { const poller = await this . beginUpdate ( resourceGroupName , diskEncryptionSetName , diskEncryptionSet , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param diskEncryptionSetName param options get ( resourceGroupName , diskEncryptionSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , diskEncryptionSetName , options } , getOperationSpec ) ; } param resourceGroupName param diskEncryptionSetName param options async beginDelete ( resourceGroupName , diskEncryptionSetName , 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 , diskEncryptionSetName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param diskEncryptionSetName param options async beginDeleteAndWait ( resourceGroupName , diskEncryptionSetName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , diskEncryptionSetName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param options private _listByResourceGroup ( resourceGroupName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , options } , listByResourceGroupOperationSpec ) ; } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param resourceGroupName param diskEncryptionSetName param options private _listAssociatedResources ( resourceGroupName , diskEncryptionSetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , diskEncryptionSetName , options } , listAssociatedResourcesOperationSpec ) ; } param resourceGroupName param nextLink param options private _listByResourceGroupNext ( resourceGroupName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , nextLink , options } , listByResourceGroupNextOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param resourceGroupName param diskEncryptionSetName param nextLink param options private _listAssociatedResourcesNext ( resourceGroupName , diskEncryptionSetName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , diskEncryptionSetName , nextLink , options } , listAssociatedResourcesNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSet } , 201 : { bodyMapper : Mappers . DiskEncryptionSet } , 202 : { bodyMapper : Mappers . DiskEncryptionSet } , 204 : { bodyMapper : Mappers . DiskEncryptionSet } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . diskEncryptionSet , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSet } , 201 : { bodyMapper : Mappers . DiskEncryptionSet } , 202 : { bodyMapper : Mappers . DiskEncryptionSet } , 204 : { bodyMapper : Mappers . DiskEncryptionSet } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . diskEncryptionSet1 , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSet } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByResourceGroupOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSetList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSetList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAssociatedResourcesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceUriList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listByResourceGroupNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSetList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DiskEncryptionSetList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAssociatedResourcesNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . ResourceUriList } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion1 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . diskEncryptionSetName ] , headerParameters : [ Parameters . accept ] , serializer } ;