Beispiel #1
0
        public virtual AfdEndpointUpdateOperation Update(bool waitForCompletion, AfdEndpointUpdateOptions endpointUpdateProperties, CancellationToken cancellationToken = default)
        {
            if (endpointUpdateProperties == null)
            {
                throw new ArgumentNullException(nameof(endpointUpdateProperties));
            }

            using var scope = _afdEndpointClientDiagnostics.CreateScope("AfdEndpoint.Update");
            scope.Start();
            try
            {
                var response  = _afdEndpointRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, endpointUpdateProperties, cancellationToken);
                var operation = new AfdEndpointUpdateOperation(ArmClient, _afdEndpointClientDiagnostics, Pipeline, _afdEndpointRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, endpointUpdateProperties).Request, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
0
        public async virtual Task <AfdEndpointUpdateOperation> UpdateAsync(AfdEndpointUpdateOptions endpointUpdateProperties, bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            if (endpointUpdateProperties == null)
            {
                throw new ArgumentNullException(nameof(endpointUpdateProperties));
            }

            using var scope = _clientDiagnostics.CreateScope("AfdEndpoint.Update");
            scope.Start();
            try
            {
                var response = await _afdEndpointsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, endpointUpdateProperties, cancellationToken).ConfigureAwait(false);

                var operation = new AfdEndpointUpdateOperation(this, _clientDiagnostics, Pipeline, _afdEndpointsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, endpointUpdateProperties).Request, response);
                if (waitForCompletion)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }