import { PagedAsyncIterableIterator } from "@azure/core-paging" ; import { Secrets } from "../operationsInterfaces" ; import * as coreClient from "@azure/core-client" ; import * as Mappers from "../models/mappers" ; import * as Parameters from "../models/parameters" ; import { KeyVaultManagementClient } from "../keyVaultManagementClient" ; import { Secret , SecretsListNextOptionalParams , SecretsListOptionalParams , SecretCreateOrUpdateParameters , SecretsCreateOrUpdateOptionalParams , SecretsCreateOrUpdateResponse , SecretPatchParameters , SecretsUpdateOptionalParams , SecretsUpdateResponse , SecretsGetOptionalParams , SecretsGetResponse , SecretsListResponse , SecretsListNextResponse } from "../models" ; /** Class containing Secrets operations. */ export class SecretsImpl implements Secrets { private readonly client : KeyVaultManagementClient ; param client constructor ( client ) { this . client = client ; } param resourceGroupName param vaultName param options public list ( resourceGroupName , vaultName , options ? ) { const iter = this . listPagingAll ( resourceGroupName , vaultName , options ) ; return { next ( ) { return iter . next ( ) ; } , [ Symbol . asyncIterator ] ( ) { return this ; } , byPage : ( ) => { return this . listPagingPage ( resourceGroupName , vaultName , options ) ; } } ; } private async * listPagingPage ( resourceGroupName , vaultName , options ? ) { let result = await this . _list ( resourceGroupName , vaultName , options ) ; yield result . value || [ ] ; let continuationToken = result . nextLink ; while ( continuationToken ) { result = await this . _listNext ( resourceGroupName , vaultName , continuationToken , options ) ; continuationToken = result . nextLink ; yield result . value || [ ] ; } } private async * listPagingAll ( resourceGroupName , vaultName , options ? ) { for await ( const page of this . listPagingPage ( resourceGroupName , vaultName , options ) ) { yield * page ; } } param resourceGroupName param vaultName param secretName param parameters param options createOrUpdate ( resourceGroupName , vaultName , secretName , parameters , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , secretName , parameters , options } , createOrUpdateOperationSpec ) ; } param resourceGroupName param vaultName param secretName param parameters param options update ( resourceGroupName , vaultName , secretName , parameters , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , secretName , parameters , options } , updateOperationSpec ) ; } param resourceGroupName param vaultName param secretName param options get ( resourceGroupName , vaultName , secretName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , secretName , options } , getOperationSpec ) ; } param resourceGroupName param vaultName param options private _list ( resourceGroupName , vaultName , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , options } , listOperationSpec ) ; } param resourceGroupName param vaultName param nextLink param options private _listNext ( resourceGroupName , vaultName , nextLink , options ? ) { return this . client . sendOperationRequest ( { resourceGroupName , vaultName , nextLink , options } , listNextOperationSpec ) ; } } const serializer = coreClient . createSerializer ( Mappers , false ) ; const createOrUpdateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" , httpMethod : "PUT" , responses : { 200 : { bodyMapper : Mappers . Secret } , 201 : { bodyMapper : Mappers . Secret } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters5 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . secretName ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const updateOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" , httpMethod : "PATCH" , responses : { 200 : { bodyMapper : Mappers . Secret } , 201 : { bodyMapper : Mappers . Secret } , default : { bodyMapper : Mappers . CloudError } } , requestBody : Parameters . parameters6 , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName , Parameters . secretName ] , headerParameters : [ Parameters . contentType , Parameters . accept ] , mediaType : "json" , serializer } ; const getOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . Secret } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName1 , Parameters . secretName1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const listOperationSpec = { path : "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . SecretListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . vaultName1 ] , headerParameters : [ Parameters . accept ] , serializer } ; const listNextOperationSpec = { path : "{nextLink}" , httpMethod : "GET" , responses : { 200 : { bodyMapper : Mappers . SecretListResult } , default : { bodyMapper : Mappers . CloudError } } , queryParameters : [ Parameters . apiVersion , Parameters . top ] , urlParameters : [ Parameters . $host , Parameters . subscriptionId , Parameters . resourceGroupName , Parameters . nextLink , Parameters . vaultName1 ] , headerParameters : [ Parameters . accept ] , serializer } ;