将 ListStreams 与 Amazon SDK 或 CLI 配合使用
以下代码示例演示如何使用 ListStreams。
- .NET
-
- 适用于 .NET 的 Amazon SDK
-
注意
查看 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 详细信息,请参阅《适用于 .NET 的 Amazon SDK API 参考》中的 ListStreams。
-
- CLI
-
- Amazon CLI
-
列出数据流
以下
list-streams示例列出了当前账户和区域中的所有活动数据流。aws kinesis list-streams输出:
{ "StreamNames": [ "samplestream", "samplestream1" ] }有关更多信息,请参阅《Amazon Kinesis Data Streams 开发人员指南》中的列出流。
-
有关 API 详细信息,请参阅《Amazon CLI 命令参考》中的 ListStreams
。
-
- Rust
-
- 适用于 Rust 的 SDK
-
注意
查看 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 详细信息,请参阅《Amazon SDK for Rust API 参考》中的 ListStreams
。
-
- SAP ABAP
-
- 适用于 SAP ABAP 的 SDK
-
注意
查看 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 详细信息,请参阅《Amazon SDK for SAP ABAP API 参考》中的 ListStreams。
-
有关 Amazon SDK 开发人员指南和代码示例的完整列表,请参阅 将此服务与 Amazon 开发工具包结合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
ListStreamConsumers
ListTagsForStream