{-# 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.GeneralName where
import Amazonka.CertificateManagerPCA.Types.ASN1Subject
import Amazonka.CertificateManagerPCA.Types.EdiPartyName
import Amazonka.CertificateManagerPCA.Types.OtherName
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GeneralName = GeneralName'
{
GeneralName -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
GeneralName -> Maybe Text
uniformResourceIdentifier :: Prelude.Maybe Prelude.Text,
GeneralName -> Maybe Text
registeredId :: Prelude.Maybe Prelude.Text,
GeneralName -> Maybe EdiPartyName
ediPartyName :: Prelude.Maybe EdiPartyName,
GeneralName -> Maybe Text
rfc822Name :: Prelude.Maybe Prelude.Text,
GeneralName -> Maybe OtherName
otherName :: Prelude.Maybe OtherName,
GeneralName -> Maybe Text
dnsName :: Prelude.Maybe Prelude.Text,
GeneralName -> Maybe ASN1Subject
directoryName :: Prelude.Maybe ASN1Subject
}
deriving (GeneralName -> GeneralName -> Bool
(GeneralName -> GeneralName -> Bool)
-> (GeneralName -> GeneralName -> Bool) -> Eq GeneralName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeneralName -> GeneralName -> Bool
$c/= :: GeneralName -> GeneralName -> Bool
== :: GeneralName -> GeneralName -> Bool
$c== :: GeneralName -> GeneralName -> Bool
Prelude.Eq, ReadPrec [GeneralName]
ReadPrec GeneralName
Int -> ReadS GeneralName
ReadS [GeneralName]
(Int -> ReadS GeneralName)
-> ReadS [GeneralName]
-> ReadPrec GeneralName
-> ReadPrec [GeneralName]
-> Read GeneralName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeneralName]
$creadListPrec :: ReadPrec [GeneralName]
readPrec :: ReadPrec GeneralName
$creadPrec :: ReadPrec GeneralName
readList :: ReadS [GeneralName]
$creadList :: ReadS [GeneralName]
readsPrec :: Int -> ReadS GeneralName
$creadsPrec :: Int -> ReadS GeneralName
Prelude.Read, Int -> GeneralName -> ShowS
[GeneralName] -> ShowS
GeneralName -> String
(Int -> GeneralName -> ShowS)
-> (GeneralName -> String)
-> ([GeneralName] -> ShowS)
-> Show GeneralName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeneralName] -> ShowS
$cshowList :: [GeneralName] -> ShowS
show :: GeneralName -> String
$cshow :: GeneralName -> String
showsPrec :: Int -> GeneralName -> ShowS
$cshowsPrec :: Int -> GeneralName -> ShowS
Prelude.Show, (forall x. GeneralName -> Rep GeneralName x)
-> (forall x. Rep GeneralName x -> GeneralName)
-> Generic GeneralName
forall x. Rep GeneralName x -> GeneralName
forall x. GeneralName -> Rep GeneralName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeneralName x -> GeneralName
$cfrom :: forall x. GeneralName -> Rep GeneralName x
Prelude.Generic)
newGeneralName ::
GeneralName
newGeneralName :: GeneralName
newGeneralName =
GeneralName' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName
GeneralName'
{ $sel:ipAddress:GeneralName' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:uniformResourceIdentifier:GeneralName' :: Maybe Text
uniformResourceIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:registeredId:GeneralName' :: Maybe Text
registeredId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ediPartyName:GeneralName' :: Maybe EdiPartyName
ediPartyName = Maybe EdiPartyName
forall a. Maybe a
Prelude.Nothing,
$sel:rfc822Name:GeneralName' :: Maybe Text
rfc822Name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:otherName:GeneralName' :: Maybe OtherName
otherName = Maybe OtherName
forall a. Maybe a
Prelude.Nothing,
$sel:dnsName:GeneralName' :: Maybe Text
dnsName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:directoryName:GeneralName' :: Maybe ASN1Subject
directoryName = Maybe ASN1Subject
forall a. Maybe a
Prelude.Nothing
}
generalName_ipAddress :: Lens.Lens' GeneralName (Prelude.Maybe Prelude.Text)
generalName_ipAddress :: (Maybe Text -> f (Maybe Text)) -> GeneralName -> f GeneralName
generalName_ipAddress = (GeneralName -> Maybe Text)
-> (GeneralName -> Maybe Text -> GeneralName)
-> Lens GeneralName GeneralName (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:GeneralName' :: GeneralName -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: GeneralName
s@GeneralName' {} Maybe Text
a -> GeneralName
s {$sel:ipAddress:GeneralName' :: Maybe Text
ipAddress = Maybe Text
a} :: GeneralName)
generalName_uniformResourceIdentifier :: Lens.Lens' GeneralName (Prelude.Maybe Prelude.Text)
generalName_uniformResourceIdentifier :: (Maybe Text -> f (Maybe Text)) -> GeneralName -> f GeneralName
generalName_uniformResourceIdentifier = (GeneralName -> Maybe Text)
-> (GeneralName -> Maybe Text -> GeneralName)
-> Lens GeneralName GeneralName (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe Text
uniformResourceIdentifier :: Maybe Text
$sel:uniformResourceIdentifier:GeneralName' :: GeneralName -> Maybe Text
uniformResourceIdentifier} -> Maybe Text
uniformResourceIdentifier) (\s :: GeneralName
s@GeneralName' {} Maybe Text
a -> GeneralName
s {$sel:uniformResourceIdentifier:GeneralName' :: Maybe Text
uniformResourceIdentifier = Maybe Text
a} :: GeneralName)
generalName_registeredId :: Lens.Lens' GeneralName (Prelude.Maybe Prelude.Text)
generalName_registeredId :: (Maybe Text -> f (Maybe Text)) -> GeneralName -> f GeneralName
generalName_registeredId = (GeneralName -> Maybe Text)
-> (GeneralName -> Maybe Text -> GeneralName)
-> Lens GeneralName GeneralName (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe Text
registeredId :: Maybe Text
$sel:registeredId:GeneralName' :: GeneralName -> Maybe Text
registeredId} -> Maybe Text
registeredId) (\s :: GeneralName
s@GeneralName' {} Maybe Text
a -> GeneralName
s {$sel:registeredId:GeneralName' :: Maybe Text
registeredId = Maybe Text
a} :: GeneralName)
generalName_ediPartyName :: Lens.Lens' GeneralName (Prelude.Maybe EdiPartyName)
generalName_ediPartyName :: (Maybe EdiPartyName -> f (Maybe EdiPartyName))
-> GeneralName -> f GeneralName
generalName_ediPartyName = (GeneralName -> Maybe EdiPartyName)
-> (GeneralName -> Maybe EdiPartyName -> GeneralName)
-> Lens
GeneralName GeneralName (Maybe EdiPartyName) (Maybe EdiPartyName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe EdiPartyName
ediPartyName :: Maybe EdiPartyName
$sel:ediPartyName:GeneralName' :: GeneralName -> Maybe EdiPartyName
ediPartyName} -> Maybe EdiPartyName
ediPartyName) (\s :: GeneralName
s@GeneralName' {} Maybe EdiPartyName
a -> GeneralName
s {$sel:ediPartyName:GeneralName' :: Maybe EdiPartyName
ediPartyName = Maybe EdiPartyName
a} :: GeneralName)
generalName_rfc822Name :: Lens.Lens' GeneralName (Prelude.Maybe Prelude.Text)
generalName_rfc822Name :: (Maybe Text -> f (Maybe Text)) -> GeneralName -> f GeneralName
generalName_rfc822Name = (GeneralName -> Maybe Text)
-> (GeneralName -> Maybe Text -> GeneralName)
-> Lens GeneralName GeneralName (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe Text
rfc822Name :: Maybe Text
$sel:rfc822Name:GeneralName' :: GeneralName -> Maybe Text
rfc822Name} -> Maybe Text
rfc822Name) (\s :: GeneralName
s@GeneralName' {} Maybe Text
a -> GeneralName
s {$sel:rfc822Name:GeneralName' :: Maybe Text
rfc822Name = Maybe Text
a} :: GeneralName)
generalName_otherName :: Lens.Lens' GeneralName (Prelude.Maybe OtherName)
generalName_otherName :: (Maybe OtherName -> f (Maybe OtherName))
-> GeneralName -> f GeneralName
generalName_otherName = (GeneralName -> Maybe OtherName)
-> (GeneralName -> Maybe OtherName -> GeneralName)
-> Lens GeneralName GeneralName (Maybe OtherName) (Maybe OtherName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe OtherName
otherName :: Maybe OtherName
$sel:otherName:GeneralName' :: GeneralName -> Maybe OtherName
otherName} -> Maybe OtherName
otherName) (\s :: GeneralName
s@GeneralName' {} Maybe OtherName
a -> GeneralName
s {$sel:otherName:GeneralName' :: Maybe OtherName
otherName = Maybe OtherName
a} :: GeneralName)
generalName_dnsName :: Lens.Lens' GeneralName (Prelude.Maybe Prelude.Text)
generalName_dnsName :: (Maybe Text -> f (Maybe Text)) -> GeneralName -> f GeneralName
generalName_dnsName = (GeneralName -> Maybe Text)
-> (GeneralName -> Maybe Text -> GeneralName)
-> Lens GeneralName GeneralName (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe Text
dnsName :: Maybe Text
$sel:dnsName:GeneralName' :: GeneralName -> Maybe Text
dnsName} -> Maybe Text
dnsName) (\s :: GeneralName
s@GeneralName' {} Maybe Text
a -> GeneralName
s {$sel:dnsName:GeneralName' :: Maybe Text
dnsName = Maybe Text
a} :: GeneralName)
generalName_directoryName :: Lens.Lens' GeneralName (Prelude.Maybe ASN1Subject)
generalName_directoryName :: (Maybe ASN1Subject -> f (Maybe ASN1Subject))
-> GeneralName -> f GeneralName
generalName_directoryName = (GeneralName -> Maybe ASN1Subject)
-> (GeneralName -> Maybe ASN1Subject -> GeneralName)
-> Lens
GeneralName GeneralName (Maybe ASN1Subject) (Maybe ASN1Subject)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeneralName' {Maybe ASN1Subject
directoryName :: Maybe ASN1Subject
$sel:directoryName:GeneralName' :: GeneralName -> Maybe ASN1Subject
directoryName} -> Maybe ASN1Subject
directoryName) (\s :: GeneralName
s@GeneralName' {} Maybe ASN1Subject
a -> GeneralName
s {$sel:directoryName:GeneralName' :: Maybe ASN1Subject
directoryName = Maybe ASN1Subject
a} :: GeneralName)
instance Core.FromJSON GeneralName where
parseJSON :: Value -> Parser GeneralName
parseJSON =
String
-> (Object -> Parser GeneralName) -> Value -> Parser GeneralName
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GeneralName"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName
GeneralName'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
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
"IpAddress")
Parser
(Maybe Text
-> Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
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
"UniformResourceIdentifier")
Parser
(Maybe Text
-> Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
-> Parser (Maybe Text)
-> Parser
(Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
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
"RegisteredId")
Parser
(Maybe EdiPartyName
-> Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
-> Parser (Maybe EdiPartyName)
-> Parser
(Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EdiPartyName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EdiPartyName")
Parser
(Maybe Text
-> Maybe OtherName
-> Maybe Text
-> Maybe ASN1Subject
-> GeneralName)
-> Parser (Maybe Text)
-> Parser
(Maybe OtherName -> Maybe Text -> Maybe ASN1Subject -> GeneralName)
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
"Rfc822Name")
Parser
(Maybe OtherName -> Maybe Text -> Maybe ASN1Subject -> GeneralName)
-> Parser (Maybe OtherName)
-> Parser (Maybe Text -> Maybe ASN1Subject -> GeneralName)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OtherName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OtherName")
Parser (Maybe Text -> Maybe ASN1Subject -> GeneralName)
-> Parser (Maybe Text) -> Parser (Maybe ASN1Subject -> GeneralName)
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
"DnsName")
Parser (Maybe ASN1Subject -> GeneralName)
-> Parser (Maybe ASN1Subject) -> Parser GeneralName
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ASN1Subject)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DirectoryName")
)
instance Prelude.Hashable GeneralName
instance Prelude.NFData GeneralName
instance Core.ToJSON GeneralName where
toJSON :: GeneralName -> Value
toJSON GeneralName' {Maybe Text
Maybe ASN1Subject
Maybe EdiPartyName
Maybe OtherName
directoryName :: Maybe ASN1Subject
dnsName :: Maybe Text
otherName :: Maybe OtherName
rfc822Name :: Maybe Text
ediPartyName :: Maybe EdiPartyName
registeredId :: Maybe Text
uniformResourceIdentifier :: Maybe Text
ipAddress :: Maybe Text
$sel:directoryName:GeneralName' :: GeneralName -> Maybe ASN1Subject
$sel:dnsName:GeneralName' :: GeneralName -> Maybe Text
$sel:otherName:GeneralName' :: GeneralName -> Maybe OtherName
$sel:rfc822Name:GeneralName' :: GeneralName -> Maybe Text
$sel:ediPartyName:GeneralName' :: GeneralName -> Maybe EdiPartyName
$sel:registeredId:GeneralName' :: GeneralName -> Maybe Text
$sel:uniformResourceIdentifier:GeneralName' :: GeneralName -> Maybe Text
$sel:ipAddress:GeneralName' :: GeneralName -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IpAddress" 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
ipAddress,
(Text
"UniformResourceIdentifier" 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
uniformResourceIdentifier,
(Text
"RegisteredId" 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
registeredId,
(Text
"EdiPartyName" Text -> EdiPartyName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EdiPartyName -> Pair) -> Maybe EdiPartyName -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EdiPartyName
ediPartyName,
(Text
"Rfc822Name" 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
rfc822Name,
(Text
"OtherName" Text -> OtherName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OtherName -> Pair) -> Maybe OtherName -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OtherName
otherName,
(Text
"DnsName" 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
dnsName,
(Text
"DirectoryName" Text -> ASN1Subject -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ASN1Subject -> Pair) -> Maybe ASN1Subject -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ASN1Subject
directoryName
]
)