public async Task UpdateNamespace() { IgnoreTestInLiveMode(); //create namespace string namespaceName = await CreateValidNamespaceName(namespacePrefix); _resourceGroup = await CreateResourceGroupAsync(); ServiceBusNamespaceCollection namespaceCollection = _resourceGroup.GetServiceBusNamespaces(); ServiceBusNamespaceResource serviceBusNamespace = (await namespaceCollection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName, new ServiceBusNamespaceData(DefaultLocation))).Value; VerifyNamespaceProperties(serviceBusNamespace, true); //update namespace ServiceBusNamespacePatch parameters = new ServiceBusNamespacePatch(DefaultLocation); parameters.Tags.Add("key1", "value1"); parameters.Tags.Add("key2", "value2"); serviceBusNamespace = await serviceBusNamespace.UpdateAsync(parameters); //validate Assert.AreEqual(serviceBusNamespace.Data.Tags.Count, 2); Assert.AreEqual("value1", serviceBusNamespace.Data.Tags["key1"]); Assert.AreEqual("value2", serviceBusNamespace.Data.Tags["key2"]); //wait until provision state is succeeded await GetSucceededNamespace(serviceBusNamespace); }
public virtual Response <ServiceBusNamespaceResource> Update(ServiceBusNamespacePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _serviceBusNamespaceNamespacesClientDiagnostics.CreateScope("ServiceBusNamespaceResource.Update"); scope.Start(); try { var response = _serviceBusNamespaceNamespacesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); return(Response.FromValue(new ServiceBusNamespaceResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }