public List <Endpoint> GetEndpoints(String regionId, String product) { if (null == endpoints) { Endpoint endpoint = iendpoints.GetEndpoint(regionId, product); if (endpoint != null) { endpoints = new List <Endpoint>(); endpoints.Add(endpoint); } } return(endpoints); }
public List <Endpoint> Resolve(string product, string regionId, string serviceCode, string endpointType, Credential credential, LocationConfig locationConfig) { try { if (product == null) { return(_endpoints); } if (_endpoints.FirstOrDefault(x => x.Name == product) != null) { var endpoint = internalEndpointProvider.GetEndpoint(regionId, product); if (serviceCode != null && endpoint == null) { endpoint = remoteEndpointProvider.GetEndpoint(regionId, product, serviceCode, endpointType, credential, locationConfig); } if (endpoint != null) { _endpoints.Add(endpoint); CacheTimeHelper.AddLastClearTimePerProduct(product, regionId, DateTime.UtcNow); } else { throw new ClientException("SDK.InvalidRegionId", "Can not find endpoint to access."); } } else if (Endpoint.FindProductDomain(regionId, product, _endpoints) == null || CacheTimeHelper.CheckCacheIsExpire(product, regionId)) { var endpoint = internalEndpointProvider.GetEndpoint(regionId, product); if (serviceCode != null && endpoint == null) { endpoint = remoteEndpointProvider.GetEndpoint(regionId, product, serviceCode, endpointType, credential, locationConfig); } if (endpoint != null) { foreach (var region in endpoint.RegionIds) { foreach (var productDomain in endpoint.ProductDomains.ToList()) { AddEndpoint(endpoint.Name, region, product, productDomain.DomainName); CacheTimeHelper.AddLastClearTimePerProduct(product, region, DateTime.UtcNow); } } } } } catch (ClientException ex) { CommonLog.LogException(ex, ex.ErrorCode, ex.ErrorMessage); throw new ClientException(ex.ErrorCode, ex.ErrorMessage); } return(_endpoints); }
public virtual Endpoint GetEndpointByIEndpoints(string regionId, string product) { return(iendpoints.GetEndpoint(regionId, product)); }