import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { CloudServiceRoles } 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 { CloudServiceRole , CloudServiceRolesListNextOptionalParams , CloudServiceRolesListOptionalParams , CloudServiceRolesGetOptionalParams , CloudServiceRolesGetResponse , CloudServiceRolesListResponse , CloudServiceRolesListNextResponse } from "../models" ; /** Class containing CloudServiceRoles operations. */ export class CloudServiceRolesImpl implements CloudServiceRoles { private readonly client : ComputeManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param cloudServiceName param options public list ( resourceGroupName , cloudServiceName , options ? ) { const iter = this . listPagingAll ( resourceGroupName , cloudServiceName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( resourceGroupName , cloudServiceName , options ) ; } } ; } private async * listPagingPage ( resourceGroupName , cloudServiceName , options ? ) { let result = await this . _list ( resourceGroupName , cloudServiceName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( resourceGroupName , cloudServiceName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( resourceGroupName , cloudServiceName , options ? ) { for await ( const page of this . listPagingPage ( resourceGroupName , cloudServiceName , options ) ) { yield * page ; } } param roleName param resourceGroupName param cloudServiceName param options get ( roleName , resourceGroupName , cloudServiceName , options ? ) { return this . client . sendOperationRequest ( { roleName , resourceGroupName , cloudServiceName , options } , getOperationSpec ) ; } param resourceGroupName param cloudServiceName param options private _list ( resourceGroupName , cloudServiceName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , cloudServiceName , options } , listOperationSpec ) ; } param resourceGroupName param cloudServiceName param nextLink param options private _listNext ( resourceGroupName , cloudServiceName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , cloudServiceName , nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . CloudServiceRole } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . cloudServiceName , Parameters . roleName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . CloudServiceRoleListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . cloudServiceName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . CloudServiceRoleListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion2 ] , urlParameters : [ Parameters . $host , Parameters . resourceGroupName , Parameters . subscriptionId , Parameters . nextLink , Parameters . cloudServiceName ] , headerParameters : [ Parameters . accept ] , serializer } ;