public async Task <Microsoft.VisualStudio.Services.ServiceEndpoints.WebApi.ServiceEndpoint> GetServiceEndpointAsync(CancellationToken cancellationToken) { if (cachedServiceEndpoint == null) { var serviceEndpointClient = await GetServiceEndpointClientAsync(cancellationToken); var projectReference = await GetProjectReferenceAsync(cancellationToken); this.logger.LogDebug("Getting service endpoints from serviceEndpointClient with endpoint name {EndpointName}", endpoint); var serviceEndpoints = await serviceEndpointClient.GetServiceEndpointsByNamesAsync( projectReference.Id.ToString(), new [] { endpoint }, cancellationToken : cancellationToken ); this.logger.LogDebug("serviceEndpointClient returned {Count} service endpoints", serviceEndpoints.Count); cachedServiceEndpoint = serviceEndpoints.First(); this.logger.LogDebug("Cached service endpoint {Name} with id {Id}", cachedServiceEndpoint.Name, cachedServiceEndpoint.Id); } return(cachedServiceEndpoint); }
private async Task <Microsoft.VisualStudio.Services.ServiceEndpoints.WebApi.ServiceEndpoint> GetServiceEndpointAsync(CancellationToken cancellationToken) { if (cachedServiceEndpoint == null) { var serviceEndpointClient = await GetServiceEndpointClientAsync(cancellationToken); var projectReference = await GetProjectReferenceAsync(cancellationToken); var serviceEndpoints = await serviceEndpointClient.GetServiceEndpointsByNamesAsync( projectReference.Id.ToString(), new [] { endpoint }, cancellationToken : cancellationToken ); cachedServiceEndpoint = serviceEndpoints.First(); } return(cachedServiceEndpoint); }
private ServiceEndpointContracts.ServiceEndpoint ToServiceEndpoint(ServiceEndpoint legacyServiceEndpoint) { if (legacyServiceEndpoint == null) { return(null); } var serviceEndpoint = new ServiceEndpointContracts.ServiceEndpoint { Authorization = ToEndpointAuthorization(legacyServiceEndpoint.Authorization), CreatedBy = legacyServiceEndpoint.CreatedBy, Data = legacyServiceEndpoint.Data, Description = legacyServiceEndpoint.Description, Id = legacyServiceEndpoint.Id, IsReady = legacyServiceEndpoint.IsReady, Name = legacyServiceEndpoint.Name, OperationStatus = legacyServiceEndpoint.OperationStatus, Type = legacyServiceEndpoint.Type, Url = legacyServiceEndpoint.Url }; return(serviceEndpoint); }