AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭ListStreams
配 AWS SDK或使用 CLI
下列程式碼範例會示範如何使用ListStreams
。
- .NET
-
- AWS SDK for .NET
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 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細資訊,請參閱AWS SDK for .NET API參考ListStreams中的。
-
- CLI
-
- AWS CLI
-
若要列出資料串流
下列
list-streams
範例會列出目前帳戶和區域中的所有作用中資料串流。aws kinesis list-streams
輸出:
{ "StreamNames": [ "samplestream", "samplestream1" ] }
如需詳細資訊,請參閱 Amazon Kinesis 資料串流開發人員指南中的列出串流。
-
如需詳API細資訊,請參閱AWS CLI 指令參考ListStreams
中的。
-
- Rust
-
- SDK對於銹
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 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
中AWS SDK的以取得 Rust API 參考
-
- SAP ABAP
-
- SDK對於 SAP ABAP
-
注意
還有更多關於 GitHub。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫
中設定和執行。 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中AWS SDK的以供SAPABAPAPI參考。
-
ListStreamConsumers
ListTagsForStream