-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bret Ambrose
committed
Oct 17, 2024
1 parent
f8567cd
commit 8f357e1
Showing
53 changed files
with
3,260 additions
and
1,362 deletions.
There are no files selected for viewing
Submodule aws-crt-cpp
updated
13 files
+13 −0 | CMakeLists.txt | |
+1 −1 | VERSION | |
+1 −1 | crt/aws-c-mqtt | |
+1 −1 | crt/aws-checksums | |
+1 −0 | include/aws/crt/Variant.h | |
+39 −0 | include/aws/crt/checksum/CRC.h | |
+1 −1 | include/aws/crt/crypto/Hash.h | |
+260 −78 | include/aws/iot/MqttRequestResponseClient.h | |
+32 −0 | source/checksum/CRC.cpp | |
+10 −31 | source/iot/MqttRequestResponseClient.cpp | |
+32 −0 | tests/CMakeLists.txt | |
+46 −0 | tests/CRCTest.cpp | |
+1,099 −0 | tests/MqttRequestResponse.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
#pragma once | ||
|
||
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
* | ||
* This file is generated | ||
*/ | ||
|
||
#include <aws/iotidentity/Exports.h> | ||
|
||
#include <aws/crt/StlAllocator.h> | ||
#include <aws/crt/Types.h> | ||
#include <aws/iot/MqttRequestResponseClient.h> | ||
|
||
#include <functional> | ||
|
||
namespace Aws | ||
{ | ||
namespace Crt | ||
{ | ||
namespace Mqtt | ||
{ | ||
class MqttConnection; | ||
} | ||
namespace Mqtt5 | ||
{ | ||
class Mqtt5Client; | ||
} | ||
} // namespace Crt | ||
} // namespace Aws | ||
|
||
namespace Aws | ||
{ | ||
namespace Iotidentity | ||
{ | ||
|
||
template <typename E> class ServiceErrorV2 | ||
{ | ||
public: | ||
ServiceErrorV2() = delete; | ||
ServiceErrorV2(const ServiceErrorV2<E> &rhs) = default; | ||
ServiceErrorV2(ServiceErrorV2<E> &&rhs) = default; | ||
|
||
explicit ServiceErrorV2(int errorCode) : m_errorCode(errorCode), m_modeledError() {} | ||
|
||
ServiceErrorV2(int errorCode, E &&modeledError) | ||
: m_errorCode(errorCode), m_modeledError(std::move(modeledError)) | ||
{ | ||
} | ||
|
||
~ServiceErrorV2() = default; | ||
|
||
ServiceErrorV2<E> &operator=(const ServiceErrorV2<E> &rhs) = default; | ||
ServiceErrorV2<E> &operator=(ServiceErrorV2<E> &&rhs) = default; | ||
|
||
int GetErrorCode() const { return m_errorCode; } | ||
|
||
bool HasModeledError() const { return m_modeledError.has_value(); } | ||
const E &GetModeledError() const { return m_modeledError.value(); } | ||
|
||
private: | ||
int m_errorCode; | ||
|
||
Aws::Crt::Optional<E> m_modeledError; | ||
}; | ||
|
||
class CreateCertificateFromCsrRequest; | ||
class CreateCertificateFromCsrResponse; | ||
class CreateKeysAndCertificateRequest; | ||
class CreateKeysAndCertificateResponse; | ||
class RegisterThingRequest; | ||
class RegisterThingResponse; | ||
class V2ServiceError; | ||
|
||
using CreateCertificateFromCsrResultHandler = std::function<void( | ||
Aws::Iot::RequestResponse::Result<CreateCertificateFromCsrResponse, ServiceErrorV2<V2ServiceError>> &&)>; | ||
using CreateKeysAndCertificateResultHandler = std::function<void( | ||
Aws::Iot::RequestResponse::Result<CreateKeysAndCertificateResponse, ServiceErrorV2<V2ServiceError>> &&)>; | ||
using RegisterThingResultHandler = std::function<void( | ||
Aws::Iot::RequestResponse::Result<RegisterThingResponse, ServiceErrorV2<V2ServiceError>> &&)>; | ||
|
||
/** | ||
* An AWS IoT service that assists with provisioning a device and installing unique client certificates on it | ||
* | ||
* https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html | ||
* | ||
*/ | ||
class AWS_IOTIDENTITY_API IClientV2 | ||
{ | ||
public: | ||
virtual ~IClientV2() = default; | ||
|
||
/** | ||
* Creates a certificate from a certificate signing request (CSR). AWS IoT provides client certificates that | ||
* are signed by the Amazon Root certificate authority (CA). The new certificate has a PENDING_ACTIVATION | ||
* status. When you call RegisterThing to provision a thing with this certificate, the certificate status | ||
* changes to ACTIVE or INACTIVE as described in the template. | ||
* | ||
* | ||
* AWS documentation: | ||
* https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api | ||
* | ||
* @param request operation to perform | ||
* @param handler function object to invoke upon operation completion | ||
* | ||
* @returns success/failure | ||
*/ | ||
virtual bool CreateCertificateFromCsr( | ||
const CreateCertificateFromCsrRequest &request, | ||
const CreateCertificateFromCsrResultHandler &handler) = 0; | ||
|
||
/** | ||
* Creates new keys and a certificate. AWS IoT provides client certificates that are signed by the Amazon | ||
* Root certificate authority (CA). The new certificate has a PENDING_ACTIVATION status. When you call | ||
* RegisterThing to provision a thing with this certificate, the certificate status changes to ACTIVE or | ||
* INACTIVE as described in the template. | ||
* | ||
* | ||
* AWS documentation: | ||
* https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api | ||
* | ||
* @param request operation to perform | ||
* @param handler function object to invoke upon operation completion | ||
* | ||
* @returns success/failure | ||
*/ | ||
virtual bool CreateKeysAndCertificate( | ||
const CreateKeysAndCertificateRequest &request, | ||
const CreateKeysAndCertificateResultHandler &handler) = 0; | ||
|
||
/** | ||
* Provisions an AWS IoT thing using a pre-defined template. | ||
* | ||
* | ||
* AWS documentation: | ||
* https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#fleet-provision-api | ||
* | ||
* @param request operation to perform | ||
* @param handler function object to invoke upon operation completion | ||
* | ||
* @returns success/failure | ||
*/ | ||
virtual bool RegisterThing( | ||
const RegisterThingRequest &request, | ||
const RegisterThingResultHandler &handler) = 0; | ||
}; | ||
|
||
/** | ||
* Creates a new service client that uses an SDK MQTT5 client for transport. | ||
* | ||
* @param protocolClient MQTT client to use as transport | ||
* @param options request-response MQTT client configuration options | ||
* @param allocator memory allocator to use for all client functionality | ||
* | ||
* @return a new service client | ||
*/ | ||
AWS_IOTIDENTITY_API std::shared_ptr<IClientV2> NewClientFrom5( | ||
const Aws::Crt::Mqtt5::Mqtt5Client &protocolClient, | ||
const Aws::Iot::RequestResponse::RequestResponseClientOptions &options, | ||
Aws::Crt::Allocator *allocator = Aws::Crt::ApiAllocator()); | ||
|
||
/** | ||
* Creates a new service client that uses an SDK MQTT311 client for transport. | ||
* | ||
* @param protocolClient MQTT client to use as transport | ||
* @param options request-response MQTT client configuration options | ||
* @param allocator memory allocator to use for all client functionality | ||
* | ||
* @return a new service client | ||
*/ | ||
AWS_IOTIDENTITY_API std::shared_ptr<IClientV2> NewClientFrom311( | ||
const Aws::Crt::Mqtt::MqttConnection &protocolClient, | ||
const Aws::Iot::RequestResponse::RequestResponseClientOptions &options, | ||
Aws::Crt::Allocator *allocator = Aws::Crt::ApiAllocator()); | ||
|
||
} // namespace Iotidentity | ||
} // namespace Aws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
|
||
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
* | ||
* This file is generated | ||
*/ | ||
|
||
#include <aws/iotidentity/Exports.h> | ||
|
||
#include <aws/crt/JsonObject.h> | ||
#include <aws/crt/StlAllocator.h> | ||
|
||
namespace Aws | ||
{ | ||
namespace Iotidentity | ||
{ | ||
|
||
/** | ||
* Response document containing details about a failed request. | ||
* | ||
*/ | ||
class AWS_IOTIDENTITY_API V2ServiceError final | ||
{ | ||
public: | ||
V2ServiceError() = default; | ||
|
||
V2ServiceError(const Crt::JsonView &doc); | ||
V2ServiceError &operator=(const Crt::JsonView &doc); | ||
|
||
void SerializeToObject(Crt::JsonObject &doc) const; | ||
|
||
/** | ||
* Response status code | ||
* | ||
*/ | ||
Aws::Crt::Optional<int32_t> StatusCode; | ||
|
||
/** | ||
* Response error code | ||
* | ||
*/ | ||
Aws::Crt::Optional<Aws::Crt::String> ErrorCode; | ||
|
||
/** | ||
* Response error message | ||
* | ||
*/ | ||
Aws::Crt::Optional<Aws::Crt::String> ErrorMessage; | ||
|
||
private: | ||
static void LoadFromObject(V2ServiceError &obj, const Crt::JsonView &doc); | ||
}; | ||
} // namespace Iotidentity | ||
} // namespace Aws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.