import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Domains } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { WebSiteManagementClient } from "../webSiteManagementClient" ; import { PollerLike , PollOperationState , LroEngine } from "@azure/core-lro" ; import { LroImpl } from "../lroImpl" ; import { Domain , DomainsListNextOptionalParams , DomainsListOptionalParams , NameIdentifier , DomainRecommendationSearchParameters , DomainsListRecommendationsNextOptionalParams , DomainsListRecommendationsOptionalParams , DomainsListByResourceGroupNextOptionalParams , DomainsListByResourceGroupOptionalParams , DomainOwnershipIdentifier , DomainsListOwnershipIdentifiersNextOptionalParams , DomainsListOwnershipIdentifiersOptionalParams , DomainsCheckAvailabilityOptionalParams , DomainsCheckAvailabilityResponse , DomainsListResponse , DomainsGetControlCenterSsoRequestOptionalParams , DomainsGetControlCenterSsoRequestResponse , DomainsListRecommendationsResponse , DomainsListByResourceGroupResponse , DomainsGetOptionalParams , DomainsGetResponse , DomainsCreateOrUpdateOptionalParams , DomainsCreateOrUpdateResponse , DomainsDeleteOptionalParams , DomainPatchResource , DomainsUpdateOptionalParams , DomainsUpdateResponse , DomainsListOwnershipIdentifiersResponse , DomainsGetOwnershipIdentifierOptionalParams , DomainsGetOwnershipIdentifierResponse , DomainsCreateOrUpdateOwnershipIdentifierOptionalParams , DomainsCreateOrUpdateOwnershipIdentifierResponse , DomainsDeleteOwnershipIdentifierOptionalParams , DomainsUpdateOwnershipIdentifierOptionalParams , DomainsUpdateOwnershipIdentifierResponse , DomainsRenewOptionalParams , DomainsListNextResponse , DomainsListRecommendationsNextResponse , DomainsListByResourceGroupNextResponse , DomainsListOwnershipIdentifiersNextResponse } from "../models" ; /** Class containing Domains operations. */ export class DomainsImpl implements Domains { private readonly client : WebSiteManagementClient ; param client constructor ( client ) { this . client = client ; } 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 parameters param options public listRecommendations ( parameters , options ? ) { const iter = this . listRecommendationsPagingAll ( parameters , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listRecommendationsPagingPage ( parameters , options ) ; } } ; } private async * listRecommendationsPagingPage ( parameters , options ? ) { let result = await this . _listRecommendations ( parameters , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listRecommendationsNext ( parameters , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listRecommendationsPagingAll ( parameters , options ? ) { for await ( const page of this . listRecommendationsPagingPage ( parameters , options ) ) { yield * page ; } } 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 resourceGroupName param domainName param options public listOwnershipIdentifiers ( resourceGroupName , domainName , options ? ) { const iter = this . listOwnershipIdentifiersPagingAll ( resourceGroupName , domainName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listOwnershipIdentifiersPagingPage ( resourceGroupName , domainName , options ) ; } } ; } private async * listOwnershipIdentifiersPagingPage ( resourceGroupName , domainName , options ? ) { let result = await this . _listOwnershipIdentifiers ( resourceGroupName , domainName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listOwnershipIdentifiersNext ( resourceGroupName , domainName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listOwnershipIdentifiersPagingAll ( resourceGroupName , domainName , options ? ) { for await ( const page of this . listOwnershipIdentifiersPagingPage ( resourceGroupName , domainName , options ) ) { yield * page ; } } param identifier param options checkAvailability ( identifier , options ? ) { return this . client . sendOperationRequest ( { identifier , options } , checkAvailabilityOperationSpec ) ; } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param options getControlCenterSsoRequest ( options ? ) { return this . client . sendOperationRequest ( { options } , getControlCenterSsoRequestOperationSpec ) ; } param parameters param options private _listRecommendations ( parameters , options ? ) { return this . client . sendOperationRequest ( { parameters , options } , listRecommendationsOperationSpec ) ; } param resourceGroupName param options private _listByResourceGroup ( resourceGroupName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , options } , listByResourceGroupOperationSpec ) ; } param resourceGroupName param domainName param options get ( resourceGroupName , domainName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , options } , getOperationSpec ) ; } param resourceGroupName param domainName param domain param options async beginCreateOrUpdate ( resourceGroupName , domainName , domain , options ? ) { const directSendOperation = async ( args , spec ) : Promise < DomainsCreateOrUpdateResponse > => { 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 , domainName , domain , options } , createOrUpdateOperationSpec ) ; return new LroEngine ( lro , { resumeFrom : options ?. resumeFrom , intervalInMs : options ?. updateIntervalInMs } ) ; } param resourceGroupName param domainName param domain param options async beginCreateOrUpdateAndWait ( resourceGroupName , domainName , domain , options ? ) { const poller = await this . beginCreateOrUpdate ( resourceGroupName , domainName , domain , options ) ; return poller . pollUntilDone ( ) ; } param resourceGroupName param domainName param options delete ( resourceGroupName , domainName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , options } , deleteOperationSpec ) ; } param resourceGroupName param domainName param domain param options update ( resourceGroupName , domainName , domain , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , domain , options } , updateOperationSpec ) ; } param resourceGroupName param domainName param options private _listOwnershipIdentifiers ( resourceGroupName , domainName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , options } , listOwnershipIdentifiersOperationSpec ) ; } param resourceGroupName param domainName param name param options getOwnershipIdentifier ( resourceGroupName , domainName , name , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , name , options } , getOwnershipIdentifierOperationSpec ) ; } param resourceGroupName param domainName param name param domainOwnershipIdentifier param options createOrUpdateOwnershipIdentifier ( resourceGroupName , domainName , name , domainOwnershipIdentifier , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , name , domainOwnershipIdentifier , options } , createOrUpdateOwnershipIdentifierOperationSpec ) ; } param resourceGroupName param domainName param name param options deleteOwnershipIdentifier ( resourceGroupName , domainName , name , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , name , options } , deleteOwnershipIdentifierOperationSpec ) ; } param resourceGroupName param domainName param name param domainOwnershipIdentifier param options updateOwnershipIdentifier ( resourceGroupName , domainName , name , domainOwnershipIdentifier , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , name , domainOwnershipIdentifier , options } , updateOwnershipIdentifierOperationSpec ) ; } param resourceGroupName param domainName param options renew ( resourceGroupName , domainName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , options } , renewOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } param parameters param nextLink param options private _listRecommendationsNext ( parameters , nextLink , options ? ) { return this . client . sendOperationRequest ( { parameters , nextLink , options } , listRecommendationsNextOperationSpec ) ; } param resourceGroupName param nextLink param options private _listByResourceGroupNext ( resourceGroupName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , nextLink , options } , listByResourceGroupNextOperationSpec ) ; } param resourceGroupName param domainName param nextLink param options private _listOwnershipIdentifiersNext ( resourceGroupName , domainName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , domainName , nextLink , options } , listOwnershipIdentifiersNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const checkAvailabilityOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/checkDomainAvailability" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . DomainAvailabilityCheckResult } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . identifier , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/domains" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const getControlCenterSsoRequestOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/generateSsoRequest" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . DomainControlCenterSsoRequest } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ; const listRecommendationsOperationSpec = { path : "/subscriptions/{subscriptionId}/providers/Microsoft.DomainRegistration/listDomainRecommendations" , httpMethod : "POST" , responses : { 200 : { bodyMapper : Mappers . NameIdentifierCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . parameters , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listByResourceGroupOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Domain } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . Domain } , 201 : { bodyMapper : Mappers . Domain } , 202 : { bodyMapper : Mappers . Domain } , 204 : { bodyMapper : Mappers . Domain } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . domain , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName1 ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion , Parameters . forceHardDeleteDomain ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . Domain } , 202 : { bodyMapper : Mappers . Domain } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . domain1 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName1 ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listOwnershipIdentifiersOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainOwnershipIdentifierCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const getOwnershipIdentifierOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainOwnershipIdentifier } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . name , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOwnershipIdentifierOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . DomainOwnershipIdentifier } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . domainOwnershipIdentifier , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . name , Parameters . domainName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const deleteOwnershipIdentifierOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . name , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const updateOwnershipIdentifierOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/domainOwnershipIdentifiers/{name}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . DomainOwnershipIdentifier } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , requestBody : Parameters . domainOwnershipIdentifier , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . name , Parameters . domainName ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const renewOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/renew" , httpMethod : "POST" , responses : { 200 : { } , 202 : { } , 204 : { } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listRecommendationsNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . NameIdentifierCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . nextLink ] , headerParameters : [ Parameters . accept , Parameters . contentType ] , mediaType : "json" , serializer } ; const listByResourceGroupNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . nextLink ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOwnershipIdentifiersNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . DomainOwnershipIdentifierCollection } , default : { bodyMapper : Mappers . DefaultErrorResponse } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . nextLink , Parameters . domainName ] , headerParameters : [ Parameters . accept ] , serializer } ;