public virtual async Task <ArmOperation <SiteSlotSourcecontrolResource> > CreateOrUpdateAsync(WaitUntil waitUntil, SiteSourceControlData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _siteSlotSourcecontrolWebAppsClientDiagnostics.CreateScope("SiteSlotSourcecontrolResource.CreateOrUpdate"); scope.Start(); try { var response = await _siteSlotSourcecontrolWebAppsRestClient.CreateOrUpdateSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); var operation = new AppServiceArmOperation <SiteSlotSourcecontrolResource>(new SiteSlotSourcecontrolOperationSource(Client), _siteSlotSourcecontrolWebAppsClientDiagnostics, Pipeline, _siteSlotSourcecontrolWebAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <WebAppCreateOrUpdateSourceControlSlotOperation> CreateOrUpdateAsync(SiteSourceControlData siteSourceControl, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (siteSourceControl == null) { throw new ArgumentNullException(nameof(siteSourceControl)); } using var scope = _clientDiagnostics.CreateScope("SiteSlotSourcecontrol.CreateOrUpdate"); scope.Start(); try { var response = await _webAppsRestClient.CreateOrUpdateSourceControlSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); var operation = new WebAppCreateOrUpdateSourceControlSlotOperation(this, _clientDiagnostics, Pipeline, _webAppsRestClient.CreateCreateOrUpdateSourceControlSlotRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }