AWS SDK for C++  0.12.9
AWS SDK for C++
Aws.h
Go to the documentation of this file.
1 /*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 #pragma once
16 
22 #include <aws/core/Core_EXPORTS.h>
23 
24 namespace Aws
25 {
26  static const char* DEFAULT_LOG_PREFIX = "aws_sdk_";
27 
32  {
33  LoggingOptions() : logLevel(Aws::Utils::Logging::LogLevel::Off), defaultLogPrefix(DEFAULT_LOG_PREFIX)
34  { }
35 
40 
44  const char* defaultLogPrefix;
45 
50  std::function<std::shared_ptr<Aws::Utils::Logging::LogSystemInterface>()> logger_create_fn;
51  };
52 
57  {
58  MemoryManagementOptions() : memoryManager(nullptr)
59  { }
60 
67  };
68 
72  struct HttpOptions
73  {
74  HttpOptions() : initAndCleanupCurl(true)
75  { }
76 
80  std::function<std::shared_ptr<Aws::Http::HttpClientFactory>()> httpClientFactory_create_fn;
86  };
87 
92  {
93  CryptoOptions() : initAndCleanupOpenSSL(true)
94  { }
95 
99  std::function<std::shared_ptr<Aws::Utils::Crypto::HashFactory>()> md5Factory_create_fn;
103  std::function<std::shared_ptr<Aws::Utils::Crypto::HashFactory>()> sha256Factory_create_fn;
107  std::function<std::shared_ptr<Aws::Utils::Crypto::HMACFactory>()> sha256HMACFactory_create_fn;
111  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_CBCFactory_create_fn;
115  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_CTRFactory_create_fn;
119  std::function<std::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory>()> aes_GCMFactory_create_fn;
123  std::function<std::shared_ptr<Aws::Utils::Crypto::SecureRandomFactory>()> secureRandomFactory_create_fn;
130  };
131 
172  struct SDKOptions
173  {
190  };
191 
192  /*
193  * Initialize SDK wide state for the SDK. This method must be called before doing anything else with this library.
194  *
195  * Common Recipes:
196  *
197  * Just use defaults:
198  *
199  * SDKOptions options;
200  * Aws::InitAPI(options);
201  * .....
202  * Aws::ShutdownAPI(options);
203  *
204  * Turn logging on using the default logger:
205  *
206  * SDKOptions options;
207  * options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
208  * Aws::InitAPI(options);
209  * .....
210  * Aws::ShutdownAPI(options);
211  *
212  * Install custom memory manager:
213  *
214  * MyMemoryManager memoryManager;
215  *
216  * SDKOptions options;
217  * options.memoryManagementOptions.memoryManager = &memoryManager;
218  * Aws::InitAPI(options);
219  * .....
220  * Aws::ShutdownAPI(options);
221  *
222  * Override default http client factory
223  *
224  * SDKOptions options;
225  * options.httpOptions.httpClientFactory_create_fn = [](){ return Aws::MakeShared<MyCustomHttpClientFactory>("ALLOC_TAG", arg1); };
226  * Aws::InitAPI(options);
227  * .....
228  * Aws::ShutdownAPI(options);
229  */
230  AWS_CORE_API void InitAPI(const SDKOptions& options);
231 
236  AWS_CORE_API void ShutdownAPI(const SDKOptions& options);
237 }
238 
const char * defaultLogPrefix
Definition: Aws.h:44
bool initAndCleanupCurl
Definition: Aws.h:85
std::function< std::shared_ptr< Aws::Utils::Logging::LogSystemInterface >)> logger_create_fn
Definition: Aws.h:50
MemoryManagementOptions memoryManagementOptions
Definition: Aws.h:181
bool initAndCleanupOpenSSL
Definition: Aws.h:129
static const char * DEFAULT_LOG_PREFIX
Definition: Aws.h:26
LoggingOptions loggingOptions
Definition: Aws.h:177
AWS_CORE_API void ShutdownAPI(const SDKOptions &options)
CryptoOptions cryptoOptions
Definition: Aws.h:189
Aws::Utils::Memory::MemorySystemInterface * memoryManager
Definition: Aws.h:66
Aws::Utils::Logging::LogLevel logLevel
Definition: Aws.h:39
enum AWS_CORE_API LogLevel
Definition: LogLevel.h:32
HttpOptions httpOptions
Definition: Aws.h:185
AWS_CORE_API void InitAPI(const SDKOptions &options)
#define AWS_CORE_API
Definition: Core_EXPORTS.h:30
JSON (JavaScript Object Notation).
HttpOptions()
Definition: Aws.h:74