public async Task <ResponseModel <ResolvedEndpoint, ResolvedServiceEndpointResponseCode> > DiscoverServiceAsync([FromRoute(Name = "name")] string serviceType, CancellationToken token = default)
        {
            if (LoggingService.IsEnabled(LogLevel.Debug))
            {
                LoggingService.LogDebug($"Service Discover request for: {serviceType}");
            }

            if (!ModelState.IsValid)
            {
                if (LoggingService.IsEnabled(LogLevel.Debug))
                {
                    LoggingService.LogDebug($"Resolution request was sent with an invalid model ModelState.");
                }

                return(Failure <ResolvedEndpoint, ResolvedServiceEndpointResponseCode>(ResolvedServiceEndpointResponseCode.GeneralRequestError));
            }

            //We need to check if we know about the locale
            //If we don't we should indicate it is unlisted
            //We also need to check if the keypair region and servicetype exist
            //TODO: Deployment mode handling, right now it's set to INTERNAL
            if (!await EndpointRepository.ContainsAsync(serviceType, token))
            {
                if (LoggingService.IsEnabled(LogLevel.Debug))
                {
                    LoggingService.LogDebug($"Client requested unlisted service Service: {serviceType}.");
                }

                return(Failure <ResolvedEndpoint, ResolvedServiceEndpointResponseCode>(ResolvedServiceEndpointResponseCode.ServiceUnlisted));
            }

            //Assume no failure
            ServiceEndpointModel endpoint = await EndpointRepository.RetrieveAsync(serviceType, token);

            return(Success <ResolvedEndpoint, ResolvedServiceEndpointResponseCode>(endpoint.Endpoint));
        }
Beispiel #2
0
 /// <inheritdoc />
 public async Task UpdateAsync(string key, ServiceEndpointModel model, CancellationToken token = default)
 {
     //TODO: Implement when not lazy
     throw new NotImplementedException();
 }
Beispiel #3
0
 /// <inheritdoc />
 public async Task <bool> TryCreateAsync(ServiceEndpointModel model, CancellationToken token = default)
 {
     //TODO: Implement when not lazy
     throw new NotImplementedException();
 }