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));
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
 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);
 }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        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;
            }
        }
Пример #7
0
 internal SiteSourceControlResource(ArmClient client, SiteSourceControlData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Пример #8
0
        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;
            }
        }
Пример #9
0
        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;
            }
        }
Пример #10
0
 internal SiteSourceControl(ArmClient armClient, SiteSourceControlData data) : this(armClient, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Пример #11
0
        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;
            }
        }