Skip to content

Commit 0cd85be

Browse files
authored
Migrate Mqtt5ClientBuilder from deprecated New* to Create* APIs (#858)
* Migrate Mqtt5ClientBuilder from deprecated New* to Create* APIs * Migrating all New* to Create* api * Nit Fix
1 parent d870ae8 commit 0cd85be

17 files changed

Lines changed: 68 additions & 71 deletions

File tree

documents/MIGRATION_GUIDE.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,26 +100,25 @@ std::shared_ptr<MqttClient>client = std::shared_ptr<MqttClient>(
100100
mqtt_timeout,
101101
/* disconnect handler */, nullptr,
102102
/* reconnect handler */, nullptr,
103-
/* resubscribe handler */, nullptr);
103+
/* resubscribe handler */, nullptr));
104104
```
105105
106106
#### Example of creating a client in the v2 SDK
107107
108108
The v2 SDK supports different connection types. Given the same input parameters as in the v1 example above,
109-
the most recommended method to create an MQTT5 client will be [NewMqtt5ClientBuilderWithMtlsFromPath](https://aws.github.io/aws-iot-device-sdk-cpp-v2/class_aws_1_1_iot_1_1_mqtt5_client_builder.html#ab595bbc50e08b9d2f78f62e9efeafd65).
109+
the most recommended method to create an MQTT5 client will be [CreateMqtt5ClientBuilderWithMtlsFromPath](https://aws.github.io/aws-iot-device-sdk-cpp-v2/class_aws_1_1_iot_1_1_mqtt5_client_builder.html#a21c365a232be4447b21eb56cc55d4b62).
110110
111111
```cpp
112112
util::String clientEndpoint = "<prefix>-ats.iot.<region>.amazonaws.com";
113113
util::String certificateFile = "<certificate file>"; // X.509 based certificate file
114114
util::String privateKeyFile = "<private key file>"; // PEM encoded private key file
115-
uint32_t clientPort = <port number>
115+
uint32_t clientPort = <port number>;
116116
String client_id = "unique client id";
117117
118-
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder(
119-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(
120-
clientEndpoint,
121-
certificateFile,
122-
privateKeyFile));
118+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder =
119+
Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(
120+
clientEndpoint, certificateFile.c_str(), privateKeyFile.c_str());
121+
123122
std::shared_ptr<Mqtt5::ConnectPacket> connectOptions =
124123
Aws::Crt::MakeShared<Mqtt5::ConnectPacket>(Aws::Crt::DefaultAllocatorImplementation());
125124
util::String clientId = "client_id";
@@ -619,7 +618,7 @@ except QOS0 publish packets in the offline queue on disconnect:
619618

620619
```cpp
621620
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder(
622-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(/* ... */));
621+
Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(/* ... */));
623622

624623
builder.WithOfflineQueueBehavior(
625624
Mqtt5::ClientOperationQueueBehaviorType::

documents/MQTT5_Userguide.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
- [Direct MQTT with Custom Authentication](#direct-mqtt-with-custom-authentication)
1818
- [MQTT over Websockets with Cognito](#mqtt-over-websockets-with-cognito)
1919
- [Direct MQTT with Windows Certificate Store Method](#direct-mqtt-with-windows-certificate-store-method)
20-
- [Direct MQTT with PKCS11 Method](#direct-mqtt-with-pkcs11-method)
21-
- [Direct MQTT with pkcs12 method](#direct-mqtt-with-pkcs12-method)
20+
- [Direct MQTT with PKCS11 Method (Unix Only)](#direct-mqtt-with-pkcs11-method-unix-only)
21+
- [Direct MQTT with pkcs12 method (macOS Only)](#direct-mqtt-with-pkcs12-method-macos-only)
2222
+ [Adding an HTTP Proxy](#adding-an-http-proxy)
2323
+ [Client Operations](#client-operations)
2424
- [Subscribe](#subscribe)
@@ -81,7 +81,7 @@ Example:
8181
std::shared_ptr<Mqtt5Client> client = nullptr;
8282

8383
// Create Mqtt5Client Builder
84-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(...);
84+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(...);
8585

8686
// Setup lifecycle callbacks
8787
builder->WithClientConnectionSuccessCallback(
@@ -115,10 +115,10 @@ Once a MQTT5 client builder has been created, it is ready to make a [MQTT5 clien
115115
```cpp
116116

117117
// Create Mqtt5Client Builder
118-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(...);
118+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(...);
119119

120120
// Build Mqtt5Client
121-
std::shared_ptr<Aws::Crt::Mqtt5Client> client = builder->Build();
121+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> client = builder->Build();
122122

123123
if (mqtt5Client == nullptr)
124124
{
@@ -142,7 +142,7 @@ The MQTT5 client emits a set of events related to state and network status chang
142142
```cpp
143143
144144
// Create Mqtt5Client Builder
145-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(...);
145+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(...);
146146
147147
148148
/* setup lifecycle event callbacks */
@@ -181,7 +181,7 @@ The MQTT5 client emits a set of events related to state and network status chang
181181
});
182182
183183
// Build Mqtt5Client
184-
std::shared_ptr<Aws::Crt::Mqtt5Client> client = builder->Build();
184+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> client = builder->Build();
185185
186186
if (mqtt5Client == nullptr)
187187
{
@@ -253,7 +253,7 @@ Emitted once the client has shutdown any associated network connection and enter
253253

254254
```cpp
255255
// Create Mqtt5Client Builder
256-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(...);
256+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(...);
257257

258258
builder->WithPublishReceivedCallback([](const Mqtt5::PublishReceivedEventData &eventData) {
259259
if (eventData.publishPacket == nullptr)
@@ -263,7 +263,7 @@ Emitted once the client has shutdown any associated network connection and enter
263263
fprintf(stdout, "\n");
264264
});
265265

266-
std::shared_ptr<Aws::Crt::Mqtt5Client> client = builder->Build();
266+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> client = builder->Build();
267267
```
268268
269269
@@ -277,10 +277,10 @@ Invoking `start()` on the client will put it into an active state where it recur
277277
```cpp
278278
279279
// Create Mqtt5Client Builder
280-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(...);
280+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(...);
281281
282282
// Build Mqtt5Client
283-
std::shared_ptr<Aws::Crt::Mqtt5Client> client = builder->Build();
283+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> client = builder->Build();
284284
285285
if (mqtt5Client == nullptr)
286286
{
@@ -322,16 +322,17 @@ For X509 based mutual TLS, you can create a client where the certificate and pri
322322
323323
```cpp
324324
// Create a Client using Mqtt5ClientBuilder
325-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(
326-
"<clientEndpoint>", "<certificateFilePath>", "<privateKeyFilePath>");
325+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder =
326+
Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(
327+
"<clientEndpoint>", "<certificateFilePath>", "<privateKeyFilePath>");
327328
328329
/* You can setup other client options and lifecycle event callbacks before call builder->Build().
329330
** Once the the client get built, you could no longer update the client options or connection options
330331
** on the created client.
331332
*/
332333
333334
// Build Mqtt5Client
334-
std::shared_ptr<Aws::Crt::Mqtt5Client> client = builder->Build();
335+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> client = builder->Build();
335336
336337
if (client == nullptr)
337338
{
@@ -369,16 +370,17 @@ If the default credentials provider chain and AWS region are specified, you do n
369370
Aws::Iot::WebsocketConfig websocketConfig(<signing region>, provider);
370371

371372
// Create a Client using Mqtt5ClientBuilder
372-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket(
373-
"<clientEndpoint>", websocketConfig);
373+
std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> builder =
374+
Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket(
375+
"<clientEndpoint>", websocketConfig);
374376

375377
/* You can setup other client options and lifecycle event callbacks before call builder->Build().
376378
** Once the the client get built, you could no longer update the client options or connection options
377379
** on the created client.
378380
*/
379381

380382
// Build Mqtt5Client
381-
std::shared_ptr<Aws::Crt::Mqtt5Client> mqtt5Client = builder->Build();
383+
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> mqtt5Client = builder->Build();
382384

383385
if (mqtt5Client == nullptr)
384386
{
@@ -406,7 +408,7 @@ If your custom authenticator does not use signing, you don't specify anything re
406408
customAuth.WithPassword(<Binary data value of the password field to be passed to the authorizer lambda>);
407409
408410
// Create a Client using Mqtt5ClientBuilder
409-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomCustomAuthorizer(
411+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer(
410412
"<clientEndpoint>", customAuth);
411413
412414
/* You can setup other client options and lifecycle event callbacks before call builder->Build().
@@ -437,7 +439,7 @@ If your custom authorizer uses signing, you must specify the three signed token
437439
customAuth.WithTokenSignature("<The signature of the custom authorizer>")
438440

439441
// Create a Client using Mqtt5ClientBuilder
440-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomCustomAuthorizer(
442+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer(
441443
"<clientEndpoint>", customAuth);
442444

443445
/* You can setup other client options and lifecycle event callbacks before call builder->Build().
@@ -495,7 +497,7 @@ To create a MQTT5 builder configured for this connection, see the following code
495497
Aws::Iot::WebsocketConfig websocketConfig(<signing region>, provider);
496498
497499
// Create a Client using Mqtt5ClientBuilder
498-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket(
500+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket(
499501
"<clientEndpoint>", websocketConfig);
500502
501503
/* You can setup other client options and lifecycle event callbacks before call builder->Build().
@@ -524,7 +526,7 @@ store, rather than simply being files on disk. To create a MQTT5 builder configu
524526
```cpp
525527
String windowsCertPath = "CurrentUser\\MY\\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6";
526528

527-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWindowsCertStorePath(
529+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWindowsCertStorePath(
528530
"<clientEndpoint>", windowsCertPath);
529531

530532
// Build Mqtt5Client
@@ -545,7 +547,7 @@ store, rather than simply being files on disk. To create a MQTT5 builder configu
545547
Note: This is the primary way to use HSM/TPMs on Windows.
546548
Note: Windows Certificate Store connection support is only available on Windows devices.
547549
548-
### Direct MQTT with PKCS11 Method
550+
### Direct MQTT with PKCS11 Method (Unix Only)
549551
550552
A MQTT5 direct connection can be made using a PKCS11 device rather than using a PEM encoded private key,
551553
the private key for mutual TLS is stored on a PKCS#11 compatible smart card or Hardware Security Module (HSM).
@@ -564,7 +566,7 @@ the private key for mutual TLS is stored on a PKCS#11 compatible smart card or H
564566
pkcs11Options.SetTokenLabel("<pkcs11_tokenLabel>");
565567
pkcs11Options.SetPrivateKeyObjectLabel("<pkcs11_privateKeyLabel>");
566568
567-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11(
569+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11(
568570
"<endpoint>", pkcs11Options);
569571
570572
builder->WithPort(8883);
@@ -581,15 +583,15 @@ the private key for mutual TLS is stored on a PKCS#11 compatible smart card or H
581583
```
582584
Note: Currently, TLS integration with PKCS#11 is only available on Unix devices.
583585

584-
### Direct MQTT with PKCS12 Method
586+
### Direct MQTT with PKCS12 Method (macOS Only)
585587
A MQTT5 direct connection can be made using a PKCS12 file rather than using a PEM encoded private key.
586588
To create a MQTT5 builder configured for this connection, see the following code:
587589
```cpp
588590
Aws::Iot::Pkcs12Options testPkcs12Options;
589591
testPkcs12Options.pkcs12_file = "<pkcs12_key>";
590592
testPkcs12Options.pkcs12_password = "<pkcs12_password>";
591593

592-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs12(
594+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs12(
593595
"<endpoint>", testPkcs12Options);
594596

595597
std::shared_ptr<Aws::Crt::Mqtt5::Mqtt5Client> mqtt5Client = builder->Build();
@@ -609,7 +611,7 @@ No matter what your connection transport or authentication method is, you may co
609611
610612
```cpp
611613
// Create a Client using Mqtt5ClientBuilder
612-
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithXXXXX( ... );
614+
Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithXXXXX( ... );
613615
614616
Http::HttpClientConnectionProxyOptions proxyOptions;
615617
proxyOptions.HostName = "<proxyHost>";

samples/mqtt/mqtt5_aws_websocket/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ Note that in a real application, you may want to avoid the use of wildcards in y
6666

6767
</details>
6868

69+
### Determining your signing region
70+
71+
The `signing_region` parameter specifies the AWS region used to sign WebSocket connection requests via [SigV4 authentication](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). It must match the region of your AWS IoT Core endpoint.
72+
For example, if your endpoint is `abcdef12345-ats.iot.us-west-2.amazonaws.com`, the signing region is `us-west-2`.
73+
6974
## How to build
7075

7176
To build the sample, change directory into the sample's folder and run the cmake commands. The sample executable will be built into the `samples/mqtt/mqtt5_aws_websocket/build` folder.

samples/mqtt/mqtt5_aws_websocket/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,8 @@ int main(int argc, char *argv[])
134134
Aws::Iot::WebsocketConfig websocketConfig(cmdData.signingRegion, provider);
135135

136136
// Create a Client using Mqtt5ClientBuilder
137-
auto builder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
138-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket(
139-
cmdData.endpoint, websocketConfig));
137+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket(
138+
cmdData.endpoint, websocketConfig);
140139

141140
// Check if the builder setup correctly.
142141
if (builder == nullptr)

samples/mqtt/mqtt5_custom_auth_signed/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ int main(int argc, char *argv[])
164164
customAuth.WithTokenKeyName(cmdData.authTokenKeyName.c_str());
165165
customAuth.WithTokenValue(cmdData.authTokenKeyValue.c_str());
166166

167-
auto builder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
168-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer(cmdData.endpoint, customAuth, DefaultAllocatorImplementation()));
167+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer(
168+
cmdData.endpoint, customAuth, DefaultAllocatorImplementation());
169169

170170
// Check if the builder setup correctly.
171171
if (builder == nullptr)

samples/mqtt/mqtt5_custom_auth_unsigned/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ int main(int argc, char *argv[])
138138
customAuth.WithUsername(cmdData.authUsername.c_str());
139139
customAuth.WithPassword(ByteCursorFromCString(cmdData.authPassword.c_str()));
140140

141-
auto builder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
142-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer(
143-
cmdData.endpoint, customAuth, DefaultAllocatorImplementation()));
141+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer(
142+
cmdData.endpoint, customAuth, DefaultAllocatorImplementation());
144143

145144
// Check if the builder setup correctly.
146145
if (builder == nullptr)

samples/mqtt/mqtt5_pkcs11/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ int main(int argc, char *argv[])
189189
pkcs11Options.SetSlotId(cmdData.pkcs11SlotId);
190190
}
191191

192-
Aws::Iot::Mqtt5ClientBuilder *builder =
193-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11(cmdData.endpoint, pkcs11Options);
192+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11(
193+
cmdData.endpoint, pkcs11Options);
194194
// Check if the builder setup correctly.
195195
if (builder == nullptr)
196196
{

samples/mqtt/mqtt5_x509/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ int main(int argc, char *argv[])
126126
* Create MQTT5 client builder using mutual TLS via X509 Certificate and Private Key,
127127
* The builder will be used to create the final client
128128
*/
129-
auto builder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
130-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(
131-
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str()));
129+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(
130+
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str());
132131

133132
// Check if the builder setup correctly.
134133
if (builder == nullptr)

samples/others/device_defender/mqtt5_basic_report/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ int main(int argc, char *argv[])
176176
ApiHandle apiHandle;
177177

178178
// Create the MQTT builder and populate it with data from cmdData.
179-
auto clientConfigBuilder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
180-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(
181-
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str()));
179+
auto clientConfigBuilder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(
180+
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str());
181+
182182
if (clientConfigBuilder == nullptr)
183183
{
184184
fprintf(

samples/service_clients/commands/commands-sandbox/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,8 @@ int main(int argc, char *argv[])
275275
Aws::Crt::ApiHandle apiHandle;
276276

277277
// Create the MQTT5 builder and populate it with data from cmdData.
278-
auto builder = std::unique_ptr<Aws::Iot::Mqtt5ClientBuilder>(
279-
Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath(
280-
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str()));
278+
auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath(
279+
cmdData.endpoint, cmdData.cert.c_str(), cmdData.key.c_str());
281280
// Check if the builder setup correctly.
282281
if (builder == nullptr)
283282
{

0 commit comments

Comments
 (0)