public async Task GetDataSourceCredentialsAsync() { string endpoint = MetricsAdvisorUri; string subscriptionKey = MetricsAdvisorSubscriptionKey; string apiKey = MetricsAdvisorApiKey; var credential = new MetricsAdvisorKeyCredential(subscriptionKey, apiKey); var adminClient = new MetricsAdvisorAdministrationClient(new Uri(endpoint), credential); var options = new GetDataSourceCredentialsOptions() { MaxPageSize = 5 }; int credentialCount = 0; await foreach (DataSourceCredentialEntity credentialEntity in adminClient.GetDataSourceCredentialsAsync(options)) { Console.WriteLine($"Credential ID: {credentialEntity.Id}"); Console.WriteLine($"Name: {credentialEntity.Name}"); Console.WriteLine($"Description: {credentialEntity.Description}"); Console.WriteLine($"Kind: {credentialEntity.CredentialKind}"); Console.WriteLine(); // Print at most 5 credentials. if (++credentialCount >= 5) { break; } } }
public async Task GetDataSourceCredentials() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var credentialCount = 0; await foreach (DataSourceCredentialEntity credential in adminClient.GetDataSourceCredentialsAsync()) { Assert.That(credential.Id, Is.Not.Null.And.Not.Empty); Assert.That(credential.Name, Is.Not.Null.And.Not.Empty); Assert.That(credential.Description, Is.Not.Null); ValidateGenericDataSourceCredentialEntity(credential); if (++credentialCount >= MaximumSamplesCount) { break; } } Assert.That(credentialCount, Is.GreaterThan(0)); }