public virtual Response <SqlUserDefinedFunction> AddTag(string key, string value, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); } using var scope = _clientDiagnostics.CreateScope("SqlUserDefinedFunction.AddTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue[key] = value; TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _sqlResourcesRestClient.GetSqlUserDefinedFunction(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); return(Response.FromValue(new SqlUserDefinedFunction(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DatabaseAccountGremlinDatabaseGraphThroughputSetting> RemoveTag(string key, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); } using var scope = _clientDiagnostics.CreateScope("DatabaseAccountGremlinDatabaseGraphThroughputSetting.RemoveTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.Remove(key); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _gremlinResourcesRestClient.GetGremlinGraphThroughput(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); return(Response.FromValue(new DatabaseAccountGremlinDatabaseGraphThroughputSetting(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ConfigurationStore> RemoveTag(string key, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("ConfigurationStore.RemoveTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.Remove(key); TagResource.CreateOrUpdate(true, originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _configurationStoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return(Response.FromValue(new ConfigurationStore(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <Snapshot> RemoveTag(string key, CancellationToken cancellationToken = default) { if (key == null) { throw new ArgumentNullException(nameof(key)); } using var scope = _snapshotClientDiagnostics.CreateScope("Snapshot.RemoveTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.Remove(key); TagResource.CreateOrUpdate(true, originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _snapshotRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return(Response.FromValue(new Snapshot(Client, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachineScaleSetVirtualMachineRunCommand> AddTag(string key, string value, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetVirtualMachineRunCommand.AddTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue[key] = value; TagResource.CreateOrUpdate(true, originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _virtualMachineScaleSetVMRunCommandsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); return(Response.FromValue(new VirtualMachineScaleSetVirtualMachineRunCommand(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <GalleryApplicationVersion> RemoveTag(string key, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); } using var scope = _clientDiagnostics.CreateScope("GalleryApplicationVersion.RemoveTag"); scope.Start(); try { var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.Remove(key); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); return(Response.FromValue(new GalleryApplicationVersion(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <GalleryImageVersion> SetTags(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { if (tags == null) { throw new ArgumentNullException(nameof(tags), $"{nameof(tags)} provided cannot be null."); } using var scope = _clientDiagnostics.CreateScope("GalleryImageVersion.SetTags"); scope.Start(); try { TagResource.Delete(true, cancellationToken: cancellationToken); var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagResource.CreateOrUpdate(true, originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _galleryImageVersionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); return(Response.FromValue(new GalleryImageVersion(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <SshPublicKey> SetTags(IDictionary <string, string> tags, CancellationToken cancellationToken = default) { if (tags == null) { throw new ArgumentNullException(nameof(tags)); } using var scope = _sshPublicKeyClientDiagnostics.CreateScope("SshPublicKey.SetTags"); scope.Start(); try { TagResource.Delete(true, cancellationToken: cancellationToken); var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagResource.CreateOrUpdate(true, originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _sshPublicKeyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return(Response.FromValue(new SshPublicKey(Client, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <DatabaseAccountGremlinDatabaseGraphThroughputSetting> SetTags(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("DatabaseAccountGremlinDatabaseGraphThroughputSetting.SetTags"); scope.Start(); try { TagResource.Delete(cancellationToken: cancellationToken); var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _gremlinResourcesRestClient.GetGremlinGraphThroughput(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); return(Response.FromValue(new DatabaseAccountGremlinDatabaseGraphThroughputSetting(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VirtualMachineScaleSetVMVirtualMachineRunCommand> SetTags(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("VirtualMachineScaleSetVMVirtualMachineRunCommand.SetTags"); scope.Start(); try { TagResource.Delete(cancellationToken: cancellationToken); var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); return(Response.FromValue(new VirtualMachineScaleSetVMVirtualMachineRunCommand(this, originalResponse.Value), originalResponse.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }