public virtual VirtualApplianceSiteCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string siteName, VirtualApplianceSiteData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(siteName, nameof(siteName)); if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _virtualApplianceSiteClientDiagnostics.CreateScope("VirtualApplianceSiteCollection.CreateOrUpdate"); scope.Start(); try { var response = _virtualApplianceSiteRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, parameters, cancellationToken); var operation = new VirtualApplianceSiteCreateOrUpdateOperation(ArmClient, _virtualApplianceSiteClientDiagnostics, Pipeline, _virtualApplianceSiteRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, siteName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual VirtualApplianceSiteCreateOrUpdateOperation CreateOrUpdate(string siteName, VirtualApplianceSiteData parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (siteName == null) { throw new ArgumentNullException(nameof(siteName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("VirtualApplianceSiteContainer.CreateOrUpdate"); scope.Start(); try { var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, siteName, parameters, cancellationToken); var operation = new VirtualApplianceSiteCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, siteName, parameters).Request, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }