{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data AccessDescription = AccessDescription'
{
AccessDescription -> AccessMethod
accessMethod :: AccessMethod,
AccessDescription -> GeneralName
accessLocation :: GeneralName
}
deriving (AccessDescription -> AccessDescription -> Bool
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]
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
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. 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'
{ $sel:accessMethod:AccessDescription' :: AccessMethod
accessMethod = AccessMethod
pAccessMethod_,
$sel:accessLocation:AccessDescription' :: GeneralName
accessLocation = GeneralName
pAccessLocation_
}
accessDescription_accessMethod :: Lens.Lens' AccessDescription AccessMethod
accessDescription_accessMethod :: Lens' AccessDescription AccessMethod
accessDescription_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 :: Lens' AccessDescription GeneralName
accessDescription_accessLocation = 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 Data.FromJSON AccessDescription where
parseJSON :: Value -> Parser AccessDescription
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AccessDescription"
( \Object
x ->
AccessMethod -> GeneralName -> AccessDescription
AccessDescription'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AccessMethod")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"AccessLocation")
)
instance Prelude.Hashable AccessDescription where
hashWithSalt :: Int -> AccessDescription -> Int
hashWithSalt Int
_salt AccessDescription' {AccessMethod
GeneralName
accessLocation :: GeneralName
accessMethod :: AccessMethod
$sel:accessLocation:AccessDescription' :: AccessDescription -> GeneralName
$sel:accessMethod:AccessDescription' :: AccessDescription -> AccessMethod
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AccessMethod
accessMethod
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GeneralName
accessLocation
instance Prelude.NFData AccessDescription where
rnf :: AccessDescription -> ()
rnf AccessDescription' {AccessMethod
GeneralName
accessLocation :: GeneralName
accessMethod :: AccessMethod
$sel:accessLocation:AccessDescription' :: AccessDescription -> GeneralName
$sel:accessMethod:AccessDescription' :: AccessDescription -> AccessMethod
..} =
forall a. NFData a => a -> ()
Prelude.rnf AccessMethod
accessMethod
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GeneralName
accessLocation
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"AccessMethod" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AccessMethod
accessMethod),
forall a. a -> Maybe a
Prelude.Just
(Key
"AccessLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GeneralName
accessLocation)
]
)