Amazon.Extensions.NETCore.Setup.ClientFactory.CreateClient C# (CSharp) Метод

CreateClient() приватный статический Метод

Creates the service client using the credentials and client config.
private static CreateClient ( Type serviceInterfaceType, AWSCredentials credentials, ClientConfig config ) : AmazonServiceClient
serviceInterfaceType System.Type
credentials Amazon.Runtime.AWSCredentials
config Amazon.Runtime.ClientConfig
Результат AmazonServiceClient
        private static AmazonServiceClient CreateClient(Type serviceInterfaceType, AWSCredentials credentials, ClientConfig config)
        {
            var clientTypeName = serviceInterfaceType.Namespace + "." + serviceInterfaceType.Name.Substring(1) + "Client";
            var clientType = serviceInterfaceType.GetTypeInfo().Assembly.GetType(clientTypeName);
            if (clientType == null)
            {
                throw new AmazonClientException($"Failed to find service client {clientTypeName} which implements {serviceInterfaceType.FullName}.");
            }

            var constructor = clientType.GetConstructor(new Type[] { typeof(AWSCredentials), config.GetType() });
            if (constructor == null)
            {
                throw new AmazonClientException($"Service client {clientTypeName} misisng a constructor with parameters AWSCredentials and {config.GetType().FullName}.");
            }

            var client = constructor.Invoke(new object[] { credentials, config }) as AmazonServiceClient;
            return client;
        }