Amazon.Runtime.FallbackRegionFactory.GetRegionEndpoint C# (CSharp) Method

GetRegionEndpoint() public static method

public static GetRegionEndpoint ( ) : RegionEndpoint
return RegionEndpoint
        public static RegionEndpoint GetRegionEndpoint()
        {
            return GetRegionEndpoint(true);
        }

Same methods

FallbackRegionFactory::GetRegionEndpoint ( bool includeInstanceMetadata ) : RegionEndpoint

Usage Example

コード例 #1
0
        private CredentialsRefreshState Authenticate(ICredentials userCredential)
        {
            CredentialsRefreshState state;

            var region = Options.STSRegion;

            if (region == null)
            {
                region = FallbackRegionFactory.GetRegionEndpoint();
            }
            if (region == null)
            {
                region = DefaultSTSClientRegion;
            }

            ICoreAmazonSTS coreSTSClient = null;

            try
            {
                var stsConfig = ServiceClientHelpers.CreateServiceConfig(
                    ServiceClientHelpers.STS_ASSEMBLY_NAME, ServiceClientHelpers.STS_SERVICE_CONFIG_NAME);

                stsConfig.RegionEndpoint = region;
                if (Options.ProxySettings != null)
                {
                    stsConfig.SetWebProxy(Options.ProxySettings);
                }

                coreSTSClient = ServiceClientHelpers.CreateServiceFromAssembly <ICoreAmazonSTS>(
                    ServiceClientHelpers.STS_ASSEMBLY_NAME, ServiceClientHelpers.STS_SERVICE_CLASS_NAME,
                    new AnonymousAWSCredentials(), stsConfig);
            }
            catch (Exception e)
            {
                var msg = string.Format(CultureInfo.CurrentCulture,
                                        "Assembly {0} could not be found or loaded. This assembly must be available at runtime to use this profile class.",
                                        ServiceClientHelpers.STS_ASSEMBLY_NAME);
                throw new InvalidOperationException(msg, e);
            }

            var samlCoreSTSClient
#if NETSTANDARD
                = coreSTSClient as ICoreAmazonSTS_SAML;

            if (coreSTSClient == null)
            {
                throw new NotImplementedException("The currently loaded version of AWSSDK.SecurityToken doesn't support SAML authentication.");
            }
All Usage Examples Of Amazon.Runtime.FallbackRegionFactory::GetRegionEndpoint