/// <summary> /// List all versions of the specified secret. /// </summary> /// <remarks> /// The full secret identifier and attributes are provided in the response. No /// values are returned for the secrets. This operations requires the /// secrets/list permission. /// </remarks> /// <param name="name">The name of the secret.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual AsyncPageable <SecretProperties> GetPropertiesOfSecretVersionsAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Uri firstPageUri = new Uri(VaultUri, $"{SecretsPath}{name}/versions?api-version={_pipeline.ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLink, () => new SecretProperties(), "Azure.Security.KeyVault.Secrets.SecretClient.GetPropertiesOfSecretVersions", cancellationToken))); }
public async Task GetSegmentsInYearTest() { // Arrange Mock <BlobContainerClient> containerClient = new Mock <BlobContainerClient>(); if (IsAsync) { AsyncPageable <BlobHierarchyItem> asyncPageable = PageResponseEnumerator.CreateAsyncEnumerable(GetSegmentsInYearFuncAsync); containerClient.Setup(r => r.GetBlobsByHierarchyAsync(
public async Task GetYearPathsTest() { // Arrange Mock <BlobContainerClient> containerClient = new Mock <BlobContainerClient>(MockBehavior.Strict); if (IsAsync) { AsyncPageable <BlobHierarchyItem> asyncPageable = PageResponseEnumerator.CreateAsyncEnumerable(GetYearsPathFuncAsync); containerClient.Setup(r => r.GetBlobsByHierarchyAsync(
/// <summary> /// List all versions of the specified secret. /// </summary> /// <remarks> /// The full secret identifier and attributes are provided in the response. No /// values are returned for the secrets. This operations requires the /// secrets/list permission. /// </remarks> /// <param name="name">The name of the secret.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual IAsyncEnumerable <Response <SecretBase> > GetSecretVersionsAsync(string name, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException($"{nameof(name)} must not be null or empty", nameof(name)); } Uri firstPageUri = new Uri(_vaultUri, $"{SecretsPath}{name}/versions?api-version={ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetPageAsync(firstPageUri, nextLink, () => new SecretBase(), cancellationToken))); }
public virtual IAsyncEnumerable <Response <KeyBase> > GetKeyVersionsAsync(string name, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException($"{nameof(name)} can't be empty or null"); } Uri firstPageUri = CreateFirstPageUri($"{KeysPath}{name}/versions"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetPageAsync(firstPageUri, nextLink, () => new KeyBase(), cancellationToken))); }
/// <summary> /// List all versions of the specified secret. /// </summary> /// <remarks> /// The full secret identifier and attributes are provided in the response. No /// values are returned for the secrets. This operations requires the /// secrets/list permission. /// </remarks> /// <param name="name">The name of the secret.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual AsyncCollection <SecretBase> GetSecretVersionsAsync(string name, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException($"{nameof(name)} must not be null or empty", nameof(name)); } Uri firstPageUri = new Uri(_vaultUri, $"{SecretsPath}{name}/versions?api-version={_pipeline.ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLink, () => new SecretBase(), "Azure.Security.KeyVault.Secrets.SecretClient.GetSecretVersions", cancellationToken))); }
public virtual AsyncPageable <int> GetPageableValidScopesAsync() { return(PageResponseEnumerator.CreateAsyncEnumerable(s => { CreateAndFireScope(nameof(GetPageableValidScopes)); if (s == null) { return Task.FromResult(Page <int> .FromValues(new[] { 1, 2, 3 }, "1", new MockResponse(200))); } return Task.FromResult(Page <int> .FromValues(new[] { 4, 5, 6 }, null, new MockResponse(200))); })); }
public async Task EnumerateAsyncPages() { var enumerable = PageResponseEnumerator.CreateAsyncEnumerable(async s => { await Task.CompletedTask; return(s == null ? Page <int> .FromValues(new[] { 1, 2, 3 }, "next", new MockResponse(200)) : Page <int> .FromValues(new[] { 4, 5, 6 }, null, new MockResponse(200))); }); Assert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, await enumerable.ToEnumerableAsync()); int pageCount = 0; await foreach (var page in enumerable.AsPages()) { Assert.AreEqual(3, page.Values.Count); pageCount++; } Assert.AreEqual(2, pageCount); }
public async Task GetCursor() { // Arrange string shardPath = "shardPath"; long chunkIndex = 2; long blockOffset = 100; long eventIndex = 200; ShardCursor shardCursor = new ShardCursor( chunkIndex, blockOffset, eventIndex); Mock <BlobContainerClient> containerClient = new Mock <BlobContainerClient>(MockBehavior.Strict); Mock <ChunkFactory> chunkFactory = new Mock <ChunkFactory>(MockBehavior.Strict); Mock <Chunk> chunk = new Mock <Chunk>(MockBehavior.Strict); if (IsAsync) { AsyncPageable <BlobHierarchyItem> asyncPageable = PageResponseEnumerator.CreateAsyncEnumerable(GetChunkPagesFuncAsync); containerClient.Setup(r => r.GetBlobsByHierarchyAsync(
/// <summary> /// Lists the properties of all secrets in the specified vault. You can use the returned <see cref="SecretProperties.Name"/> in subsequent calls to <see cref="GetSecretAsync"/>. /// </summary> /// <remarks> /// The Get Secrets operation is applicable to the entire vault. However, only /// the base secret identifier and its attributes are provided in the response. /// Individual secret versions are not listed in the response. This operation /// requires the secrets/list permission. /// </remarks> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception> public virtual AsyncPageable <SecretProperties> GetPropertiesOfSecretsAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = new Uri(VaultUri, SecretsPath + $"?api-version={_pipeline.ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLink, () => new SecretProperties(), "SecretClient.GetPropertiesOfSecrets", cancellationToken))); }
/// <summary> /// Lists deleted secrets for the specified vault. /// </summary> /// <remarks> /// The Get Deleted Secrets operation returns the secrets that have been /// deleted for a vault enabled for soft-delete. This operation requires the /// secrets/list permission. /// </remarks> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual IAsyncEnumerable <Response <DeletedSecret> > GetDeletedSecretsAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = new Uri(_vaultUri, DeletedSecretsPath + $"?api-version={ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetPageAsync(firstPageUri, nextLink, () => new DeletedSecret(), cancellationToken))); }
public virtual IAsyncEnumerable <Response <DeletedKey> > GetDeletedKeysAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = CreateFirstPageUri(DeletedKeysPath); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetPageAsync(firstPageUri, nextLink, () => new DeletedKey(), cancellationToken))); }
/// <summary> Get provider status. </summary> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual AsyncPageable <ProviderStatus> GetProviderStatusAsync(CancellationToken cancellationToken = default) { return(PageResponseEnumerator.CreateAsyncEnumerable(async cont => ToPage(string.IsNullOrEmpty(cont) ? await _providers.GetStatusAsync().ConfigureAwait(false) : await _providers.GetStatusNextPageAsync(cont).ConfigureAwait(false)))); }
/// <summary> /// Retrieves the different revisions of specific <see cref="ConfigurationSetting"/> that satisfies the options of the <see cref="SettingSelector"/> /// </summary> /// <param name="selector">Set of options for selecting <see cref="ConfigurationSetting"/> from the configuration store.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual AsyncCollection <ConfigurationSetting> GetRevisionsAsync(SettingSelector selector, CancellationToken cancellationToken = default) { return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetRevisionsPageAsync(selector, nextLink, cancellationToken))); }
/// <summary> /// List secrets in a specified key vault. /// </summary> /// <remarks> /// The Get Secrets operation is applicable to the entire vault. However, only /// the base secret identifier and its attributes are provided in the response. /// Individual secret versions are not listed in the response. This operation /// requires the secrets/list permission. /// </remarks> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual AsyncCollection <SecretBase> GetSecretsAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = new Uri(_vaultUri, SecretsPath + $"?api-version={ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => GetPageAsync(firstPageUri, nextLink, () => new SecretBase(), "Azure.Security.KeyVault.Secrets.SecretClient.GetSecrets", cancellationToken))); }
/// <summary> Return list of jobs. </summary> public virtual AsyncPageable <JobDetails> GetJobsAsync(CancellationToken cancellationToken = default) { return(PageResponseEnumerator.CreateAsyncEnumerable(async cont => ToPage(string.IsNullOrEmpty(cont) ? await _jobs.ListAsync().ConfigureAwait(false) : await _jobs.ListNextPageAsync(cont).ConfigureAwait(false)))); }
/// <summary> /// Lists deleted secrets for the specified vault. /// </summary> /// <remarks> /// The Get Deleted Secrets operation returns the secrets that have been /// deleted for a vault enabled for soft-delete. This operation requires the /// secrets/list permission. /// </remarks> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> public virtual AsyncPageable <DeletedSecret> GetDeletedSecretsAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = new Uri(VaultUri, DeletedSecretsPath + $"?api-version={_pipeline.ApiVersion}"); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLink, () => new DeletedSecret(), "Azure.Security.KeyVault.Secrets.SecretClient.GetDeletedSecrets", cancellationToken))); }
/// <summary> /// Lists deleted secrets for the specified vault. /// </summary> /// <remarks> /// The Get Deleted Secrets operation returns the secrets that have been /// deleted for a vault enabled for soft-delete. This operation requires the /// secrets/list permission. /// </remarks> /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param> /// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception> public virtual AsyncPageable <DeletedSecret> GetDeletedSecretsAsync(CancellationToken cancellationToken = default) { Uri firstPageUri = _pipeline.CreateFirstPageUri(DeletedSecretsPath); return(PageResponseEnumerator.CreateAsyncEnumerable(nextLink => _pipeline.GetPageAsync(firstPageUri, nextLink, () => new DeletedSecret(), "SecretClient.GetDeletedSecrets", cancellationToken))); }