public async virtual Task <WebAppCreateOrUpdateConfigurationSlotOperation> CreateOrUpdateAsync(SiteConfigAutoGeneratedData siteConfig, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (siteConfig == null) { throw new ArgumentNullException(nameof(siteConfig)); } using var scope = _clientDiagnostics.CreateScope("SiteSlotConfigWeb.CreateOrUpdate"); scope.Start(); try { var response = await _webAppsRestClient.CreateOrUpdateConfigurationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteConfig, cancellationToken).ConfigureAwait(false); var operation = new WebAppCreateOrUpdateConfigurationSlotOperation(this, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <ArmOperation <WebSiteSlotConfigResource> > CreateOrUpdateAsync(WaitUntil waitUntil, SiteConfigData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _webSiteSlotConfigWebAppsClientDiagnostics.CreateScope("WebSiteSlotConfigResource.CreateOrUpdate"); scope.Start(); try { var response = await _webSiteSlotConfigWebAppsRestClient.CreateOrUpdateConfigurationSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); var operation = new AppServiceArmOperation <WebSiteSlotConfigResource>(Response.FromValue(new WebSiteSlotConfigResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }