SiteSourceControlResource IOperationSource <SiteSourceControlResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = SiteSourceControlData.DeserializeSiteSourceControlData(document.RootElement); return(new SiteSourceControlResource(_client, data)); }
public virtual WebAppCreateOrUpdateSourceControlSlotOperation CreateOrUpdate(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 = _webAppsRestClient.CreateOrUpdateSourceControlSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, siteSourceControl, cancellationToken); 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) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal SiteSlotSourcecontrol(ArmResource options, SiteSourceControlData resource) : base(options, resource.Id) { HasData = true; _data = resource; Parent = options; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
public virtual Response <SiteSourceControlResource> Update(SiteSourceControlData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControlResource.Update"); scope.Start(); try { var response = _siteSourceControlWebAppsRestClient.UpdateSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); return(Response.FromValue(new SiteSourceControlResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <SiteSourceControl> > UpdateAsync(SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) { Argument.AssertNotNull(siteSourceControl, nameof(siteSourceControl)); using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControl.Update"); scope.Start(); try { var response = await _siteSourceControlWebAppsRestClient.UpdateSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new SiteSourceControl(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <SiteSourceControl> Update(SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) { if (siteSourceControl == null) { throw new ArgumentNullException(nameof(siteSourceControl)); } using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControl.Update"); scope.Start(); try { var response = _siteSourceControlWebAppsRestClient.UpdateSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken); return(Response.FromValue(new SiteSourceControl(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
internal SiteSourceControlResource(ArmClient client, SiteSourceControlData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <SiteSourceControlResource> CreateOrUpdate(WaitUntil waitUntil, SiteSourceControlData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControlResource.CreateOrUpdate"); scope.Start(); try { var response = _siteSourceControlWebAppsRestClient.CreateOrUpdateSourceControl(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); var operation = new AppServiceArmOperation <SiteSourceControlResource>(new SiteSourceControlOperationSource(Client), _siteSourceControlWebAppsClientDiagnostics, Pipeline, _siteSourceControlWebAppsRestClient.CreateCreateOrUpdateSourceControlRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ArmOperation <SiteSourceControl> > CreateOrUpdateAsync(bool waitForCompletion, SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) { Argument.AssertNotNull(siteSourceControl, nameof(siteSourceControl)); using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControl.CreateOrUpdate"); scope.Start(); try { var response = await _siteSourceControlWebAppsRestClient.CreateOrUpdateSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); var operation = new AppServiceArmOperation <SiteSourceControl>(new SiteSourceControlOperationSource(Client), _siteSourceControlWebAppsClientDiagnostics, Pipeline, _siteSourceControlWebAppsRestClient.CreateCreateOrUpdateSourceControlRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal SiteSourceControl(ArmClient armClient, SiteSourceControlData data) : this(armClient, data.Id) { HasData = true; _data = data; }
public async virtual Task <SiteSourceControlCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, SiteSourceControlData siteSourceControl, CancellationToken cancellationToken = default) { if (siteSourceControl == null) { throw new ArgumentNullException(nameof(siteSourceControl)); } using var scope = _siteSourceControlWebAppsClientDiagnostics.CreateScope("SiteSourceControl.CreateOrUpdate"); scope.Start(); try { var response = await _siteSourceControlWebAppsRestClient.CreateOrUpdateSourceControlAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl, cancellationToken).ConfigureAwait(false); var operation = new SiteSourceControlCreateOrUpdateOperation(ArmClient, _siteSourceControlWebAppsClientDiagnostics, Pipeline, _siteSourceControlWebAppsRestClient.CreateCreateOrUpdateSourceControlRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, siteSourceControl).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }