import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { AvailabilitySets } 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 { AvailabilitySet , AvailabilitySetsListBySubscriptionNextOptionalParams , AvailabilitySetsListBySubscriptionOptionalParams , AvailabilitySetsListNextOptionalParams , AvailabilitySetsListOptionalParams , VirtualMachineSize , AvailabilitySetsListAvailableSizesOptionalParams , AvailabilitySetsCreateOrUpdateOptionalParams , AvailabilitySetsCreateOrUpdateResponse , AvailabilitySetUpdate , AvailabilitySetsUpdateOptionalParams , AvailabilitySetsUpdateResponse , AvailabilitySetsDeleteOptionalParams , AvailabilitySetsGetOptionalParams , AvailabilitySetsGetResponse , AvailabilitySetsListBySubscriptionResponse , AvailabilitySetsListResponse , AvailabilitySetsListAvailableSizesResponse , AvailabilitySetsListBySubscriptionNextResponse , AvailabilitySetsListNextResponse } from "../models" ; /** Class containing AvailabilitySets operations. */ export class AvailabilitySetsImpl implements AvailabilitySets { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param options public listBySubscription ( options ? ) { const iter = this . listBySubscriptionPagingAll ( options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listBySubscriptionPagingPage ( options ) ; } } ; } private async * listBySubscriptionPagingPage ( options ? ) { let result = await this . _listBySubscription ( options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listBySubscriptionNext ( continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listBySubscriptionPagingAll ( options ? ) { for await ( const page of this . listBySubscriptionPagingPage ( options ) ) { yield * page ; } } 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 resourceGroupName param availabilitySetName param options public listAvailableSizes ( resourceGroupName , availabilitySetName , options ? ) { const iter = this . listAvailableSizesPagingAll ( resourceGroupName , availabilitySetName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listAvailableSizesPagingPage ( resourceGroupName , availabilitySetName , options ) ; } } ; } private async * listAvailableSizesPagingPage ( resourceGroupName , availabilitySetName , options ? ) { let result = await this . _listAvailableSizes ( resourceGroupName , availabilitySetName , options ) ; yield result . value || [ ] ; } private async * listAvailableSizesPagingAll ( resourceGroupName , availabilitySetName , options ? ) { for await ( const page of this . listAvailableSizesPagingPage ( resourceGroupName , availabilitySetName , options ) ) { yield * page ; } } param resourceGroupName param availabilitySetName param parameters param options createOrUpdate ( resourceGroupName , availabilitySetName , parameters , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , availabilitySetName , parameters , options } , createOrUpdateOperationSpec ) ; } param resourceGroupName param availabilitySetName param parameters param options update ( resourceGroupName , availabilitySetName , parameters , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , availabilitySetName , parameters , options } , updateOperationSpec ) ; } param resourceGroupName param availabilitySetName param options delete ( resourceGroupName , availabilitySetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , availabilitySetName , options } , deleteOperationSpec ) ; } param resourceGroupName param availabilitySetName param options get ( resourceGroupName , availabilitySetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , availabilitySetName , options } , getOperationSpec ) ; } param options private _listBySubscription ( options ? ) { return this . client . sendOperationRequest ( { options } , listBySubscriptionOperationSpec ) ; } param resourceGroupName param options private _list ( resourceGroupName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , options } , listOperationSpec ) ; } param resourceGroupName param availabilitySetName param options private _listAvailableSizes ( resourceGroupName , availabilitySetName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , availabilitySetName , options } , listAvailableSizesOperationSpec ) ; } param nextLink param options private _listBySubscriptionNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listBySubscriptionNextOperationSpec ) ; } param resourceGroupName param nextLink param options private _listNext ( resourceGroupName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySet } } , requestBody : Parameters . parameters , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . availabilitySetName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySet } } , requestBody : Parameters . parameters1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . availabilitySetName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . availabilitySetName , Parameters . subscriptionId ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySet } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . availabilitySetName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listBySubscriptionOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySetListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySetListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listAvailableSizesOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . VirtualMachineSizeListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . availabilitySetName , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listBySubscriptionNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySetListResult } } , queryParameters : [ Parameters . apiVersion , Parameters . expand ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . AvailabilitySetListResult } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ;