Exemple #1
0
 public virtual Pageable<EncryptionProtectorResource> GetAll(CancellationToken cancellationToken = default)
 {
     Page<EncryptionProtectorResource> FirstPageFunc(int? pageSizeHint)
     {
         using var scope = _encryptionProtectorClientDiagnostics.CreateScope("EncryptionProtectorCollection.GetAll");
         scope.Start();
         try
         {
             var response = _encryptionProtectorRestClient.ListByServer(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
             return Page.FromValues(response.Value.Value.Select(value => new EncryptionProtectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse());
         }
         catch (Exception e)
         {
             scope.Failed(e);
             throw;
         }
     }
     Page<EncryptionProtectorResource> NextPageFunc(string nextLink, int? pageSizeHint)
     {
         using var scope = _encryptionProtectorClientDiagnostics.CreateScope("EncryptionProtectorCollection.GetAll");
         scope.Start();
         try
         {
             var response = _encryptionProtectorRestClient.ListByServerNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
             return Page.FromValues(response.Value.Value.Select(value => new EncryptionProtectorResource(Client, value)), response.Value.NextLink, response.GetRawResponse());
         }
         catch (Exception e)
         {
             scope.Failed(e);
             throw;
         }
     }
     return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 }