Ejemplo n.º 1
0
 internal SourceControl(ArmResource options, SourceControlData resource) : base(options, resource.Id)
 {
     HasData            = true;
     _data              = resource;
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _restClient        = new WebSiteManagementRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
Ejemplo n.º 2
0
 internal SourceControl(ArmClient armClient, SourceControlData data) : this(armClient, data.Id)
 {
     HasData = true;
     _data   = data;
 }
 internal SourceControlResource(ArmClient client, SourceControlData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
        public virtual ArmOperation <SourceControlResource> Update(WaitUntil waitUntil, SourceControlData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _sourceControlClientDiagnostics.CreateScope("SourceControlResource.Update");
            scope.Start();
            try
            {
                var response  = _sourceControlRestClient.UpdateSourceControl(Id.Name, data, cancellationToken);
                var operation = new AppServiceArmOperation <SourceControlResource>(Response.FromValue(new SourceControlResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Ejemplo n.º 5
0
        public async virtual Task <ArmOperation <SourceControl> > CreateOrUpdateAsync(bool waitForCompletion, string sourceControlType, SourceControlData requestMessage, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(sourceControlType, nameof(sourceControlType));
            Argument.AssertNotNull(requestMessage, nameof(requestMessage));

            using var scope = _sourceControlClientDiagnostics.CreateScope("SourceControlCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _sourceControlRestClient.UpdateSourceControlAsync(sourceControlType, requestMessage, cancellationToken).ConfigureAwait(false);

                var operation = new AppServiceArmOperation <SourceControl>(Response.FromValue(new SourceControl(Client, response), response.GetRawResponse()));
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Ejemplo n.º 6
0
        public async virtual Task <WebSiteManagementUpdateSourceControlOperation> CreateOrUpdateAsync(string sourceControlType, SourceControlData requestMessage, bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            if (sourceControlType == null)
            {
                throw new ArgumentNullException(nameof(sourceControlType));
            }
            if (requestMessage == null)
            {
                throw new ArgumentNullException(nameof(requestMessage));
            }

            using var scope = _clientDiagnostics.CreateScope("SourceControlCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _restClient.UpdateSourceControlAsync(sourceControlType, requestMessage, cancellationToken).ConfigureAwait(false);

                var operation = new WebSiteManagementUpdateSourceControlOperation(Parent, response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Ejemplo n.º 7
0
        public virtual SourceControlCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string sourceControlType, SourceControlData requestMessage, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(sourceControlType, nameof(sourceControlType));
            if (requestMessage == null)
            {
                throw new ArgumentNullException(nameof(requestMessage));
            }

            using var scope = _sourceControlClientDiagnostics.CreateScope("SourceControlCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response  = _sourceControlRestClient.UpdateSourceControl(sourceControlType, requestMessage, cancellationToken);
                var operation = new SourceControlCreateOrUpdateOperation(ArmClient, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }