public async Task DiscoverServerAsync( [FromBody][Required] DiscoveryRequestApiModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } await _onboarding.DiscoverAsync(request.ToServiceModel()); }
/// <summary> /// Discover application /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <bool> DiscoverAsync(DiscoveryRequestApiModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } await _discover.DiscoverAsync(request.ToServiceModel()); return(true); }
/// <summary> /// Convert back to service model /// </summary> /// <returns></returns> public static DiscoveryRequestModel ToServiceModel( this DiscoveryRequestApiModel model) { if (model == null) { return(null); } return(new DiscoveryRequestModel { Id = model.Id, Configuration = model.Configuration.ToServiceModel(), Discovery = (IIoT.OpcUa.Registry.Models.DiscoveryMode?)model.Discovery }); }
/// <inheritdoc/> public async Task DiscoverAsync(DiscoveryRequestApiModel content, CancellationToken ct) { if (content == null) { throw new ArgumentNullException(nameof(content)); } var request = _httpClient.NewRequest($"{_serviceUri}/v2/applications/discover", _resourceId); request.SetContent(content); request.Options.Timeout = 60000; var response = await _httpClient.PostAsync(request, ct).ConfigureAwait(false); response.Validate(); }
/// <inheritdoc/> public async Task DiscoverAsync(DiscoveryRequestApiModel content, CancellationToken ct) { if (content == null) { throw new ArgumentNullException(nameof(content)); } var request = _httpClient.NewRequest($"{_serviceUri}/v2/applications/discover", Resource.Platform); _serializer.SerializeToRequest(request, content); if (request.Options.Timeout == null) { request.Options.Timeout = TimeSpan.FromMinutes(3); } var response = await _httpClient.PostAsync(request, ct).ConfigureAwait(false); response.Validate(); }