Hay más AWS SDK ejemplos disponibles en el GitHub repositorio de AWS Doc SDK Examples
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Úselo AddTagsToStream
con un AWS SDK o CLI
En los siguientes ejemplos de código, se muestra cómo utilizar AddTagsToStream
.
- .NET
-
- AWS SDK for .NET
-
nota
Hay más en marcha GitHub. Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. using System; using System.Collections.Generic; using System.Threading.Tasks; using Amazon.Kinesis; using Amazon.Kinesis.Model; /// <summary> /// This example shows how to apply key/value pairs to an Amazon Kinesis /// stream. /// </summary> public class TagStream { public static async Task Main() { IAmazonKinesis client = new AmazonKinesisClient(); string streamName = "AmazonKinesisStream"; var tags = new Dictionary<string, string> { { "Project", "Sample Kinesis Project" }, { "Application", "Sample Kinesis App" }, }; var success = await ApplyTagsToStreamAsync(client, streamName, tags); if (success) { Console.WriteLine($"Taggs successfully added to {streamName}."); } else { Console.WriteLine("Tags were not added to the stream."); } } /// <summary> /// Applies the set of tags to the named Kinesis stream. /// </summary> /// <param name="client">The initialized Kinesis client.</param> /// <param name="streamName">The name of the Kinesis stream to which /// the tags will be attached.</param> /// <param name="tags">A sictionary containing key/value pairs which /// will be used to create the Kinesis tags.</param> /// <returns>A Boolean value which represents the success or failure /// of AddTagsToStreamAsync.</returns> public static async Task<bool> ApplyTagsToStreamAsync( IAmazonKinesis client, string streamName, Dictionary<string, string> tags) { var request = new AddTagsToStreamRequest { StreamName = streamName, Tags = tags, }; var response = await client.AddTagsToStreamAsync(request); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; } }
-
Para API obtener más información, consulte AddTagsToStreamla AWS SDK for .NET APIReferencia.
-
- CLI
-
- AWS CLI
-
Para añadir etiquetas a un flujo de datos
El siguiente
add-tags-to-stream
ejemplo asigna una etiqueta con la clavesamplekey
y el valorexample
al flujo especificado.aws kinesis add-tags-to-stream \ --stream-name
samplestream
\ --tagssamplekey=example
Este comando no genera ninguna salida.
Para obtener más información, consulte Cómo etiquetar sus transmisiones en la Guía para desarrolladores de Amazon Kinesis Data Streams.
-
Para API obtener más información, consulte la Referencia AddTagsToStream
de AWS CLI comandos.
-