public async virtual Task <ArmOperation <ConfigurationStore> > CreateOrUpdateAsync(bool waitForCompletion, string configStoreName, ConfigurationStoreData configStoreCreationParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(configStoreName, nameof(configStoreName)); Argument.AssertNotNull(configStoreCreationParameters, 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; } }
public virtual ConfigurationStoreCreateOperation CreateOrUpdate(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 = _configurationStoresRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters, cancellationToken); var operation = new ConfigurationStoreCreateOperation(Parent, _clientDiagnostics, Pipeline, _configurationStoresRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, configStoreName, configStoreCreationParameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }