Exemple #1
0
        public async virtual Task <Response <VirtualMachineTemplate> > UpdateAsync(ResourcePatch body = null, CancellationToken cancellationToken = default)
        {
            using var scope = _virtualMachineTemplateClientDiagnostics.CreateScope("VirtualMachineTemplate.Update");
            scope.Start();
            try
            {
                var response = await _virtualMachineTemplateRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(new VirtualMachineTemplate(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual async Task <Response <VirtualMachineTemplateResource> > UpdateAsync(ResourcePatch patch, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(patch, nameof(patch));

            using var scope = _virtualMachineTemplateClientDiagnostics.CreateScope("VirtualMachineTemplateResource.Update");
            scope.Start();
            try
            {
                var response = await _virtualMachineTemplateRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(new VirtualMachineTemplateResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }