{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.ECS.Types.Tag -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.ECS.Types.Tag where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude -- | The metadata that you apply to a resource to help you categorize and -- organize them. Each tag consists of a key and an optional value. You -- define them. -- -- The following basic restrictions apply to tags: -- -- - Maximum number of tags per resource - 50 -- -- - For each resource, each tag key must be unique, and each tag key can -- have only one value. -- -- - Maximum key length - 128 Unicode characters in UTF-8 -- -- - Maximum value length - 256 Unicode characters in UTF-8 -- -- - If your tagging schema is used across multiple services and -- resources, remember that other services may have restrictions on -- allowed characters. Generally allowed characters are: letters, -- numbers, and spaces representable in UTF-8, and the following -- characters: + - = . _ : \/ \@. -- -- - Tag keys and values are case-sensitive. -- -- - Do not use @aws:@, @AWS:@, or any upper or lowercase combination of -- such as a prefix for either keys or values as it is reserved for -- Amazon Web Services use. You cannot edit or delete tag keys or -- values with this prefix. Tags with this prefix do not count against -- your tags per resource limit. -- -- /See:/ 'newTag' smart constructor. data Tag = Tag' { -- | One part of a key-value pair that make up a tag. A @key@ is a general -- label that acts like a category for more specific tag values. key :: Prelude.Maybe Prelude.Text, -- | The optional part of a key-value pair that make up a tag. A @value@ acts -- as a descriptor within a tag category (key). value :: Prelude.Maybe Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'Tag' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'key', 'tag_key' - One part of a key-value pair that make up a tag. A @key@ is a general -- label that acts like a category for more specific tag values. -- -- 'value', 'tag_value' - The optional part of a key-value pair that make up a tag. A @value@ acts -- as a descriptor within a tag category (key). newTag :: Tag newTag = Tag' { key = Prelude.Nothing, value = Prelude.Nothing } -- | One part of a key-value pair that make up a tag. A @key@ is a general -- label that acts like a category for more specific tag values. tag_key :: Lens.Lens' Tag (Prelude.Maybe Prelude.Text) tag_key = Lens.lens (\Tag' {key} -> key) (\s@Tag' {} a -> s {key = a} :: Tag) -- | The optional part of a key-value pair that make up a tag. A @value@ acts -- as a descriptor within a tag category (key). tag_value :: Lens.Lens' Tag (Prelude.Maybe Prelude.Text) tag_value = Lens.lens (\Tag' {value} -> value) (\s@Tag' {} a -> s {value = a} :: Tag) instance Data.FromJSON Tag where parseJSON = Data.withObject "Tag" ( \x -> Tag' Prelude.<$> (x Data..:? "key") Prelude.<*> (x Data..:? "value") ) instance Prelude.Hashable Tag where hashWithSalt _salt Tag' {..} = _salt `Prelude.hashWithSalt` key `Prelude.hashWithSalt` value instance Prelude.NFData Tag where rnf Tag' {..} = Prelude.rnf key `Prelude.seq` Prelude.rnf value instance Data.ToJSON Tag where toJSON Tag' {..} = Data.object ( Prelude.catMaybes [ ("key" Data..=) Prelude.<$> key, ("value" Data..=) Prelude.<$> value ] )