Пример #1
0
        public virtual async Task <Response <DeviceUpdateInstanceResource> > UpdateAsync(DeviceUpdateInstancePatch patch, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(patch, nameof(patch));

            using var scope = _deviceUpdateInstanceInstancesClientDiagnostics.CreateScope("DeviceUpdateInstanceResource.Update");
            scope.Start();
            try
            {
                var response = await _deviceUpdateInstanceInstancesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false);

                return(Response.FromValue(new DeviceUpdateInstanceResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public async virtual Task <Response <DeviceUpdateInstance> > UpdateAsync(TagUpdateOptions tagUpdatePayload, CancellationToken cancellationToken = default)
        {
            if (tagUpdatePayload == null)
            {
                throw new ArgumentNullException(nameof(tagUpdatePayload));
            }

            using var scope = _deviceUpdateInstanceInstancesClientDiagnostics.CreateScope("DeviceUpdateInstance.Update");
            scope.Start();
            try
            {
                var response = await _deviceUpdateInstanceInstancesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, tagUpdatePayload, cancellationToken).ConfigureAwait(false);

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