与 Amazon SDK或ListStreams一起使用 CLI - Amazon Kinesis Data Streams
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

与 Amazon SDK或ListStreams一起使用 CLI

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

.NET
Amazon SDK for .NET
注意

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

using System; using System.Collections.Generic; using System.Threading.Tasks; using Amazon.Kinesis; using Amazon.Kinesis.Model; /// <summary> /// Retrieves and displays a list of existing Amazon Kinesis streams. /// </summary> public class ListStreams { public static async Task Main(string[] args) { IAmazonKinesis client = new AmazonKinesisClient(); var response = await client.ListStreamsAsync(new ListStreamsRequest()); List<string> streamNames = response.StreamNames; if (streamNames.Count > 0) { streamNames .ForEach(s => Console.WriteLine($"Stream name: {s}")); } else { Console.WriteLine("No streams were found."); } } }
  • 有关API详细信息,请参阅 “Amazon SDK for .NET API参考 ListStreams” 中的。

CLI
Amazon CLI

列出数据流

以下 list-streams 示例列出了当前账户和区域中的所有活动数据流。

aws kinesis list-streams

输出:

{ "StreamNames": [ "samplestream", "samplestream1" ] }

有关更多信息,请参阅《Amazon Kinesis Data Streams 开发人员指南》中的列出流

Rust
SDK对于 Rust
注意

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

async fn show_streams(client: &Client) -> Result<(), Error> { let resp = client.list_streams().send().await?; println!("Stream names:"); let streams = resp.stream_names; for stream in &streams { println!(" {}", stream); } println!("Found {} stream(s)", streams.len()); Ok(()) }
  • 有关API详细信息,请参见ListStreams中的 Rust Amazon SDK API 参考

SAP ABAP
SDK对于 SAP ABAP
注意

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

TRY. oo_result = lo_kns->liststreams( " oo_result is returned for testing purposes. " "Set Limit to specify that a maximum of streams should be returned." iv_limit = iv_limit ). DATA(lt_streams) = oo_result->get_streamnames( ). MESSAGE 'Streams listed.' TYPE 'I'. CATCH /aws1/cx_knslimitexceededex . MESSAGE 'The request processing has failed because of a limit exceed exception.' TYPE 'E'. ENDTRY.
  • 有关API详细信息,请参阅ListStreams中的Amazon SDK以供SAPABAPAPI参考

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