{-# 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.Forecast.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.Forecast.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 optional metadata that you apply to a resource to help you -- categorize and organize them. Each tag consists of a key and an optional -- value, both of which you define. -- -- 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 keys as it is reserved for AWS use. You cannot -- edit or delete tag keys with this prefix. Values can have this -- prefix. If a tag value has @aws@ as its prefix but the key does not, -- then Forecast considers it to be a user tag and will count against -- the limit of 50 tags. Tags with only the key prefix of @aws@ do not -- count against your tags per resource limit. -- -- /See:/ 'newTag' smart constructor. data Tag = Tag' { -- | One part of a key-value pair that makes up a tag. A @key@ is a general -- label that acts like a category for more specific tag values. key :: Data.Sensitive Prelude.Text, -- | The optional part of a key-value pair that makes up a tag. A @value@ -- acts as a descriptor within a tag category (key). value :: Data.Sensitive Prelude.Text } deriving (Prelude.Eq, 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 makes 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 makes up a tag. A @value@ -- acts as a descriptor within a tag category (key). newTag :: -- | 'key' Prelude.Text -> -- | 'value' Prelude.Text -> Tag newTag pKey_ pValue_ = Tag' { key = Data._Sensitive Lens.# pKey_, value = Data._Sensitive Lens.# pValue_ } -- | One part of a key-value pair that makes 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.Text tag_key = Lens.lens (\Tag' {key} -> key) (\s@Tag' {} a -> s {key = a} :: Tag) Prelude.. Data._Sensitive -- | The optional part of a key-value pair that makes up a tag. A @value@ -- acts as a descriptor within a tag category (key). tag_value :: Lens.Lens' Tag Prelude.Text tag_value = Lens.lens (\Tag' {value} -> value) (\s@Tag' {} a -> s {value = a} :: Tag) Prelude.. Data._Sensitive 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 [ Prelude.Just ("Key" Data..= key), Prelude.Just ("Value" Data..= value) ] )