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