import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { AzureFirewalls } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { NetworkManagementClient } from "../networkManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { AzureFirewall , AzureFirewallsListNextOptionalParams , AzureFirewallsListOptionalParams , AzureFirewallsListAllNextOptionalParams , AzureFirewallsListAllOptionalParams , AzureFirewallsDeleteOptionalParams , AzureFirewallsGetOptionalParams , AzureFirewallsGetResponse , AzureFirewallsCreateOrUpdateOptionalParams , AzureFirewallsCreateOrUpdateResponse , TagsObject , AzureFirewallsUpdateTagsOptionalParams , AzureFirewallsUpdateTagsResponse , AzureFirewallsListResponse , AzureFirewallsListAllResponse , AzureFirewallsListNextResponse , AzureFirewallsListAllNextResponse } from "../models" ; /** Class containing AzureFirewalls operations. */ export class AzureFirewallsImpl implements AzureFirewalls { private readonly client : NetworkManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param options public list ( resourceGroupName , options ? ) { const iter = this . listPagingAll ( resourceGroupName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( resourceGroupName , options ) ; } } ; } private async * listPagingPage ( resourceGroupName , options ? ) { let result = await this . _list ( resourceGroupName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( resourceGroupName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( resourceGroupName , options ? ) { for await ( const page of this . listPagingPage ( resourceGroupName , options ) ) { yield * page ; } } param options public listAll ( options ? ) { const iter = this . listAllPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAllPagingPage ( options ) ; } } ; } private async * listAllPagingPage ( options ? ) { let result = await this . _listAll ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listAllNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listAllPagingAll ( options ? ) { for await ( const page of this . listAllPagingPage ( options ) ) { yield * page ; } } param resourceGroupName param azureFirewallName param options async beginDelete ( resourceGroupName , azureFirewallName , 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 , azureFirewallName , options } , deleteOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "location" } ) ; } param resourceGroupName param azureFirewallName param options async beginDeleteAndWait ( resourceGroupName , azureFirewallName , options ? ) { const poller = await this . beginDelete ( resourceGroupName , azureFirewallName , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param azureFirewallName param options get ( resourceGroupName , azureFirewallName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , azureFirewallName , options } , getOperationSpec ) ; } param resourceGroupName param azureFirewallName param parameters param options async beginCreateOrUpdate ( resourceGroupName , azureFirewallName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < AzureFirewallsCreateOrUpdateResponse > => { 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 , azureFirewallName , parameters , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "azure-async-operation" } ) ; } param resourceGroupName param azureFirewallName param parameters param options async beginCreateOrUpdateAndWait ( resourceGroupName , azureFirewallName , parameters , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , azureFirewallName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param azureFirewallName param parameters param options async beginUpdateTags ( resourceGroupName , azureFirewallName , parameters , options ? ) { const directSendOperation = async ( args , spec ) : Promise < AzureFirewallsUpdateTagsResponse > => { 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 , azureFirewallName , parameters , options } , updateTagsOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs , lroResourceLocationConfig : "azure-async-operation" } ) ; } param resourceGroupName param azureFirewallName param parameters param options async beginUpdateTagsAndWait ( resourceGroupName , azureFirewallName , parameters , options ? ) { const poller = await this . beginUpdateTags ( resourceGroupName , azureFirewallName , parameters , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param options private _list ( resourceGroupName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , options } , listOperationSpec ) ; } param options private _listAll ( options ? ) { return this . client . sendOperationRequest ( { options } , listAllOperationSpec ) ; } param resourceGroupName param nextLink param options private _listNext ( resourceGroupName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , nextLink , options } , listNextOperationSpec ) ; } param nextLink param options private _listAllNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listAllNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" , httpMethod : "DELETE" , responses : { 200 : { } , 201 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . azureFirewallName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AzureFirewall } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . azureFirewallName ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . AzureFirewall } , 201 : { bodyMapper : Mappers . AzureFirewall } , 202 : { bodyMapper : Mappers . AzureFirewall } , 204 : { bodyMapper : Mappers . AzureFirewall } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters4 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . azureFirewallName1 ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateTagsOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . AzureFirewall } , 201 : { bodyMapper : Mappers . AzureFirewall } , 202 : { bodyMapper : Mappers . AzureFirewall } , 204 : { bodyMapper : Mappers . AzureFirewall } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . azureFirewallName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AzureFirewallListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAllOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AzureFirewallListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AzureFirewallListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAllNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AzureFirewallListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;