{-# 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.S3.Types.Tagging
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.S3.Types.Tagging where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.Tag

-- | Container for @TagSet@ elements.
--
-- /See:/ 'newTagging' smart constructor.
data Tagging = Tagging'
  { -- | A collection for a set of tags
    Tagging -> [Tag]
tagSet :: [Tag]
  }
  deriving (Tagging -> Tagging -> Bool
(Tagging -> Tagging -> Bool)
-> (Tagging -> Tagging -> Bool) -> Eq Tagging
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tagging -> Tagging -> Bool
$c/= :: Tagging -> Tagging -> Bool
== :: Tagging -> Tagging -> Bool
$c== :: Tagging -> Tagging -> Bool
Prelude.Eq, ReadPrec [Tagging]
ReadPrec Tagging
Int -> ReadS Tagging
ReadS [Tagging]
(Int -> ReadS Tagging)
-> ReadS [Tagging]
-> ReadPrec Tagging
-> ReadPrec [Tagging]
-> Read Tagging
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Tagging]
$creadListPrec :: ReadPrec [Tagging]
readPrec :: ReadPrec Tagging
$creadPrec :: ReadPrec Tagging
readList :: ReadS [Tagging]
$creadList :: ReadS [Tagging]
readsPrec :: Int -> ReadS Tagging
$creadsPrec :: Int -> ReadS Tagging
Prelude.Read, Int -> Tagging -> ShowS
[Tagging] -> ShowS
Tagging -> String
(Int -> Tagging -> ShowS)
-> (Tagging -> String) -> ([Tagging] -> ShowS) -> Show Tagging
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Tagging] -> ShowS
$cshowList :: [Tagging] -> ShowS
show :: Tagging -> String
$cshow :: Tagging -> String
showsPrec :: Int -> Tagging -> ShowS
$cshowsPrec :: Int -> Tagging -> ShowS
Prelude.Show, (forall x. Tagging -> Rep Tagging x)
-> (forall x. Rep Tagging x -> Tagging) -> Generic Tagging
forall x. Rep Tagging x -> Tagging
forall x. Tagging -> Rep Tagging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Tagging x -> Tagging
$cfrom :: forall x. Tagging -> Rep Tagging x
Prelude.Generic)

-- |
-- Create a value of 'Tagging' 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:
--
-- 'tagSet', 'tagging_tagSet' - A collection for a set of tags
newTagging ::
  Tagging
newTagging :: Tagging
newTagging = Tagging' :: [Tag] -> Tagging
Tagging' {$sel:tagSet:Tagging' :: [Tag]
tagSet = [Tag]
forall a. Monoid a => a
Prelude.mempty}

-- | A collection for a set of tags
tagging_tagSet :: Lens.Lens' Tagging [Tag]
tagging_tagSet :: ([Tag] -> f [Tag]) -> Tagging -> f Tagging
tagging_tagSet = (Tagging -> [Tag])
-> (Tagging -> [Tag] -> Tagging)
-> Lens Tagging Tagging [Tag] [Tag]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Tagging' {[Tag]
tagSet :: [Tag]
$sel:tagSet:Tagging' :: Tagging -> [Tag]
tagSet} -> [Tag]
tagSet) (\s :: Tagging
s@Tagging' {} [Tag]
a -> Tagging
s {$sel:tagSet:Tagging' :: [Tag]
tagSet = [Tag]
a} :: Tagging) (([Tag] -> f [Tag]) -> Tagging -> f Tagging)
-> (([Tag] -> f [Tag]) -> [Tag] -> f [Tag])
-> ([Tag] -> f [Tag])
-> Tagging
-> f Tagging
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Tag] -> f [Tag]) -> [Tag] -> f [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Tagging

instance Prelude.NFData Tagging

instance Core.ToXML Tagging where
  toXML :: Tagging -> XML
toXML Tagging' {[Tag]
tagSet :: [Tag]
$sel:tagSet:Tagging' :: Tagging -> [Tag]
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"TagSet" Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Name -> [Tag] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"Tag" [Tag]
tagSet]