Use ListTagsForStream com um AWS SDK ou CLI - AWS SDK Exemplos de código

Há mais AWS SDK exemplos disponíveis no GitHub repositório AWS Doc SDK Examples.

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Use ListTagsForStream com um AWS SDK ou CLI

Os exemplos de códigos a seguir mostram como usar ListTagsForStream.

.NET
AWS SDK for .NET
nota

Tem mais sobre GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

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}")); } }
  • Para API obter detalhes, consulte ListTagsForStreamem AWS SDK for .NET APIReferência.

CLI
AWS CLI

Para listar tags para um fluxo de dados

O list-tags-for-stream exemplo a seguir lista as tags anexadas ao fluxo de dados especificado.

aws kinesis list-tags-for-stream \ --stream-name samplestream

Saída:

{ "Tags": [ { "Key": "samplekey", "Value": "example" } ], "HasMoreTags": false }

Para obter mais informações, consulte Como marcar seus streams no Guia do desenvolvedor do Amazon Kinesis Data Streams.

  • Para API obter detalhes, consulte ListTagsForStreamna Referência de AWS CLI Comandos.