AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
S3ExpressIdentityProvider.h
1
6#pragma once
7
8#include <aws/core/utils/memory/stl/AWSSet.h>
9#include <aws/core/utils/memory/stl/AWSString.h>
10#include <aws/core/utils/ConcurrentCache.h>
11#include <aws/core/auth/signer/AWSAuthSignerBase.h>
12#include <aws/s3/S3ExpressIdentity.h>
13#include <smithy/identity/resolver/AwsIdentityResolverBase.h>
14#include <thread>
15#include <condition_variable>
16
17namespace Aws {
18 namespace Http {
19 struct ServiceSpecificParameters;
20 }
21
22 namespace S3 {
23 class S3Client;
25 public:
26 explicit S3ExpressIdentityProvider(const S3Client &s3Client) : m_s3Client(s3Client) {}
27
28 virtual S3ExpressIdentity
29 GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) = 0;
30
32 getIdentity(const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters) override;
34 getIdentity(const Aws::String &bucketName);
35
37
38 protected:
39 std::shared_ptr<std::mutex> GetMutexForBucketName(const Aws::String& bucketName);
40
41 private:
42 const S3Client &m_s3Client;
43 mutable std::mutex m_bucketNameMapMutex;
45 };
46
48 public:
49 explicit DefaultS3ExpressIdentityProvider(const S3Client &m_s3Client);
50
52 std::shared_ptr<Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> credentialsCache);
53
58
59 virtual ~DefaultS3ExpressIdentityProvider() override = default;
60
61 S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
62
63 private:
64 mutable std::shared_ptr<Aws::Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> m_credentialsCache;
65 };
66
68 public:
70 std::chrono::minutes refreshPeriod = std::chrono::minutes(1));
71
73 std::shared_ptr<Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> credentialsCache,
74 std::chrono::minutes refreshPeriod = std::chrono::minutes(1));
75
80
82
83 S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
84
85 private:
86 void refreshIdentities(std::chrono::minutes refreshPeriod);
87 void threadSafeKeyInsert(const Aws::String& key);
88 bool threadSafeKeyHas(const Aws::String& key);
89 void threadSafeKeyEmpty();
90
91 mutable std::shared_ptr<Aws::Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> m_credentialsCache;
92 Aws::Set<Aws::String> m_keysUsed;
93 mutable std::mutex m_keysUsedMutex;
94 mutable bool m_shouldStopBackgroundRefresh;
95 Aws::UniquePtr<std::thread> m_backgroundRefreshThread;
96 mutable std::mutex m_shutDownMutex;
97 mutable std::condition_variable m_shutdownCondition;
98 };
99 }
100}
DefaultAsyncS3ExpressIdentityProvider & operator=(const DefaultAsyncS3ExpressIdentityProvider &other)=delete
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr< Aws::Http::ServiceSpecificParameters > &serviceSpecificParameters) override
DefaultAsyncS3ExpressIdentityProvider(const S3Client &s3Client, std::shared_ptr< Utils::ConcurrentCache< Aws::String, S3ExpressIdentity > > credentialsCache, std::chrono::minutes refreshPeriod=std::chrono::minutes(1))
DefaultAsyncS3ExpressIdentityProvider(const S3Client &m_s3Client, std::chrono::minutes refreshPeriod=std::chrono::minutes(1))
DefaultAsyncS3ExpressIdentityProvider(DefaultAsyncS3ExpressIdentityProvider &&other) noexcept=delete
DefaultAsyncS3ExpressIdentityProvider(const DefaultAsyncS3ExpressIdentityProvider &other)=delete
DefaultAsyncS3ExpressIdentityProvider & operator=(DefaultAsyncS3ExpressIdentityProvider &&other) noexcept=delete
DefaultS3ExpressIdentityProvider(const DefaultS3ExpressIdentityProvider &other)=delete
DefaultS3ExpressIdentityProvider(const S3Client &m_s3Client)
DefaultS3ExpressIdentityProvider & operator=(DefaultS3ExpressIdentityProvider &&other) noexcept=delete
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr< Aws::Http::ServiceSpecificParameters > &serviceSpecificParameters) override
DefaultS3ExpressIdentityProvider(const S3Client &s3Client, std::shared_ptr< Utils::ConcurrentCache< Aws::String, S3ExpressIdentity > > credentialsCache)
virtual ~DefaultS3ExpressIdentityProvider() override=default
DefaultS3ExpressIdentityProvider(DefaultS3ExpressIdentityProvider &&other) noexcept=delete
DefaultS3ExpressIdentityProvider & operator=(const DefaultS3ExpressIdentityProvider &other)=delete
S3ExpressIdentity getIdentity(const Aws::String &bucketName)
virtual S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr< Aws::Http::ServiceSpecificParameters > &serviceSpecificParameters)=0
std::shared_ptr< std::mutex > GetMutexForBucketName(const Aws::String &bucketName)
S3ExpressIdentityProvider(const S3Client &s3Client)
ResolveIdentityFutureOutcome getIdentity(const IdentityProperties &identityProperties, const AdditionalParameters &additionalParameters) override
Aws::UnorderedMap< Aws::String, Aws::Crt::Variant< Aws::String, bool > > AdditionalParameters
Aws::UnorderedMap< Aws::String, Aws::Crt::Variant< Aws::String, bool > > IdentityProperties
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
std::set< T, std::less< T >, Aws::Allocator< T > > Set
std::unique_ptr< T, D > UniquePtr