private void GetEndpointForServiceHelper(string endpointsFile, string service, bool useDualStackEndpoint, bool useFipsEndpoint, string region, string expectedEndpoint) { try { RegionEndpoint.Reload(Utils.GetResourceStream(endpointsFile)); var regionEndpoint = RegionEndpoint.GetBySystemName(region); var getEndpointOptions = new GetEndpointForServiceOptions { DualStack = useDualStackEndpoint, FIPS = useFipsEndpoint }; var hostname = regionEndpoint?.GetEndpointForService(service, getEndpointOptions).Hostname; Assert.IsNotNull(regionEndpoint); Assert.AreEqual(expectedEndpoint, hostname); } finally { RegionEndpoint.Reload(null); } }
/// <summary> /// Gets the endpoint for a service in a region. /// <para /> /// For forwards compatibility, if the service being requested for isn't known in the region, this method /// will generate an endpoint using the AWS endpoint heuristics. In this case, it is not guaranteed the /// endpoint will point to a valid service endpoint. /// </summary> /// <param name="serviceName"> /// The services system name. Service system names can be obtained from the /// RegionEndpointServiceName member of the ClientConfig-derived class for the service. /// </param> /// <param name="options"> /// Specify additional requirements on the <see cref="Endpoint"/> to be returned. /// </param> public Endpoint GetEndpointForService(string serviceName, GetEndpointForServiceOptions options) { return(InternedRegionEndpoint.GetEndpointForService(serviceName, options)); }