/// <summary> /// Update tags with the resource. /// </summary> /// <param name="parameters"> The tags to update. </param> /// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param> /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param> /// <returns> The updated tags. </returns> public virtual TagCreateOrUpdateOperation Update(TagPatchResource parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (parameters is null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("TagResource.UpdateAtScope"); scope.Start(); try { var response = _restClient.UpdateAtScope(Id, parameters, cancellationToken); var operation = new TagCreateOrUpdateOperation(this, response); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Update tags with the resource. /// </summary> /// <param name="parameters"> The tags to update. </param> /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param> /// <returns> The updated tags. </returns> /// <remarks> /// <see href="https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-longrunning">Details on long running operation object.</see> /// </remarks> public virtual TagCreateOrUpdateOperation StartUpdate(TagPatchResource parameters, CancellationToken cancellationToken = default) { using var scope = Diagnostics.CreateScope("TagsOperations.StartUpdateAtScope"); scope.Start(); try { var response = RestClient.UpdateAtScope(Id, parameters, cancellationToken); return(new TagCreateOrUpdateOperation(this, response)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <TagResource> Update(TagPatchResource parameters, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _tagResourceTagsClientDiagnostics.CreateScope("TagResource.Update"); scope.Start(); try { var response = _tagResourceTagsRestClient.UpdateAtScope(Id.Parent, parameters, cancellationToken); return(Response.FromValue(new TagResource(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Update tags with the resource. /// </summary> /// <param name="parameters"> The tags to update. </param> /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param> /// <returns> The updated tags. </returns> public virtual Response <TagResource> Update(TagPatchResource parameters, CancellationToken cancellationToken = default) { if (parameters is null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = Diagnostics.CreateScope("TagsOperations.UpdateAtScope"); scope.Start(); try { var operation = StartUpdate(parameters, cancellationToken); return(operation.WaitForCompletion(cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Update tags with the resource. /// </summary> /// <param name="parameters"> The tags to update. </param> /// <param name="cancellationToken"> A token to allow the caller to cancel the call to the service. The default value is <see cref="CancellationToken.None" />. </param> /// <returns> The updated tags. </returns> public virtual async Task <Response <TagResource> > UpdateAsync(TagPatchResource parameters, CancellationToken cancellationToken = default) { if (parameters is null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = Diagnostics.CreateScope("TagsOperations.UpdateAtScope"); scope.Start(); try { var operation = await StartUpdateAsync(parameters, cancellationToken).ConfigureAwait(false); return(await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }