import { VirtualMachineExtensions } 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 { VirtualMachineExtension , VirtualMachineExtensionsCreateOrUpdateOptionalParams , VirtualMachineExtensionsCreateOrUpdateResponse , VirtualMachineExtensionUpdate , VirtualMachineExtensionsUpdateOptionalParams , VirtualMachineExtensionsUpdateResponse , VirtualMachineExtensionsDeleteOptionalParams , VirtualMachineExtensionsGetOptionalParams , VirtualMachineExtensionsGetResponse , VirtualMachineExtensionsListOptionalParams , VirtualMachineExtensionsListResponse } from "../models" ; /** Class containing VirtualMachineExtensions operations. */ export class VirtualMachineExtensionsImpl implements VirtualMachineExtensions { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param vmName param vmExtensionName param extensionParameters param options async beginCreateOrUpdate ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachineExtensionsCreateOrUpdateResponse > => { 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 , vmName , vmExtensionName , extensionParameters , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param vmExtensionName param extensionParameters param options async beginCreateOrUpdateAndWait ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param vmExtensionName param extensionParameters param options async beginUpdate ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < VirtualMachineExtensionsUpdateResponse > => { 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 , vmName , vmExtensionName , extensionParameters , options } , updateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param vmExtensionName param extensionParameters param options async beginUpdateAndWait ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ? ) { const poller = await this . beginUpdate ( resourceGroupName , vmName , vmExtensionName , extensionParameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param vmExtensionName param options async beginDelete ( resourceGroupName , vmName , vmExtensionName , 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 , vmName , vmExtensionName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param vmName param vmExtensionName param options async beginDeleteAndWait ( resourceGroupName , vmName , vmExtensionName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , vmName , vmExtensionName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param vmName param vmExtensionName param options get ( resourceGroupName , vmName , vmExtensionName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , vmExtensionName , options } , getOperationSpec ) ; } param resourceGroupName param vmName param options list ( resourceGroupName , vmName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vmName , options } , listOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineExtension } , 201 : { bodyMapper : Mappers . VirtualMachineExtension } , 202 : { bodyMapper : Mappers . VirtualMachineExtension } , 204 : { bodyMapper : Mappers . VirtualMachineExtension } } , requestBody : Parameters . extensionParameters , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName , Parameters . vmExtensionName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineExtension } , 201 : { bodyMapper : Mappers . VirtualMachineExtension } , 202 : { bodyMapper : Mappers . VirtualMachineExtension } , 204 : { bodyMapper : Mappers . VirtualMachineExtension } } , requestBody : Parameters . extensionParameters1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName , Parameters . vmExtensionName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName , Parameters . vmExtensionName ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineExtension } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName , Parameters . vmExtensionName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineExtensionsListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . vmName ] , headerParameters : [ Parameters . accept ] , serializer } ;