#pragma once /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #if !BYO_CRYPTO namespace Aws { namespace Iot { using CreateSigningConfig = std::function(void)>; /** * Class encapsulating configuration for establishing an Aws IoT mqtt connection via websockets */ struct AWS_CRT_CPP_API WebsocketConfig { /** * Create a websocket configuration for use with the default credentials provider chain. Signing region * will be used for Sigv4 signature calculations. * * @param signingRegion Aws region that is being connected to. Required in order to properly sign the * handshake upgrade request * @param bootstrap client bootstrap to establish any connections needed by the default credentials * provider chain which will get built for the user * @param allocator memory allocator to use */ WebsocketConfig( const Crt::String &signingRegion, Crt::Io::ClientBootstrap *bootstrap, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; /** * Create a websocket configuration for use with the default credentials provider chain and default * ClientBootstrap. Signing region will be used for Sigv4 signature calculations. * * For more information on the default ClientBootstrap see * Aws::Crt::ApiHandle::GetOrCreateDefaultClientBootstrap * * @param signingRegion Aws region that is being connected to. Required in order to properly sign the * handshake upgrade request * @param allocator memory allocator to use */ WebsocketConfig(const Crt::String &signingRegion, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; /** * Create a websocket configuration for use with a custom credentials provider. Signing region will be used * for Sigv4 signature calculations. * * @param signingRegion Aws region that is being connected to. Required in order to properly sign the * handshake upgrade request * @param credentialsProvider credentials provider to source AWS credentials from * @param allocator memory allocator to use */ WebsocketConfig( const Crt::String &signingRegion, const std::shared_ptr &credentialsProvider, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; /** * Create a websocket configuration for use with a custom credentials provider, and a custom signer. * * You'll need to provide a function for use with creating a signing Config and pass it to * createSigningConfig. * * This is useful for cases use with: * https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html * * @param credentialsProvider credentials provider * @param signer HTTP request signer * @param createSigningConfig function that creates a signing config */ WebsocketConfig( const std::shared_ptr &credentialsProvider, const std::shared_ptr &signer, CreateSigningConfig createSigningConfig) noexcept; std::shared_ptr CredentialsProvider; std::shared_ptr Signer; CreateSigningConfig CreateSigningConfigCb; /** * @deprecated Specify ProxyOptions to use a proxy with your websocket connection. * * If MqttClientConnectionConfigBuilder::m_proxyOptions is valid, then that will be used over * this value. */ Crt::Optional ProxyOptions; Crt::String SigningRegion; Crt::String ServiceName; }; } // namespace Iot } // namespace Aws #endif // !BYO_CRYPTO