/// <summary> /// Update a management group. /// . /// </summary> /// <param name="patchGroupOptions"> Management group patch parameters. </param> /// <param name="cacheControl"> Indicates whether the request should utilize any caches. Populate the header with 'no-cache' value to bypass existing caches. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual Response <ManagementGroup> Update(PatchManagementGroupOptions patchGroupOptions, string cacheControl = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ManagementGroup.Update"); scope.Start(); try { var response = _restClient.Update(Id.Name, patchGroupOptions, cacheControl, cancellationToken); return(Response.FromValue(new ManagementGroup(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task Update() { var mgmtGroupOp = await Client.GetManagementGroups().CreateOrUpdateAsync(Recording.GenerateAssetName("mgmt-group-"), new CreateManagementGroupOptions()); ManagementGroup mgmtGroup = mgmtGroupOp.Value; PatchManagementGroupOptions patch = new PatchManagementGroupOptions(); patch.DisplayName = "New Display Name"; ManagementGroup patchedMgmtGroup = await mgmtGroup.UpdateAsync(patch); Assert.AreEqual("New Display Name", patchedMgmtGroup.Data.DisplayName); Assert.AreEqual(mgmtGroup.Data.Id, patchedMgmtGroup.Data.Id); Assert.AreEqual(mgmtGroup.Data.Name, patchedMgmtGroup.Data.Name); Assert.AreEqual(mgmtGroup.Data.TenantId, patchedMgmtGroup.Data.TenantId); Assert.AreEqual(mgmtGroup.Data.Type, patchedMgmtGroup.Data.Type); }
public virtual Response <ManagementGroup> Update(PatchManagementGroupOptions patchGroupRequest, string cacheControl = null, CancellationToken cancellationToken = default) { if (patchGroupRequest == null) { throw new ArgumentNullException(nameof(patchGroupRequest)); } using var scope = _managementGroupClientDiagnostics.CreateScope("ManagementGroup.Update"); scope.Start(); try { var response = _managementGroupRestClient.Update(Id.Name, patchGroupRequest, cacheControl, cancellationToken); return(Response.FromValue(new ManagementGroup(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }