public async Task UpdateGroupAsync(string groupId, [FromBody][Required] TrustGroupUpdateRequestApiModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } await _groups.UpdateGroupAsync(groupId, request.ToServiceModel()); }
/// <summary> /// Convert to service model /// </summary> /// <returns></returns> public static TrustGroupRegistrationUpdateModel ToServiceModel( this TrustGroupUpdateRequestApiModel model) { if (model == null) { return(null); } return(new TrustGroupRegistrationUpdateModel { Name = model.Name, IssuedKeySize = model.IssuedKeySize, IssuedLifetime = model.IssuedLifetime, IssuedSignatureAlgorithm = (IIoT.OpcUa.Vault.Models.SignatureAlgorithm?)model.IssuedSignatureAlgorithm, }); }
/// <inheritdoc/> public async Task UpdateGroupAsync(string groupId, TrustGroupUpdateRequestApiModel model, CancellationToken ct) { if (string.IsNullOrEmpty(groupId)) { throw new ArgumentNullException(nameof(groupId)); } if (model == null) { throw new ArgumentNullException(nameof(model)); } if (string.IsNullOrEmpty(groupId)) { throw new ArgumentNullException(nameof(groupId)); } var request = _httpClient.NewRequest($"{_serviceUri}/v2/groups/{groupId}", _resourceId); request.SetContent(model); var response = await _httpClient.PostAsync(request, ct).ConfigureAwait(false); response.Validate(); }
/// <summary> /// Update group registration. /// </summary> /// <remarks> /// Use this function with care and only if you are aware of the security /// implications. Requires manager role. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='groupId'> /// The group id /// </param> /// <param name='body'> /// The group configuration /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task UpdateGroupAsync(this IAzureOpcVaultClient operations, string groupId, TrustGroupUpdateRequestApiModel body, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateGroupWithHttpMessagesAsync(groupId, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Update group registration. /// </summary> /// <remarks> /// Use this function with care and only if you are aware of the security /// implications. Requires manager role. /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='groupId'> /// The group id /// </param> /// <param name='body'> /// The group configuration /// </param> public static void UpdateGroup(this IAzureOpcVaultClient operations, string groupId, TrustGroupUpdateRequestApiModel body) { operations.UpdateGroupAsync(groupId, body).GetAwaiter().GetResult(); }