Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan ListTagsForStream
dengan AWS SDK atau CLI
Contoh kode berikut menunjukkan cara menggunakanListTagsForStream
.
- .NET
-
- AWS SDK for .NET
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara pengaturan dan menjalankannya di Repositori Contoh Kode AWS
. using System; using System.Collections.Generic; using System.Threading.Tasks; using Amazon.Kinesis; using Amazon.Kinesis.Model; /// <summary> /// Shows how to list the tags that have been attached to an Amazon Kinesis /// stream. /// </summary> public class ListTags { public static async Task Main() { IAmazonKinesis client = new AmazonKinesisClient(); string streamName = "AmazonKinesisStream"; await ListTagsAsync(client, streamName); } /// <summary> /// List the tags attached to a Kinesis stream. /// </summary> /// <param name="client">An initialized Kinesis client object.</param> /// <param name="streamName">The name of the Kinesis stream for which you /// wish to display tags.</param> public static async Task ListTagsAsync(IAmazonKinesis client, string streamName) { var request = new ListTagsForStreamRequest { StreamName = streamName, Limit = 10, }; var response = await client.ListTagsForStreamAsync(request); DisplayTags(response.Tags); while (response.HasMoreTags) { request.ExclusiveStartTagKey = response.Tags[response.Tags.Count - 1].Key; response = await client.ListTagsForStreamAsync(request); } } /// <summary> /// Displays the items in a list of Kinesis tags. /// </summary> /// <param name="tags">A list of the Tag objects to be displayed.</param> public static void DisplayTags(List<Tag> tags) { tags .ForEach(t => Console.WriteLine($"Key: {t.Key} Value: {t.Value}")); } }
-
Untuk API detailnya, lihat ListTagsForStreamdi AWS SDK for .NET APIReferensi.
-
- CLI
-
- AWS CLI
-
Untuk mencantumkan tag untuk aliran data
list-tags-for-stream
Contoh berikut mencantumkan tag yang dilampirkan ke aliran data yang ditentukan.aws kinesis list-tags-for-stream \ --stream-name
samplestream
Output:
{ "Tags": [ { "Key": "samplekey", "Value": "example" } ], "HasMoreTags": false }
Untuk informasi selengkapnya, lihat Menandai Streaming Anda di Panduan Pengembang Amazon Kinesis Data Streams.
-
Untuk API detailnya, lihat ListTagsForStream
di Referensi AWS CLI Perintah.
-