import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Tags } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { ResourceManagementClient } from "../resourceManagementClient" ; import { TagDetails , TagsListNextOptionalParams , TagsListOptionalParams , TagsDeleteValueOptionalParams , TagsCreateOrUpdateValueOptionalParams , TagsCreateOrUpdateValueResponse , TagsCreateOrUpdateOptionalParams , TagsCreateOrUpdateResponse , TagsDeleteOptionalParams , TagsListResponse , TagsListNextResponse } from "../models" ; /** Class containing Tags operations. */ export class TagsImpl implements Tags { private readonly client : ResourceManagementClient ; 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 tagName param tagValue param options deleteValue ( tagName , tagValue , options ? ) { return this . client . sendOperationRequest ( { tagName , tagValue , options } , deleteValueOperationSpec ) ; } param tagName param tagValue param options createOrUpdateValue ( tagName , tagValue , options ? ) { return this . client . sendOperationRequest ( { tagName , tagValue , options } , createOrUpdateValueOperationSpec ) ; } param tagName param options createOrUpdate ( tagName , options ? ) { return this . client . sendOperationRequest ( { tagName , options } , createOrUpdateOperationSpec ) ; } param tagName param options delete ( tagName , options ? ) { return this . client . sendOperationRequest ( { tagName , options } , deleteOperationSpec ) ; } param options private _list ( options ? ) { return this . client . sendOperationRequest ( { options } , listOperationSpec ) ; } param nextLink param options private _listNext ( nextLink , options ? ) { return this . client . sendOperationRequest ( { nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const deleteValueOperationSpec = { path : "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . tagName , Parameters . tagValue ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateValueOperationSpec = { path : "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . TagValue } , 201 : { bodyMapper : Mappers . TagValue } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . tagName , Parameters . tagValue ] , headerParameters : [ Parameters . accept ] , serializer } ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/tagNames/{tagName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . TagDetails } , 201 : { bodyMapper : Mappers . TagDetails } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . tagName ] , headerParameters : [ Parameters . accept ] , serializer } ; const deleteOperationSpec = { path : "/subscriptions/{subscriptionId}/tagNames/{tagName}" , httpMethod : "DELETE" , responses : { 200 : { } , 204 : { } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . tagName ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/tagNames" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . TagsListResult } , 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 . TagsListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . nextLink , Parameters . subscriptionId ] , headerParameters : [ Parameters . accept ] , serializer } ;