AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
S3EncryptionClient.h
1
5#pragma once
6
7#include <aws/s3-encryption/s3Encryption_EXPORTS.h>
8#include <aws/s3/S3Client.h>
9#include <aws/s3-encryption/modules/CryptoModuleFactory.h>
10#include <aws/core/client/AWSError.h>
11
12namespace Aws
13{
14 namespace S3Encryption
15 {
16 struct AWS_S3ENCRYPTION_API S3EncryptionErrors
17 {
18 S3EncryptionErrors() = default;
19 S3EncryptionErrors(const Aws::Utils::Crypto::CryptoErrors& error) :cryptoError(error), m_isS3Error(false) {}
20 S3EncryptionErrors(const Aws::S3::S3Errors& error) :s3Error(error), m_isS3Error(true) {}
21
22 inline bool IsS3Error() const { return m_isS3Error; }
23 inline bool IsCryptoError() const { return !m_isS3Error; }
24
25 union {
28 };
29 private:
30 bool m_isS3Error;
31 };
32
33 template<typename ERROR_TYPE>
35 {
37 s3EncryptionError.SetResponseCode(error.GetResponseCode());
38 s3EncryptionError.SetResponseHeaders(error.GetResponseHeaders());
39 return s3EncryptionError;
40 }
41
44
45 class AWS_S3ENCRYPTION_API S3EncryptionClientBase
46 {
47 public:
48 /*
49 * Initialize the S3EncryptionClientBase with encryption materials, crypto configuration, and a client configuration. If no client configuration is supplied,
50 * the default client configuration will be used.
51 */
52 S3EncryptionClientBase(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
54
55 /*
56 * Initialize the S3EncryptionClientBase with encryption materials, crypto configuration, AWS credentials and a client configuration. If no client configuration is supplied,
57 * the default client configuration will be used.
58 */
59 S3EncryptionClientBase(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
61
62 /*
63 * Initialize the S3EncryptionClientBase with encryption materials, crypto configuration, AWS credentials provider and a client configuration. If no client configuration is supplied,
64 * the default client configuration will be used.
65 */
66 S3EncryptionClientBase(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
67 const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration());
68
71
72 /*
73 * Function to put an object encrypted to S3.
74 * For KMSWithContext encryption materials, you can provide a context map as the KMS context for encrypting the CEK.
75 * For other encryption materials, this context map must be an empty map.
76 */
78
79 /*
80 * Function to get an object decrypted from S3.
81 *
82 * Range gets using this method are deprecated. Please see
83 * <https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html> for more information
84 */
86
87 inline bool MultipartUploadSupported() const { return false; }
88
89 protected:
90 /*
91 * Function to get the instruction file object of a encrypted object from S3. This instruction file object will be used to assist decryption.
92 */
94
97 std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials> m_encryptionMaterials;
99 };
100
104 class
105 AWS_DEPRECATED("This class is in the maintenance mode, no new updates will be released, use S3EncryptionClientV2. Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.")
106 AWS_S3ENCRYPTION_API S3EncryptionClient : public S3EncryptionClientBase
107 {
108 public:
109 /*
110 * Initialize the S3 Encryption Client with encryption materials, crypto configuration, and a client configuration. If no client configuration is supplied,
111 * the default client configuration will be used.
112 */
113 S3EncryptionClient(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
115 : S3EncryptionClientBase(encryptionMaterials, cryptoConfig, clientConfiguration)
116 {}
117
118 /*
119 * Initialize the S3 Encryption Client with encryption materials, crypto configuration, AWS credentials and a client configuration. If no client configuration is supplied,
120 * the default client configuration will be used.
121 */
122 S3EncryptionClient(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
124 : S3EncryptionClientBase(encryptionMaterials, cryptoConfig, credentials, clientConfiguration)
125 {}
126
127 /*
128 * Initialize the S3 Encryption Client with encryption materials, crypto configuration, AWS credentials provider and a client configuration. If no client configuration is supplied,
129 * the default client configuration will be used.
130 */
131 S3EncryptionClient(const std::shared_ptr<Aws::Utils::Crypto::EncryptionMaterials>& encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration& cryptoConfig,
132 const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration())
133 : S3EncryptionClientBase(encryptionMaterials, cryptoConfig, credentialsProvider, clientConfiguration)
134 {}
135
136 /*
137 * Function to put an object encrypted to S3.
138 */
140 };
141
146 class AWS_S3ENCRYPTION_API S3EncryptionClientV2 : public S3EncryptionClientBase
147 {
148 public:
149 /*
150 * Initialize the S3 Encryption Client V2 with crypto configuration v2, and a client configuration. If no client configuration is supplied,
151 * the default client configuration will be used.
152 */
155 : S3EncryptionClientBase(cryptoConfig.GetEncryptionMaterials(), CryptoConfiguration(), clientConfig)
156 {
157 Init(cryptoConfig);
158 }
159
160
161 /*
162 * Initialize the S3 Encryption Client V2 with crypto configuration v2, AWS credentials and a client configuration. If no client configuration is supplied,
163 * the default client configuration will be used.
164 */
167 : S3EncryptionClientBase(cryptoConfig.GetEncryptionMaterials(), CryptoConfiguration(), credentials, clientConfig)
168 {
169 Init(cryptoConfig);
170 }
171
172 /*
173 * Initialize the S3 Encryption Client V2 with crypto configuration v2, AWS credentials provider and a client configuration. If no client configuration is supplied,
174 * the default client configuration will be used.
175 */
176 S3EncryptionClientV2(const Aws::S3Encryption::CryptoConfigurationV2& cryptoConfig, const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider,
178 : S3EncryptionClientBase(cryptoConfig.GetEncryptionMaterials(), CryptoConfiguration(), credentialsProvider, clientConfig)
179 {
180 Init(cryptoConfig);
181 }
182
185
186 private:
187 void Init(const Aws::S3Encryption::CryptoConfigurationV2& cryptoConfig);
188 };
189 }
190}
const Aws::Http::HeaderValueCollection & GetResponseHeaders() const
const Aws::String & GetMessage() const
bool ShouldRetry() const
void SetResponseHeaders(const Aws::Http::HeaderValueCollection &headers)
const Aws::String & GetExceptionName() const
void SetResponseCode(Aws::Http::HttpResponseCode responseCode)
Aws::Http::HttpResponseCode GetResponseCode() const
const ERROR_TYPE GetErrorType() const
std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > m_encryptionMaterials
Aws::S3Encryption::Modules::CryptoModuleFactory m_cryptoModuleFactory
S3EncryptionClientBase(const S3EncryptionClientBase &)=delete
S3EncryptionPutObjectOutcome PutObject(const Aws::S3::Model::PutObjectRequest &request, const Aws::Map< Aws::String, Aws::String > &contextMap) const
S3EncryptionClientBase(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &credentialsProvider, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
Aws::S3::Model::GetObjectOutcome GetInstructionFileObject(const Aws::S3::Model::GetObjectRequest &originalGetRequest) const
S3EncryptionGetObjectOutcome GetObject(const Aws::S3::Model::GetObjectRequest &request) const
Aws::UniquePtr< Aws::S3::S3Client > m_s3Client
Aws::S3Encryption::CryptoConfiguration m_cryptoConfig
S3EncryptionClientBase(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const Aws::Auth::AWSCredentials &credentials, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
S3EncryptionClientBase & operator=(const S3EncryptionClientBase &)=delete
S3EncryptionClientBase(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
S3EncryptionPutObjectOutcome PutObject(const Aws::S3::Model::PutObjectRequest &request) const
S3EncryptionClient(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &credentialsProvider, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
S3EncryptionClient(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
S3EncryptionClient(const std::shared_ptr< Aws::Utils::Crypto::EncryptionMaterials > &encryptionMaterials, const Aws::S3Encryption::CryptoConfiguration &cryptoConfig, const Aws::Auth::AWSCredentials &credentials, const Aws::Client::ClientConfiguration &clientConfiguration=Aws::Client::ClientConfiguration())
S3EncryptionClientV2(const Aws::S3Encryption::CryptoConfigurationV2 &cryptoConfig, const Aws::Client::ClientConfiguration &clientConfig=Aws::Client::ClientConfiguration())
S3EncryptionClientV2(const S3EncryptionClientV2 &)=delete
S3EncryptionClientV2 & operator=(const S3EncryptionClientV2 &)=delete
S3EncryptionClientV2(const Aws::S3Encryption::CryptoConfigurationV2 &cryptoConfig, const std::shared_ptr< Aws::Auth::AWSCredentialsProvider > &credentialsProvider, const Aws::Client::ClientConfiguration &clientConfig=Aws::Client::ClientConfiguration())
S3EncryptionClientV2(const Aws::S3Encryption::CryptoConfigurationV2 &cryptoConfig, const Aws::Auth::AWSCredentials &credentials, const Aws::Client::ClientConfiguration &clientConfig=Aws::Client::ClientConfiguration())
Aws::Client::AWSError< S3EncryptionErrors > BuildS3EncryptionError(const Aws::Client::AWSError< ERROR_TYPE > &error)
Aws::Utils::Outcome< Aws::S3::Model::PutObjectResult, Aws::Client::AWSError< S3EncryptionErrors > > S3EncryptionPutObjectOutcome
Aws::Utils::Outcome< Aws::S3::Model::GetObjectResult, Aws::Client::AWSError< S3EncryptionErrors > > S3EncryptionGetObjectOutcome
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
std::unique_ptr< T, D > UniquePtr
S3EncryptionErrors(const Aws::S3::S3Errors &error)
S3EncryptionErrors(const Aws::Utils::Crypto::CryptoErrors &error)
Aws::Utils::Crypto::CryptoErrors cryptoError