AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
与 AWS SDK或DescribeGateway
一起使用 CLI
以下代码示例演示如何使用 DescribeGateway
。
- CLI
-
- AWS CLI
-
描述网关
以下
describe-gateway
示例描述了网关。aws iotsitewise describe-gateway \ --gateway-id
a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
输出:
{ "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayName": "ExampleCorpGateway", "gatewayArn": "arn:aws:iotsitewise:us-west-2:123456789012:gateway/a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE", "gatewayPlatform": { "greengrass": { "groupArn": "arn:aws:greengrass:us-west-2:123456789012:/greengrass/groups/a1b2c3d4-5678-90ab-cdef-1b1b1EXAMPLE" } }, "gatewayCapabilitySummaries": [ { "capabilityNamespace": "iotsitewise:opcuacollector:1", "capabilitySyncStatus": "IN_SYNC" } ], "creationDate": 1588369971.457, "lastUpdateDate": 1588369971.457 }
有关更多信息,请参阅《物AWS 联网 SiteWise 用户指南》中的使用网关摄取数据。
-
有关API详细信息,请参阅 “DescribeGateway AWS CLI
命令参考”。
-
- Java
-
- SDK适用于 Java 2.x
-
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 /** * Describes the specified gateway. * * @param gatewayId the ID of the gateway to describe. * @return a {@link CompletableFuture} that represents a {@link DescribeGatewayResponse} result. 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<DescribeGatewayResponse> describeGatewayAsync(String gatewayId) { DescribeGatewayRequest request = DescribeGatewayRequest.builder() .gatewayId(gatewayId) .build(); return getAsyncClient().describeGateway(request) .whenComplete((response, exception) -> { if (exception != null) { logger.error("An error occurred during the describeGateway method: {}", exception.getCause().getMessage()); } }); }
-
有关API详细信息,请参阅 “AWS SDK for Java 2.x API参考 DescribeGateway” 中的。
-
DescribeAssetModel
DescribePortal