public async virtual Task <ConfigurationStoreCreateOperation> CreateOrUpdateAsync(string configStoreName, ConfigurationStoreData configStoreCreationParameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (configStoreName == null) { throw new ArgumentNullException(nameof(configStoreName)); } if (configStoreCreationParameters == null) { throw new ArgumentNullException(nameof(configStoreCreationParameters)); } using var scope = _clientDiagnostics.CreateScope("ConfigurationStoreCollection.CreateOrUpdate"); scope.Start(); try { var response = await _configurationStoresRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters, cancellationToken).ConfigureAwait(false); var operation = new ConfigurationStoreCreateOperation(Parent, _clientDiagnostics, Pipeline, _configurationStoresRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <ConfigurationStore> > CreateOrUpdateAsync(bool waitForCompletion, string configStoreName, ConfigurationStoreData configStoreCreationParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); if (configStoreCreationParameters == null) { throw new ArgumentNullException(nameof(configStoreCreationParameters)); } using var scope = _configurationStoreClientDiagnostics.CreateScope("ConfigurationStoreCollection.CreateOrUpdate"); scope.Start(); try { var response = await _configurationStoreRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters, cancellationToken).ConfigureAwait(false); var operation = new AppConfigurationArmOperation <ConfigurationStore>(new ConfigurationStoreOperationSource(Client), _configurationStoreClientDiagnostics, Pipeline, _configurationStoreRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }