public async Task Update() { string communicationServiceName = Recording.GenerateAssetName("communication-service-"); var communication1 = await CreateDefaultCommunicationServices(communicationServiceName, _resourceGroup); var patch = new CommunicationServiceResourcePatch() { Tags = { { "newtag", "newvalue" } } }; var communication2 = (await communication1.UpdateAsync(WaitUntil.Completed, patch)).Value; Assert.IsNotNull(communication2); Assert.AreEqual("newtag", communication2.Data.Tags.FirstOrDefault().Key); Assert.AreEqual(communication1.Data.Name, communication2.Data.Name); }
public virtual ArmOperation <CommunicationServiceResource> Update(WaitUntil waitUntil, CommunicationServiceResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); using var scope = _communicationServiceResourceCommunicationServicesClientDiagnostics.CreateScope("CommunicationServiceResource.Update"); scope.Start(); try { var response = _communicationServiceResourceCommunicationServicesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); var operation = new CommunicationArmOperation <CommunicationServiceResource>(new CommunicationServiceResourceOperationSource(Client), _communicationServiceResourceCommunicationServicesClientDiagnostics, Pipeline, _communicationServiceResourceCommunicationServicesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }