AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
与 AWS SDK或DescribePortal
一起使用 CLI
以下代码示例演示如何使用 DescribePortal
。
- CLI
-
- AWS CLI
-
描述门户
以下
describe-portal
示例描述了一家风电场公司的 Web 门户。aws iotsitewise describe-portal \ --portal-id
a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
输出:
{ "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalArn": "arn:aws:iotsitewise:us-west-2:123456789012:portal/a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE", "portalName": "WindFarmPortal", "portalDescription": "A portal that contains wind farm projects for Example Corp.", "portalClientId": "E-a1b2c3d4e5f6_a1b2c3d4e5f6EXAMPLE", "portalStartUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws", "portalContactEmail": "support@example.com", "portalStatus": { "state": "ACTIVE" }, "portalCreationDate": "2020-02-04T23:01:52.90248068Z", "portalLastUpdateDate": "2020-02-04T23:01:52.90248078Z", "roleArn": "arn:aws:iam::123456789012:role/MySiteWiseMonitorServiceRole" }
有关更多信息,请参阅《AWS 物联网 SiteWise 用户指南》中的管理门户。
-
有关API详细信息,请参阅 “DescribePortal AWS CLI
命令参考”。
-
- Java
-
- SDK适用于 Java 2.x
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /** * Retrieves a portal's description. * * @param portalId the ID of the portal to describe. * @return a {@link CompletableFuture} that represents a {@link String} result of the portal's start URL * (see: {@link DescribePortalResponse#portalStartUrl()}). The calling code can attach callbacks, then handle the * result or exception by calling {@link CompletableFuture#join()} or {@link CompletableFuture#get()}. * <p> * If any completion stage in this method throws an exception, the method logs the exception cause and keeps * it available to the calling code as a {@link CompletionException}. By calling * {@link CompletionException#getCause()}, the calling code can access the original exception. */ public CompletableFuture<String> describePortalAsync(String portalId) { DescribePortalRequest request = DescribePortalRequest.builder() .portalId(portalId) .build(); return getAsyncClient().describePortal(request) .handle((response, exception) -> { if (exception != null) { logger.error("An exception occurred retrieving the portal description: {}", exception.getCause().getMessage()); throw (CompletionException) exception; } return response.portalStartUrl(); }); }
-
有关API详细信息,请参阅 “AWS SDK for Java 2.x API参考 DescribePortal” 中的。
-
DescribeGateway
GetAssetPropertyValue