{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.ResourceTags 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 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
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]
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
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. 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'
    { $sel:arn:ResourceTags' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ResourceTags' :: Maybe (HashMap Text Text)
tags = 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 :: Lens' ResourceTags (Maybe Text)
resourceTags_arn = 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 :: Lens' ResourceTags (Maybe (HashMap Text Text))
resourceTags_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ResourceTags where
  hashWithSalt :: Int -> ResourceTags -> Int
hashWithSalt Int
_salt ResourceTags' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:tags:ResourceTags' :: ResourceTags -> Maybe (HashMap Text Text)
$sel:arn:ResourceTags' :: ResourceTags -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData ResourceTags where
  rnf :: ResourceTags -> ()
rnf ResourceTags' {Maybe Text
Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
arn :: Maybe Text
$sel:tags:ResourceTags' :: ResourceTags -> Maybe (HashMap Text Text)
$sel:arn:ResourceTags' :: ResourceTags -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags