in shadow/source/IotShadowClientV2.cpp [258:315]
bool ClientV2::DeleteShadow(const DeleteShadowRequest &request, const DeleteShadowResultHandler &handler)
{
Aws::Crt::StringStream publishTopicStream;
publishTopicStream << "$aws/things/" << *request.ThingName << "/shadow/delete";
Aws::Crt::String publishTopic = publishTopicStream.str();
Aws::Crt::StringStream subscriptionTopicStream0;
subscriptionTopicStream0 << "$aws/things/" << *request.ThingName << "/shadow/delete/+";
Aws::Crt::String subscriptionTopic0 = subscriptionTopicStream0.str();
struct aws_byte_cursor subscriptionTopicFilters[1] = {
Aws::Crt::ByteCursorFromString(subscriptionTopic0),
};
Aws::Crt::StringStream responsePathTopicAcceptedStream;
responsePathTopicAcceptedStream << publishTopic << "/accepted";
Aws::Crt::String responsePathTopicAccepted = responsePathTopicAcceptedStream.str();
Aws::Crt::StringStream responsePathTopicRejectedStream;
responsePathTopicRejectedStream << publishTopic << "/rejected";
Aws::Crt::String responsePathTopicRejected = responsePathTopicRejectedStream.str();
struct aws_mqtt_request_operation_response_path responsePaths[2];
responsePaths[0].topic = Aws::Crt::ByteCursorFromString(responsePathTopicAccepted);
responsePaths[1].topic = Aws::Crt::ByteCursorFromString(responsePathTopicRejected);
responsePaths[0].correlation_token_json_path = Aws::Crt::ByteCursorFromCString("clientToken");
responsePaths[1].correlation_token_json_path = Aws::Crt::ByteCursorFromCString("clientToken");
Aws::Crt::JsonObject jsonObject;
request.SerializeToObject(jsonObject);
auto uuid = Aws::Crt::UUID().ToString();
jsonObject.WithString("clientToken", uuid);
Aws::Crt::String outgoingJson = jsonObject.View().WriteCompact(true);
struct aws_mqtt_request_operation_options options;
AWS_ZERO_STRUCT(options);
options.subscription_topic_filters = subscriptionTopicFilters;
options.subscription_topic_filter_count = 1;
options.response_paths = responsePaths;
options.response_path_count = 2;
options.publish_topic = Aws::Crt::ByteCursorFromString(publishTopic);
options.serialized_request =
Aws::Crt::ByteCursorFromArray((uint8_t *)outgoingJson.data(), outgoingJson.length());
options.correlation_token = Aws::Crt::ByteCursorFromString(uuid);
auto resultHandler = [handler, responsePathTopicAccepted, responsePathTopicRejected](
Aws::Iot::RequestResponse::UnmodeledResult &&result) {
s_DeleteShadowResponseHandler(
std::move(result), handler, responsePathTopicAccepted, responsePathTopicRejected);
};
int submitResult = m_bindingClient->SubmitRequest(options, std::move(resultHandler));
return submitResult == AWS_OP_SUCCESS;
}