文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DetachThingPrincipal
与 AWS SDK 或 CLI 配合使用
以下代码示例演示如何使用 DetachThingPrincipal
。
- SDK for C++
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 //! Detach a principal from an AWS IoT thing. /*! \param principal: A principal to detach. \param thingName: The name for the thing. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::IoT::detachThingPrincipal(const Aws::String &principal, const Aws::String &thingName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::IoT::IoTClient iotClient(clientConfiguration); Aws::IoT::Model::DetachThingPrincipalRequest detachThingPrincipalRequest; detachThingPrincipalRequest.SetThingName(thingName); detachThingPrincipalRequest.SetPrincipal(principal); Aws::IoT::Model::DetachThingPrincipalOutcome outcome = iotClient.DetachThingPrincipal( detachThingPrincipalRequest); if (outcome.IsSuccess()) { std::cout << "Successfully detached principal " << principal << " from thing " << thingName << std::endl; } else { std::cerr << "Failed to detach principal " << principal << " from thing " << thingName << ": " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
-
有关 API 的详细信息,请参阅 AWS SDK for C++ API 参考DetachThingPrincipal中的。
-