public async virtual Task <Response <SqlTrigger> > SetTagsAsync(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { if (tags == null) { throw new ArgumentNullException($"{nameof(tags)} provided cannot be null.", nameof(tags)); } using var scope = _clientDiagnostics.CreateScope("SqlTrigger.SetTags"); scope.Start(); try { await TagResource.DeleteAsync(cancellationToken : cancellationToken).ConfigureAwait(false); var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken : cancellationToken).ConfigureAwait(false); var originalResponse = await _sqlResourcesRestClient.GetSqlTriggerAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new SqlTrigger(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <SshPublicKey> > SetTagsAsync(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); using var scope = _sshPublicKeyClientDiagnostics.CreateScope("SshPublicKey.SetTags"); scope.Start(); try { await TagResource.DeleteAsync(WaitUntil.Completed, cancellationToken : cancellationToken).ConfigureAwait(false); var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await TagResource.CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken : cancellationToken).ConfigureAwait(false); var originalResponse = await _sshPublicKeyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new SshPublicKey(Client, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <MachineExtension> > SetTagsAsync(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); using var scope = _machineExtensionClientDiagnostics.CreateScope("MachineExtension.SetTags"); scope.Start(); try { await TagResource.DeleteAsync(true, cancellationToken : cancellationToken).ConfigureAwait(false); var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); await TagResource.CreateOrUpdateAsync(true, originalTags.Value.Data, cancellationToken : cancellationToken).ConfigureAwait(false); var originalResponse = await _machineExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new MachineExtension(Client, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <VirtualMachineScaleSetRollingUpgrade> > SetTagsAsync(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { if (tags == null) { throw new ArgumentNullException(nameof(tags), $"{nameof(tags)} provided cannot be null."); } using var scope = _virtualMachineScaleSetRollingUpgradeClientDiagnostics.CreateScope("VirtualMachineScaleSetRollingUpgrade.SetTags"); scope.Start(); try { await TagResource.DeleteAsync(true, cancellationToken : cancellationToken).ConfigureAwait(false); var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); await TagResource.CreateOrUpdateAsync(true, originalTags.Value.Data, cancellationToken : cancellationToken).ConfigureAwait(false); var originalResponse = await _virtualMachineScaleSetRollingUpgradeRestClient.GetLatestAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new VirtualMachineScaleSetRollingUpgrade(ArmClient, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <CdnWebApplicationFirewallPolicy> > SetTagsAsync(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { if (tags == null) { throw new ArgumentNullException(nameof(tags)); } using var scope = _cdnWebApplicationFirewallPolicyPoliciesClientDiagnostics.CreateScope("CdnWebApplicationFirewallPolicy.SetTags"); scope.Start(); try { await TagResource.DeleteAsync(true, cancellationToken : cancellationToken).ConfigureAwait(false); var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); await TagResource.CreateOrUpdateAsync(true, originalTags.Value.Data, cancellationToken : cancellationToken).ConfigureAwait(false); var originalResponse = await _cdnWebApplicationFirewallPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return(Response.FromValue(new CdnWebApplicationFirewallPolicy(Client, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }