{-# 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 #-}
module Amazonka.Panorama.Types.JobResourceTags where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.JobResourceType
import qualified Amazonka.Prelude as Prelude
data JobResourceTags = JobResourceTags'
{
JobResourceTags -> JobResourceType
resourceType :: JobResourceType,
JobResourceTags -> HashMap Text Text
tags :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (JobResourceTags -> JobResourceTags -> Bool
(JobResourceTags -> JobResourceTags -> Bool)
-> (JobResourceTags -> JobResourceTags -> Bool)
-> Eq JobResourceTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobResourceTags -> JobResourceTags -> Bool
$c/= :: JobResourceTags -> JobResourceTags -> Bool
== :: JobResourceTags -> JobResourceTags -> Bool
$c== :: JobResourceTags -> JobResourceTags -> Bool
Prelude.Eq, ReadPrec [JobResourceTags]
ReadPrec JobResourceTags
Int -> ReadS JobResourceTags
ReadS [JobResourceTags]
(Int -> ReadS JobResourceTags)
-> ReadS [JobResourceTags]
-> ReadPrec JobResourceTags
-> ReadPrec [JobResourceTags]
-> Read JobResourceTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobResourceTags]
$creadListPrec :: ReadPrec [JobResourceTags]
readPrec :: ReadPrec JobResourceTags
$creadPrec :: ReadPrec JobResourceTags
readList :: ReadS [JobResourceTags]
$creadList :: ReadS [JobResourceTags]
readsPrec :: Int -> ReadS JobResourceTags
$creadsPrec :: Int -> ReadS JobResourceTags
Prelude.Read, Int -> JobResourceTags -> ShowS
[JobResourceTags] -> ShowS
JobResourceTags -> String
(Int -> JobResourceTags -> ShowS)
-> (JobResourceTags -> String)
-> ([JobResourceTags] -> ShowS)
-> Show JobResourceTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobResourceTags] -> ShowS
$cshowList :: [JobResourceTags] -> ShowS
show :: JobResourceTags -> String
$cshow :: JobResourceTags -> String
showsPrec :: Int -> JobResourceTags -> ShowS
$cshowsPrec :: Int -> JobResourceTags -> ShowS
Prelude.Show, (forall x. JobResourceTags -> Rep JobResourceTags x)
-> (forall x. Rep JobResourceTags x -> JobResourceTags)
-> Generic JobResourceTags
forall x. Rep JobResourceTags x -> JobResourceTags
forall x. JobResourceTags -> Rep JobResourceTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobResourceTags x -> JobResourceTags
$cfrom :: forall x. JobResourceTags -> Rep JobResourceTags x
Prelude.Generic)
newJobResourceTags ::
JobResourceType ->
JobResourceTags
newJobResourceTags :: JobResourceType -> JobResourceTags
newJobResourceTags JobResourceType
pResourceType_ =
JobResourceTags' :: JobResourceType -> HashMap Text Text -> JobResourceTags
JobResourceTags'
{ $sel:resourceType:JobResourceTags' :: JobResourceType
resourceType = JobResourceType
pResourceType_,
$sel:tags:JobResourceTags' :: HashMap Text Text
tags = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
jobResourceTags_resourceType :: Lens.Lens' JobResourceTags JobResourceType
jobResourceTags_resourceType :: (JobResourceType -> f JobResourceType)
-> JobResourceTags -> f JobResourceTags
jobResourceTags_resourceType = (JobResourceTags -> JobResourceType)
-> (JobResourceTags -> JobResourceType -> JobResourceTags)
-> Lens
JobResourceTags JobResourceTags JobResourceType JobResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobResourceTags' {JobResourceType
resourceType :: JobResourceType
$sel:resourceType:JobResourceTags' :: JobResourceTags -> JobResourceType
resourceType} -> JobResourceType
resourceType) (\s :: JobResourceTags
s@JobResourceTags' {} JobResourceType
a -> JobResourceTags
s {$sel:resourceType:JobResourceTags' :: JobResourceType
resourceType = JobResourceType
a} :: JobResourceTags)
jobResourceTags_tags :: Lens.Lens' JobResourceTags (Prelude.HashMap Prelude.Text Prelude.Text)
jobResourceTags_tags :: (HashMap Text Text -> f (HashMap Text Text))
-> JobResourceTags -> f JobResourceTags
jobResourceTags_tags = (JobResourceTags -> HashMap Text Text)
-> (JobResourceTags -> HashMap Text Text -> JobResourceTags)
-> Lens
JobResourceTags
JobResourceTags
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobResourceTags' {HashMap Text Text
tags :: HashMap Text Text
$sel:tags:JobResourceTags' :: JobResourceTags -> HashMap Text Text
tags} -> HashMap Text Text
tags) (\s :: JobResourceTags
s@JobResourceTags' {} HashMap Text Text
a -> JobResourceTags
s {$sel:tags:JobResourceTags' :: HashMap Text Text
tags = HashMap Text Text
a} :: JobResourceTags) ((HashMap Text Text -> f (HashMap Text Text))
-> JobResourceTags -> f JobResourceTags)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> JobResourceTags
-> f JobResourceTags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON JobResourceTags where
parseJSON :: Value -> Parser JobResourceTags
parseJSON =
String
-> (Object -> Parser JobResourceTags)
-> Value
-> Parser JobResourceTags
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"JobResourceTags"
( \Object
x ->
JobResourceType -> HashMap Text Text -> JobResourceTags
JobResourceTags'
(JobResourceType -> HashMap Text Text -> JobResourceTags)
-> Parser JobResourceType
-> Parser (HashMap Text Text -> JobResourceTags)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser JobResourceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceType")
Parser (HashMap Text Text -> JobResourceTags)
-> Parser (HashMap Text Text) -> Parser JobResourceTags
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable JobResourceTags
instance Prelude.NFData JobResourceTags
instance Core.ToJSON JobResourceTags where
toJSON :: JobResourceTags -> Value
toJSON JobResourceTags' {HashMap Text Text
JobResourceType
tags :: HashMap Text Text
resourceType :: JobResourceType
$sel:tags:JobResourceTags' :: JobResourceTags -> HashMap Text Text
$sel:resourceType:JobResourceTags' :: JobResourceTags -> JobResourceType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> JobResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= JobResourceType
resourceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
tags)
]
)