{-# 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.IoT.Types.PolicyVersionIdentifier where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PolicyVersionIdentifier = PolicyVersionIdentifier'
{
PolicyVersionIdentifier -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
PolicyVersionIdentifier -> Maybe Text
policyVersionId :: Prelude.Maybe Prelude.Text
}
deriving (PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool
(PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool)
-> (PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool)
-> Eq PolicyVersionIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool
$c/= :: PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool
== :: PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool
$c== :: PolicyVersionIdentifier -> PolicyVersionIdentifier -> Bool
Prelude.Eq, ReadPrec [PolicyVersionIdentifier]
ReadPrec PolicyVersionIdentifier
Int -> ReadS PolicyVersionIdentifier
ReadS [PolicyVersionIdentifier]
(Int -> ReadS PolicyVersionIdentifier)
-> ReadS [PolicyVersionIdentifier]
-> ReadPrec PolicyVersionIdentifier
-> ReadPrec [PolicyVersionIdentifier]
-> Read PolicyVersionIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyVersionIdentifier]
$creadListPrec :: ReadPrec [PolicyVersionIdentifier]
readPrec :: ReadPrec PolicyVersionIdentifier
$creadPrec :: ReadPrec PolicyVersionIdentifier
readList :: ReadS [PolicyVersionIdentifier]
$creadList :: ReadS [PolicyVersionIdentifier]
readsPrec :: Int -> ReadS PolicyVersionIdentifier
$creadsPrec :: Int -> ReadS PolicyVersionIdentifier
Prelude.Read, Int -> PolicyVersionIdentifier -> ShowS
[PolicyVersionIdentifier] -> ShowS
PolicyVersionIdentifier -> String
(Int -> PolicyVersionIdentifier -> ShowS)
-> (PolicyVersionIdentifier -> String)
-> ([PolicyVersionIdentifier] -> ShowS)
-> Show PolicyVersionIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyVersionIdentifier] -> ShowS
$cshowList :: [PolicyVersionIdentifier] -> ShowS
show :: PolicyVersionIdentifier -> String
$cshow :: PolicyVersionIdentifier -> String
showsPrec :: Int -> PolicyVersionIdentifier -> ShowS
$cshowsPrec :: Int -> PolicyVersionIdentifier -> ShowS
Prelude.Show, (forall x.
PolicyVersionIdentifier -> Rep PolicyVersionIdentifier x)
-> (forall x.
Rep PolicyVersionIdentifier x -> PolicyVersionIdentifier)
-> Generic PolicyVersionIdentifier
forall x. Rep PolicyVersionIdentifier x -> PolicyVersionIdentifier
forall x. PolicyVersionIdentifier -> Rep PolicyVersionIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyVersionIdentifier x -> PolicyVersionIdentifier
$cfrom :: forall x. PolicyVersionIdentifier -> Rep PolicyVersionIdentifier x
Prelude.Generic)
newPolicyVersionIdentifier ::
PolicyVersionIdentifier
newPolicyVersionIdentifier :: PolicyVersionIdentifier
newPolicyVersionIdentifier =
PolicyVersionIdentifier' :: Maybe Text -> Maybe Text -> PolicyVersionIdentifier
PolicyVersionIdentifier'
{ $sel:policyName:PolicyVersionIdentifier' :: Maybe Text
policyName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policyVersionId:PolicyVersionIdentifier' :: Maybe Text
policyVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
policyVersionIdentifier_policyName :: Lens.Lens' PolicyVersionIdentifier (Prelude.Maybe Prelude.Text)
policyVersionIdentifier_policyName :: (Maybe Text -> f (Maybe Text))
-> PolicyVersionIdentifier -> f PolicyVersionIdentifier
policyVersionIdentifier_policyName = (PolicyVersionIdentifier -> Maybe Text)
-> (PolicyVersionIdentifier
-> Maybe Text -> PolicyVersionIdentifier)
-> Lens
PolicyVersionIdentifier
PolicyVersionIdentifier
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersionIdentifier' {Maybe Text
policyName :: Maybe Text
$sel:policyName:PolicyVersionIdentifier' :: PolicyVersionIdentifier -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: PolicyVersionIdentifier
s@PolicyVersionIdentifier' {} Maybe Text
a -> PolicyVersionIdentifier
s {$sel:policyName:PolicyVersionIdentifier' :: Maybe Text
policyName = Maybe Text
a} :: PolicyVersionIdentifier)
policyVersionIdentifier_policyVersionId :: Lens.Lens' PolicyVersionIdentifier (Prelude.Maybe Prelude.Text)
policyVersionIdentifier_policyVersionId :: (Maybe Text -> f (Maybe Text))
-> PolicyVersionIdentifier -> f PolicyVersionIdentifier
policyVersionIdentifier_policyVersionId = (PolicyVersionIdentifier -> Maybe Text)
-> (PolicyVersionIdentifier
-> Maybe Text -> PolicyVersionIdentifier)
-> Lens
PolicyVersionIdentifier
PolicyVersionIdentifier
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyVersionIdentifier' {Maybe Text
policyVersionId :: Maybe Text
$sel:policyVersionId:PolicyVersionIdentifier' :: PolicyVersionIdentifier -> Maybe Text
policyVersionId} -> Maybe Text
policyVersionId) (\s :: PolicyVersionIdentifier
s@PolicyVersionIdentifier' {} Maybe Text
a -> PolicyVersionIdentifier
s {$sel:policyVersionId:PolicyVersionIdentifier' :: Maybe Text
policyVersionId = Maybe Text
a} :: PolicyVersionIdentifier)
instance Core.FromJSON PolicyVersionIdentifier where
parseJSON :: Value -> Parser PolicyVersionIdentifier
parseJSON =
String
-> (Object -> Parser PolicyVersionIdentifier)
-> Value
-> Parser PolicyVersionIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PolicyVersionIdentifier"
( \Object
x ->
Maybe Text -> Maybe Text -> PolicyVersionIdentifier
PolicyVersionIdentifier'
(Maybe Text -> Maybe Text -> PolicyVersionIdentifier)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> PolicyVersionIdentifier)
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
"policyName")
Parser (Maybe Text -> PolicyVersionIdentifier)
-> Parser (Maybe Text) -> Parser PolicyVersionIdentifier
forall (f :: * -> *) a b. Applicative f => 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
"policyVersionId")
)
instance Prelude.Hashable PolicyVersionIdentifier
instance Prelude.NFData PolicyVersionIdentifier
instance Core.ToJSON PolicyVersionIdentifier where
toJSON :: PolicyVersionIdentifier -> Value
toJSON PolicyVersionIdentifier' {Maybe Text
policyVersionId :: Maybe Text
policyName :: Maybe Text
$sel:policyVersionId:PolicyVersionIdentifier' :: PolicyVersionIdentifier -> Maybe Text
$sel:policyName:PolicyVersionIdentifier' :: PolicyVersionIdentifier -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"policyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyName,
(Text
"policyVersionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyVersionId
]
)