public async Task RegenerateKeyTest() { List <ApiKey> keys = await ConfigStore.GetKeysAsync().ToEnumerableAsync(); ApiKey orignalKey = keys.FirstOrDefault(); RegenerateKeyOptions regenerateKeyOptions = new RegenerateKeyOptions() { Id = orignalKey.Id }; ApiKey configurationStore = await ConfigStore.RegenerateKeyAsync(regenerateKeyOptions); keys = await ConfigStore.GetKeysAsync().ToEnumerableAsync(); Assert.IsTrue(keys.Where(x => x.Name == orignalKey.Name).FirstOrDefault().Value != orignalKey.Value); }
public virtual Response <ApiKey> RegenerateKey(RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) { Argument.AssertNotNull(regenerateKeyOptions, nameof(regenerateKeyOptions)); using var scope = _configurationStoreClientDiagnostics.CreateScope("ConfigurationStore.RegenerateKey"); scope.Start(); try { var response = _configurationStoreRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyOptions, cancellationToken); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <CommunicationServiceKeys> RegenerateKey(RegenerateKeyOptions parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _communicationServiceClientDiagnostics.CreateScope("CommunicationService.RegenerateKey"); scope.Start(); try { var response = _communicationServiceRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, parameters, cancellationToken); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <ApiKey> > RegenerateKeyAsync(RegenerateKeyOptions regenerateKeyOptions, CancellationToken cancellationToken = default) { if (regenerateKeyOptions == null) { throw new ArgumentNullException(nameof(regenerateKeyOptions)); } using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.RegenerateKey"); scope.Start(); try { var response = await _configurationStoresRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, regenerateKeyOptions, cancellationToken).ConfigureAwait(false); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <CommunicationServiceKeys> > RegenerateKeyAsync(RegenerateKeyOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); using var scope = _communicationServiceClientDiagnostics.CreateScope("CommunicationServiceResource.RegenerateKey"); scope.Start(); try { var response = await _communicationServiceRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, options, cancellationToken).ConfigureAwait(false); return(response); } catch (Exception e) { scope.Failed(e); throw; } }