public async Task UpdatePublisherAsync(string publisherId,
                                        [FromBody][Required] PublisherUpdateApiModel request)
 {
     if (request == null)
     {
         throw new ArgumentNullException(nameof(request));
     }
     await _publishers.UpdatePublisherAsync(publisherId,
                                            request.ToServiceModel());
 }
예제 #2
0
 /// <summary>
 /// Convert to service model
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static PublisherUpdateModel ToServiceModel(
     this PublisherUpdateApiModel model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new PublisherUpdateModel {
         SiteId = model.SiteId,
         LogLevel = (IIoT.OpcUa.Registry.Models.TraceLogLevel?)model.LogLevel,
         Configuration = model.Configuration.ToServiceModel()
     });
 }
        /// <inheritdoc/>
        public async Task UpdatePublisherAsync(string publisherId,
                                               PublisherUpdateApiModel content, CancellationToken ct)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            if (string.IsNullOrEmpty(publisherId))
            {
                throw new ArgumentNullException(nameof(publisherId));
            }
            var request = _httpClient.NewRequest($"{_serviceUri}/v2/publishers/{publisherId}",
                                                 _resourceId);

            request.SetContent(content);
            var response = await _httpClient.PatchAsync(request, ct).ConfigureAwait(false);

            response.Validate();
        }