public FirehoseClient Create(FirehoseSettings settings)
        {
            FirehoseClient client = null;

            var waitHandle = new ManualResetEvent(false);

            Task.Factory.StartNew(async() =>
            {
                try
                {
                    client = await CreateAsync(settings);
                }
                finally
                {
                    waitHandle.Set();
                }
            });

            waitHandle.WaitOne();
            return(client);
        }
        private async Task <FirehoseClient> CreateNewWithRoleAsync(FirehoseSettings settings)
        {
            using (var stsClient = new AmazonSecurityTokenServiceClient())
            {
                Credentials credentials = null;

                var assumeRoleRequest = new AssumeRoleRequest()
                {
                    RoleArn         = settings.RoleArn,
                    RoleSessionName = settings.Stream,
                    DurationSeconds = settings.StsTokenAgeInMinutes * 60
                };

                var assumeRoleResponse = await stsClient.AssumeRoleAsync(assumeRoleRequest);

                credentials = assumeRoleResponse.Credentials;

                var region = RegionEndpoint.GetBySystemName(settings.Region);
                var client = new FirehoseClient(new AmazonKinesisFirehoseClient(credentials, region), DateTime.UtcNow.AddMinutes(settings.StsTokenAgeInMinutes));

                return(client);
            }
        }