{-# 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.IAM.Types.ServerCertificate where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.ServerCertificateMetadata
import Amazonka.IAM.Types.Tag
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ServerCertificate = ServerCertificate'
{
ServerCertificate -> Maybe Text
certificateChain :: Prelude.Maybe Prelude.Text,
ServerCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
ServerCertificate -> ServerCertificateMetadata
serverCertificateMetadata :: ServerCertificateMetadata,
ServerCertificate -> Text
certificateBody :: Prelude.Text
}
deriving (ServerCertificate -> ServerCertificate -> Bool
(ServerCertificate -> ServerCertificate -> Bool)
-> (ServerCertificate -> ServerCertificate -> Bool)
-> Eq ServerCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerCertificate -> ServerCertificate -> Bool
$c/= :: ServerCertificate -> ServerCertificate -> Bool
== :: ServerCertificate -> ServerCertificate -> Bool
$c== :: ServerCertificate -> ServerCertificate -> Bool
Prelude.Eq, ReadPrec [ServerCertificate]
ReadPrec ServerCertificate
Int -> ReadS ServerCertificate
ReadS [ServerCertificate]
(Int -> ReadS ServerCertificate)
-> ReadS [ServerCertificate]
-> ReadPrec ServerCertificate
-> ReadPrec [ServerCertificate]
-> Read ServerCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerCertificate]
$creadListPrec :: ReadPrec [ServerCertificate]
readPrec :: ReadPrec ServerCertificate
$creadPrec :: ReadPrec ServerCertificate
readList :: ReadS [ServerCertificate]
$creadList :: ReadS [ServerCertificate]
readsPrec :: Int -> ReadS ServerCertificate
$creadsPrec :: Int -> ReadS ServerCertificate
Prelude.Read, Int -> ServerCertificate -> ShowS
[ServerCertificate] -> ShowS
ServerCertificate -> String
(Int -> ServerCertificate -> ShowS)
-> (ServerCertificate -> String)
-> ([ServerCertificate] -> ShowS)
-> Show ServerCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerCertificate] -> ShowS
$cshowList :: [ServerCertificate] -> ShowS
show :: ServerCertificate -> String
$cshow :: ServerCertificate -> String
showsPrec :: Int -> ServerCertificate -> ShowS
$cshowsPrec :: Int -> ServerCertificate -> ShowS
Prelude.Show, (forall x. ServerCertificate -> Rep ServerCertificate x)
-> (forall x. Rep ServerCertificate x -> ServerCertificate)
-> Generic ServerCertificate
forall x. Rep ServerCertificate x -> ServerCertificate
forall x. ServerCertificate -> Rep ServerCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServerCertificate x -> ServerCertificate
$cfrom :: forall x. ServerCertificate -> Rep ServerCertificate x
Prelude.Generic)
newServerCertificate ::
ServerCertificateMetadata ->
Prelude.Text ->
ServerCertificate
newServerCertificate :: ServerCertificateMetadata -> Text -> ServerCertificate
newServerCertificate
ServerCertificateMetadata
pServerCertificateMetadata_
Text
pCertificateBody_ =
ServerCertificate' :: Maybe Text
-> Maybe [Tag]
-> ServerCertificateMetadata
-> Text
-> ServerCertificate
ServerCertificate'
{ $sel:certificateChain:ServerCertificate' :: Maybe Text
certificateChain =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:ServerCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:serverCertificateMetadata:ServerCertificate' :: ServerCertificateMetadata
serverCertificateMetadata =
ServerCertificateMetadata
pServerCertificateMetadata_,
$sel:certificateBody:ServerCertificate' :: Text
certificateBody = Text
pCertificateBody_
}
serverCertificate_certificateChain :: Lens.Lens' ServerCertificate (Prelude.Maybe Prelude.Text)
serverCertificate_certificateChain :: (Maybe Text -> f (Maybe Text))
-> ServerCertificate -> f ServerCertificate
serverCertificate_certificateChain = (ServerCertificate -> Maybe Text)
-> (ServerCertificate -> Maybe Text -> ServerCertificate)
-> Lens
ServerCertificate ServerCertificate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificate' {Maybe Text
certificateChain :: Maybe Text
$sel:certificateChain:ServerCertificate' :: ServerCertificate -> Maybe Text
certificateChain} -> Maybe Text
certificateChain) (\s :: ServerCertificate
s@ServerCertificate' {} Maybe Text
a -> ServerCertificate
s {$sel:certificateChain:ServerCertificate' :: Maybe Text
certificateChain = Maybe Text
a} :: ServerCertificate)
serverCertificate_tags :: Lens.Lens' ServerCertificate (Prelude.Maybe [Tag])
serverCertificate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> ServerCertificate -> f ServerCertificate
serverCertificate_tags = (ServerCertificate -> Maybe [Tag])
-> (ServerCertificate -> Maybe [Tag] -> ServerCertificate)
-> Lens
ServerCertificate ServerCertificate (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:ServerCertificate' :: ServerCertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: ServerCertificate
s@ServerCertificate' {} Maybe [Tag]
a -> ServerCertificate
s {$sel:tags:ServerCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: ServerCertificate) ((Maybe [Tag] -> f (Maybe [Tag]))
-> ServerCertificate -> f ServerCertificate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> ServerCertificate
-> f ServerCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
serverCertificate_serverCertificateMetadata :: Lens.Lens' ServerCertificate ServerCertificateMetadata
serverCertificate_serverCertificateMetadata :: (ServerCertificateMetadata -> f ServerCertificateMetadata)
-> ServerCertificate -> f ServerCertificate
serverCertificate_serverCertificateMetadata = (ServerCertificate -> ServerCertificateMetadata)
-> (ServerCertificate
-> ServerCertificateMetadata -> ServerCertificate)
-> Lens
ServerCertificate
ServerCertificate
ServerCertificateMetadata
ServerCertificateMetadata
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificate' {ServerCertificateMetadata
serverCertificateMetadata :: ServerCertificateMetadata
$sel:serverCertificateMetadata:ServerCertificate' :: ServerCertificate -> ServerCertificateMetadata
serverCertificateMetadata} -> ServerCertificateMetadata
serverCertificateMetadata) (\s :: ServerCertificate
s@ServerCertificate' {} ServerCertificateMetadata
a -> ServerCertificate
s {$sel:serverCertificateMetadata:ServerCertificate' :: ServerCertificateMetadata
serverCertificateMetadata = ServerCertificateMetadata
a} :: ServerCertificate)
serverCertificate_certificateBody :: Lens.Lens' ServerCertificate Prelude.Text
serverCertificate_certificateBody :: (Text -> f Text) -> ServerCertificate -> f ServerCertificate
serverCertificate_certificateBody = (ServerCertificate -> Text)
-> (ServerCertificate -> Text -> ServerCertificate)
-> Lens ServerCertificate ServerCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificate' {Text
certificateBody :: Text
$sel:certificateBody:ServerCertificate' :: ServerCertificate -> Text
certificateBody} -> Text
certificateBody) (\s :: ServerCertificate
s@ServerCertificate' {} Text
a -> ServerCertificate
s {$sel:certificateBody:ServerCertificate' :: Text
certificateBody = Text
a} :: ServerCertificate)
instance Core.FromXML ServerCertificate where
parseXML :: [Node] -> Either String ServerCertificate
parseXML [Node]
x =
Maybe Text
-> Maybe [Tag]
-> ServerCertificateMetadata
-> Text
-> ServerCertificate
ServerCertificate'
(Maybe Text
-> Maybe [Tag]
-> ServerCertificateMetadata
-> Text
-> ServerCertificate)
-> Either String (Maybe Text)
-> Either
String
(Maybe [Tag]
-> ServerCertificateMetadata -> Text -> ServerCertificate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CertificateChain")
Either
String
(Maybe [Tag]
-> ServerCertificateMetadata -> Text -> ServerCertificate)
-> Either String (Maybe [Tag])
-> Either
String (ServerCertificateMetadata -> Text -> ServerCertificate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Tags" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either
String (ServerCertificateMetadata -> Text -> ServerCertificate)
-> Either String ServerCertificateMetadata
-> Either String (Text -> ServerCertificate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ServerCertificateMetadata
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ServerCertificateMetadata")
Either String (Text -> ServerCertificate)
-> Either String Text -> Either String ServerCertificate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CertificateBody")
instance Prelude.Hashable ServerCertificate
instance Prelude.NFData ServerCertificate