{-# 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.MediaConvert.Types.ResourceTags
-- 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.MediaConvert.Types.ResourceTags where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The Amazon Resource Name (ARN) and tags for an AWS Elemental
-- MediaConvert resource.
--
-- /See:/ 'newResourceTags' smart constructor.
data ResourceTags = ResourceTags'
  { -- | The Amazon Resource Name (ARN) of the resource.
    ResourceTags -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The tags for the resource.
    ResourceTags -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ResourceTags -> ResourceTags -> Bool
(ResourceTags -> ResourceTags -> Bool)
-> (ResourceTags -> ResourceTags -> Bool) -> Eq ResourceTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceTags -> ResourceTags -> Bool
$c/= :: ResourceTags -> ResourceTags -> Bool
== :: ResourceTags -> ResourceTags -> Bool
$c== :: ResourceTags -> ResourceTags -> Bool
Prelude.Eq, ReadPrec [ResourceTags]
ReadPrec ResourceTags
Int -> ReadS ResourceTags
ReadS [ResourceTags]
(Int -> ReadS ResourceTags)
-> ReadS [ResourceTags]
-> ReadPrec ResourceTags
-> ReadPrec [ResourceTags]
-> Read ResourceTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceTags]
$creadListPrec :: ReadPrec [ResourceTags]
readPrec :: ReadPrec ResourceTags
$creadPrec :: ReadPrec ResourceTags
readList :: ReadS [ResourceTags]
$creadList :: ReadS [ResourceTags]
readsPrec :: Int -> ReadS ResourceTags
$creadsPrec :: Int -> ReadS ResourceTags
Prelude.Read, Int -> ResourceTags -> ShowS
[ResourceTags] -> ShowS
ResourceTags -> String
(Int -> ResourceTags -> ShowS)
-> (ResourceTags -> String)
-> ([ResourceTags] -> ShowS)
-> Show ResourceTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceTags] -> ShowS
$cshowList :: [ResourceTags] -> ShowS
show :: ResourceTags -> String
$cshow :: ResourceTags -> String
showsPrec :: Int -> ResourceTags -> ShowS
$cshowsPrec :: Int -> ResourceTags -> ShowS
Prelude.Show, (forall x. ResourceTags -> Rep ResourceTags x)
-> (forall x. Rep ResourceTags x -> ResourceTags)
-> Generic ResourceTags
forall x. Rep ResourceTags x -> ResourceTags
forall x. ResourceTags -> Rep ResourceTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceTags x -> ResourceTags
$cfrom :: forall x. ResourceTags -> Rep ResourceTags x
Prelude.Generic)

-- |
-- Create a value of 'ResourceTags' 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:
--
-- 'arn', 'resourceTags_arn' - The Amazon Resource Name (ARN) of the resource.
--
-- 'tags', 'resourceTags_tags' - The tags for the resource.
newResourceTags ::
  ResourceTags
newResourceTags :: ResourceTags
newResourceTags =
  ResourceTags' :: Maybe Text -> Maybe (HashMap Text Text) -> ResourceTags
ResourceTags'
    { $sel:arn:ResourceTags' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ResourceTags' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the resource.
resourceTags_arn :: Lens.Lens' ResourceTags (Prelude.Maybe Prelude.Text)
resourceTags_arn :: (Maybe Text -> f (Maybe Text)) -> ResourceTags -> f ResourceTags
resourceTags_arn = (ResourceTags -> Maybe Text)
-> (ResourceTags -> Maybe Text -> ResourceTags)
-> Lens ResourceTags ResourceTags (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceTags' {Maybe Text
arn :: Maybe Text
$sel:arn:ResourceTags' :: ResourceTags -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResourceTags
s@ResourceTags' {} Maybe Text
a -> ResourceTags
s {$sel:arn:ResourceTags' :: Maybe Text
arn = Maybe Text
a} :: ResourceTags)

-- | The tags for the resource.
resourceTags_tags :: Lens.Lens' ResourceTags (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resourceTags_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ResourceTags -> f ResourceTags
resourceTags_tags = (ResourceTags -> Maybe (HashMap Text Text))
-> (ResourceTags -> Maybe (HashMap Text Text) -> ResourceTags)
-> Lens
     ResourceTags
     ResourceTags
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceTags' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ResourceTags' :: ResourceTags -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ResourceTags
s@ResourceTags' {} Maybe (HashMap Text Text)
a -> ResourceTags
s {$sel:tags:ResourceTags' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ResourceTags) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ResourceTags -> f ResourceTags)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ResourceTags
-> f ResourceTags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ResourceTags where
  parseJSON :: Value -> Parser ResourceTags
parseJSON =
    String
-> (Object -> Parser ResourceTags) -> Value -> Parser ResourceTags
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceTags"
      ( \Object
x ->
          Maybe Text -> Maybe (HashMap Text Text) -> ResourceTags
ResourceTags'
            (Maybe Text -> Maybe (HashMap Text Text) -> ResourceTags)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> ResourceTags)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
            Parser (Maybe (HashMap Text Text) -> ResourceTags)
-> Parser (Maybe (HashMap Text Text)) -> Parser ResourceTags
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ResourceTags

instance Prelude.NFData ResourceTags