与 AWS SDK或DescribeContainer一起使用 CLI - AWS元素 MediaStore

终止支持通知:2025 年 11 月 13 日, AWS 将停止对 AWS Element MediaStore al 的支持。2025 年 11 月 13 日之后,您将无法再访问 MediaStore 控制台或 MediaStore 资源。如需更多信息,请访问此博客文章

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

与 AWS SDK或DescribeContainer一起使用 CLI

以下代码示例演示如何使用 DescribeContainer

CLI
AWS CLI

查看容器的详细信息

以下describe-container示例显示了指定容器的详细信息。

aws mediastore describe-container \ --container-name ExampleContainer

输出:

{ "Container": { "CreationTime": 1563558086, "AccessLoggingEnabled": false, "ARN": "arn:aws:mediastore:us-west-2:111122223333:container/ExampleContainer", "Status": "ACTIVE", "Name": "ExampleContainer", "Endpoint": "https://aaabbbcccdddee.data.mediastore.us-west-2.amazonaws.com" } }

有关更多信息,请参阅 AWS Elemental MediaStore 用户指南中的查看容器的详细信息

Java
SDK适用于 Java 2.x
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.mediastore.MediaStoreClient; import software.amazon.awssdk.services.mediastore.model.DescribeContainerRequest; import software.amazon.awssdk.services.mediastore.model.DescribeContainerResponse; import software.amazon.awssdk.services.mediastore.model.MediaStoreException; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DescribeContainer { public static void main(String[] args) { final String usage = """ Usage: <containerName> Where: containerName - The name of the container to describe. """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String containerName = args[0]; Region region = Region.US_EAST_1; MediaStoreClient mediaStoreClient = MediaStoreClient.builder() .region(region) .build(); System.out.println("Status is " + checkContainer(mediaStoreClient, containerName)); mediaStoreClient.close(); } public static String checkContainer(MediaStoreClient mediaStoreClient, String containerName) { try { DescribeContainerRequest describeContainerRequest = DescribeContainerRequest.builder() .containerName(containerName) .build(); DescribeContainerResponse containerResponse = mediaStoreClient.describeContainer(describeContainerRequest); System.out.println("The container name is " + containerResponse.container().name()); System.out.println("The container ARN is " + containerResponse.container().arn()); return containerResponse.container().status().toString(); } catch (MediaStoreException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return ""; } }
  • 有关API详细信息,请参阅 “AWS SDK for Java 2.x API参考 DescribeContainer” 中的。

有关 AWS SDK开发者指南和代码示例的完整列表,请参阅将此服务与 AWS SDK。本主题还包括有关入门的信息以及有关先前SDK版本的详细信息。