Exemplo n.º 1
0
        public virtual GalleryImageUpdateOperation Update(GalleryImageUpdate galleryImage, bool waitForCompletion = true, CancellationToken cancellationToken = default)
        {
            if (galleryImage == null)
            {
                throw new ArgumentNullException(nameof(galleryImage));
            }

            using var scope = _clientDiagnostics.CreateScope("GalleryImage.Update");
            scope.Start();
            try
            {
                var response  = _restClient.Update(Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImage, cancellationToken);
                var operation = new GalleryImageUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImage).Request, response);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 2
0
        public virtual ArmOperation <GalleryImage> Update(bool waitForCompletion, GalleryImageUpdate galleryImage, CancellationToken cancellationToken = default)
        {
            if (galleryImage == null)
            {
                throw new ArgumentNullException(nameof(galleryImage));
            }

            using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImage.Update");
            scope.Start();
            try
            {
                var response  = _galleryImageRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImage, cancellationToken);
                var operation = new ComputeArmOperation <GalleryImage>(new GalleryImageOperationSource(Client), _galleryImageClientDiagnostics, Pipeline, _galleryImageRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, galleryImage).Request, response, OperationFinalStateVia.Location);
                if (waitForCompletion)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual ArmOperation <GalleryImageResource> Update(WaitUntil waitUntil, PatchableGalleryImageData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _galleryImageClientDiagnostics.CreateScope("GalleryImageResource.Update");
            scope.Start();
            try
            {
                var response  = _galleryImageRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new ComputeArmOperation <GalleryImageResource>(new GalleryImageOperationSource(Client), _galleryImageClientDiagnostics, Pipeline, _galleryImageRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }