{-# 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.EC2.Types.S3ObjectTag
-- 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.EC2.Types.S3ObjectTag where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | The tags to apply to the AMI object that will be stored in the Amazon S3
-- bucket. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html Categorizing your storage using tags>
-- in the /Amazon Simple Storage Service User Guide/.
--
-- /See:/ 'newS3ObjectTag' smart constructor.
data S3ObjectTag = S3ObjectTag'
  { -- | The key of the tag.
    --
    -- Constraints: Tag keys are case-sensitive and can be up to 128 Unicode
    -- characters in length. May not begin with @aws@:.
    S3ObjectTag -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The value of the tag.
    --
    -- Constraints: Tag values are case-sensitive and can be up to 256 Unicode
    -- characters in length.
    S3ObjectTag -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (S3ObjectTag -> S3ObjectTag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ObjectTag -> S3ObjectTag -> Bool
$c/= :: S3ObjectTag -> S3ObjectTag -> Bool
== :: S3ObjectTag -> S3ObjectTag -> Bool
$c== :: S3ObjectTag -> S3ObjectTag -> Bool
Prelude.Eq, ReadPrec [S3ObjectTag]
ReadPrec S3ObjectTag
Int -> ReadS S3ObjectTag
ReadS [S3ObjectTag]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ObjectTag]
$creadListPrec :: ReadPrec [S3ObjectTag]
readPrec :: ReadPrec S3ObjectTag
$creadPrec :: ReadPrec S3ObjectTag
readList :: ReadS [S3ObjectTag]
$creadList :: ReadS [S3ObjectTag]
readsPrec :: Int -> ReadS S3ObjectTag
$creadsPrec :: Int -> ReadS S3ObjectTag
Prelude.Read, Int -> S3ObjectTag -> ShowS
[S3ObjectTag] -> ShowS
S3ObjectTag -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ObjectTag] -> ShowS
$cshowList :: [S3ObjectTag] -> ShowS
show :: S3ObjectTag -> String
$cshow :: S3ObjectTag -> String
showsPrec :: Int -> S3ObjectTag -> ShowS
$cshowsPrec :: Int -> S3ObjectTag -> ShowS
Prelude.Show, forall x. Rep S3ObjectTag x -> S3ObjectTag
forall x. S3ObjectTag -> Rep S3ObjectTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ObjectTag x -> S3ObjectTag
$cfrom :: forall x. S3ObjectTag -> Rep S3ObjectTag x
Prelude.Generic)

-- |
-- Create a value of 'S3ObjectTag' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'key', 's3ObjectTag_key' - The key of the tag.
--
-- Constraints: Tag keys are case-sensitive and can be up to 128 Unicode
-- characters in length. May not begin with @aws@:.
--
-- 'value', 's3ObjectTag_value' - The value of the tag.
--
-- Constraints: Tag values are case-sensitive and can be up to 256 Unicode
-- characters in length.
newS3ObjectTag ::
  S3ObjectTag
newS3ObjectTag :: S3ObjectTag
newS3ObjectTag =
  S3ObjectTag'
    { $sel:key:S3ObjectTag' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:value:S3ObjectTag' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The key of the tag.
--
-- Constraints: Tag keys are case-sensitive and can be up to 128 Unicode
-- characters in length. May not begin with @aws@:.
s3ObjectTag_key :: Lens.Lens' S3ObjectTag (Prelude.Maybe Prelude.Text)
s3ObjectTag_key :: Lens' S3ObjectTag (Maybe Text)
s3ObjectTag_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ObjectTag' {Maybe Text
key :: Maybe Text
$sel:key:S3ObjectTag' :: S3ObjectTag -> Maybe Text
key} -> Maybe Text
key) (\s :: S3ObjectTag
s@S3ObjectTag' {} Maybe Text
a -> S3ObjectTag
s {$sel:key:S3ObjectTag' :: Maybe Text
key = Maybe Text
a} :: S3ObjectTag)

-- | The value of the tag.
--
-- Constraints: Tag values are case-sensitive and can be up to 256 Unicode
-- characters in length.
s3ObjectTag_value :: Lens.Lens' S3ObjectTag (Prelude.Maybe Prelude.Text)
s3ObjectTag_value :: Lens' S3ObjectTag (Maybe Text)
s3ObjectTag_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ObjectTag' {Maybe Text
value :: Maybe Text
$sel:value:S3ObjectTag' :: S3ObjectTag -> Maybe Text
value} -> Maybe Text
value) (\s :: S3ObjectTag
s@S3ObjectTag' {} Maybe Text
a -> S3ObjectTag
s {$sel:value:S3ObjectTag' :: Maybe Text
value = Maybe Text
a} :: S3ObjectTag)

instance Prelude.Hashable S3ObjectTag where
  hashWithSalt :: Int -> S3ObjectTag -> Int
hashWithSalt Int
_salt S3ObjectTag' {Maybe Text
value :: Maybe Text
key :: Maybe Text
$sel:value:S3ObjectTag' :: S3ObjectTag -> Maybe Text
$sel:key:S3ObjectTag' :: S3ObjectTag -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData S3ObjectTag where
  rnf :: S3ObjectTag -> ()
rnf S3ObjectTag' {Maybe Text
value :: Maybe Text
key :: Maybe Text
$sel:value:S3ObjectTag' :: S3ObjectTag -> Maybe Text
$sel:key:S3ObjectTag' :: S3ObjectTag -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToQuery S3ObjectTag where
  toQuery :: S3ObjectTag -> QueryString
toQuery S3ObjectTag' {Maybe Text
value :: Maybe Text
key :: Maybe Text
$sel:value:S3ObjectTag' :: S3ObjectTag -> Maybe Text
$sel:key:S3ObjectTag' :: S3ObjectTag -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Key" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
key, ByteString
"Value" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
value]