public virtual ApplicationCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string applicationName, ApplicationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _applicationClientDiagnostics.CreateScope("ApplicationCollection.CreateOrUpdate"); scope.Start(); try { var response = _applicationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, applicationName, parameters, cancellationToken); var operation = new ApplicationCreateOrUpdateOperation(ArmClient, _applicationClientDiagnostics, Pipeline, _applicationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, applicationName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <Application> > CreateOrUpdateAsync(WaitUntil waitUntil, string applicationName, ApplicationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _applicationClientDiagnostics.CreateScope("ApplicationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _applicationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, applicationName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ResourcesArmOperation <Application>(new ApplicationOperationSource(Client), _applicationClientDiagnostics, Pipeline, _applicationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, applicationName, parameters).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual ApplicationCreateOrUpdateOperation CreateOrUpdate(string applicationName, ApplicationData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (applicationName == null) { throw new ArgumentNullException(nameof(applicationName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ApplicationContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, applicationName, parameters, cancellationToken); var operation = new ApplicationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, applicationName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }