{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CertificateManagerPCA.Types.ASN1Subject
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CertificateManagerPCA.Types.ASN1Subject where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the certificate subject. The @Subject@ field
-- in the certificate identifies the entity that owns or controls the
-- public key in the certificate. The entity can be a user, computer,
-- device, or service. The @Subject @must contain an X.500 distinguished
-- name (DN). A DN is a sequence of relative distinguished names (RDNs).
-- The RDNs are separated by commas in the certificate.
--
-- /See:/ 'newASN1Subject' smart constructor.
data ASN1Subject = ASN1Subject'
  { -- | First name.
    ASN1Subject -> Maybe Text
givenName :: Prelude.Maybe Prelude.Text,
    -- | State in which the subject of the certificate is located.
    ASN1Subject -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | For CA and end-entity certificates in a private PKI, the common name
    -- (CN) can be any string within the length limit.
    --
    -- Note: In publicly trusted certificates, the common name must be a fully
    -- qualified domain name (FQDN) associated with the certificate subject.
    ASN1Subject -> Maybe Text
commonName :: Prelude.Maybe Prelude.Text,
    -- | A subdivision or unit of the organization (such as sales or finance)
    -- with which the certificate subject is affiliated.
    ASN1Subject -> Maybe Text
organizationalUnit :: Prelude.Maybe Prelude.Text,
    -- | Two-digit code that specifies the country in which the certificate
    -- subject located.
    ASN1Subject -> Maybe Text
country :: Prelude.Maybe Prelude.Text,
    -- | Typically a qualifier appended to the name of an individual. Examples
    -- include Jr. for junior, Sr. for senior, and III for third.
    ASN1Subject -> Maybe Text
generationQualifier :: Prelude.Maybe Prelude.Text,
    -- | The locality (such as a city or town) in which the certificate subject
    -- is located.
    ASN1Subject -> Maybe Text
locality :: Prelude.Maybe Prelude.Text,
    -- | Typically a shortened version of a longer __GivenName__. For example,
    -- Jonathan is often shortened to John. Elizabeth is often shortened to
    -- Beth, Liz, or Eliza.
    ASN1Subject -> Maybe Text
pseudonym :: Prelude.Maybe Prelude.Text,
    -- | Concatenation that typically contains the first letter of the
    -- __GivenName__, the first letter of the middle name if one exists, and
    -- the first letter of the __Surname__.
    ASN1Subject -> Maybe Text
initials :: Prelude.Maybe Prelude.Text,
    -- | A title such as Mr. or Ms., which is pre-pended to the name to refer
    -- formally to the certificate subject.
    ASN1Subject -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | Legal name of the organization with which the certificate subject is
    -- affiliated.
    ASN1Subject -> Maybe Text
organization :: Prelude.Maybe Prelude.Text,
    -- | The certificate serial number.
    ASN1Subject -> Maybe Text
serialNumber :: Prelude.Maybe Prelude.Text,
    -- | Family name. In the US and the UK, for example, the surname of an
    -- individual is ordered last. In Asian cultures the surname is typically
    -- ordered first.
    ASN1Subject -> Maybe Text
surname :: Prelude.Maybe Prelude.Text,
    -- | Disambiguating information for the certificate subject.
    ASN1Subject -> Maybe Text
distinguishedNameQualifier :: Prelude.Maybe Prelude.Text
  }
  deriving (ASN1Subject -> ASN1Subject -> Bool
(ASN1Subject -> ASN1Subject -> Bool)
-> (ASN1Subject -> ASN1Subject -> Bool) -> Eq ASN1Subject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ASN1Subject -> ASN1Subject -> Bool
$c/= :: ASN1Subject -> ASN1Subject -> Bool
== :: ASN1Subject -> ASN1Subject -> Bool
$c== :: ASN1Subject -> ASN1Subject -> Bool
Prelude.Eq, ReadPrec [ASN1Subject]
ReadPrec ASN1Subject
Int -> ReadS ASN1Subject
ReadS [ASN1Subject]
(Int -> ReadS ASN1Subject)
-> ReadS [ASN1Subject]
-> ReadPrec ASN1Subject
-> ReadPrec [ASN1Subject]
-> Read ASN1Subject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ASN1Subject]
$creadListPrec :: ReadPrec [ASN1Subject]
readPrec :: ReadPrec ASN1Subject
$creadPrec :: ReadPrec ASN1Subject
readList :: ReadS [ASN1Subject]
$creadList :: ReadS [ASN1Subject]
readsPrec :: Int -> ReadS ASN1Subject
$creadsPrec :: Int -> ReadS ASN1Subject
Prelude.Read, Int -> ASN1Subject -> ShowS
[ASN1Subject] -> ShowS
ASN1Subject -> String
(Int -> ASN1Subject -> ShowS)
-> (ASN1Subject -> String)
-> ([ASN1Subject] -> ShowS)
-> Show ASN1Subject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ASN1Subject] -> ShowS
$cshowList :: [ASN1Subject] -> ShowS
show :: ASN1Subject -> String
$cshow :: ASN1Subject -> String
showsPrec :: Int -> ASN1Subject -> ShowS
$cshowsPrec :: Int -> ASN1Subject -> ShowS
Prelude.Show, (forall x. ASN1Subject -> Rep ASN1Subject x)
-> (forall x. Rep ASN1Subject x -> ASN1Subject)
-> Generic ASN1Subject
forall x. Rep ASN1Subject x -> ASN1Subject
forall x. ASN1Subject -> Rep ASN1Subject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ASN1Subject x -> ASN1Subject
$cfrom :: forall x. ASN1Subject -> Rep ASN1Subject x
Prelude.Generic)

-- |
-- Create a value of 'ASN1Subject' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'givenName', 'aSN1Subject_givenName' - First name.
--
-- 'state', 'aSN1Subject_state' - State in which the subject of the certificate is located.
--
-- 'commonName', 'aSN1Subject_commonName' - For CA and end-entity certificates in a private PKI, the common name
-- (CN) can be any string within the length limit.
--
-- Note: In publicly trusted certificates, the common name must be a fully
-- qualified domain name (FQDN) associated with the certificate subject.
--
-- 'organizationalUnit', 'aSN1Subject_organizationalUnit' - A subdivision or unit of the organization (such as sales or finance)
-- with which the certificate subject is affiliated.
--
-- 'country', 'aSN1Subject_country' - Two-digit code that specifies the country in which the certificate
-- subject located.
--
-- 'generationQualifier', 'aSN1Subject_generationQualifier' - Typically a qualifier appended to the name of an individual. Examples
-- include Jr. for junior, Sr. for senior, and III for third.
--
-- 'locality', 'aSN1Subject_locality' - The locality (such as a city or town) in which the certificate subject
-- is located.
--
-- 'pseudonym', 'aSN1Subject_pseudonym' - Typically a shortened version of a longer __GivenName__. For example,
-- Jonathan is often shortened to John. Elizabeth is often shortened to
-- Beth, Liz, or Eliza.
--
-- 'initials', 'aSN1Subject_initials' - Concatenation that typically contains the first letter of the
-- __GivenName__, the first letter of the middle name if one exists, and
-- the first letter of the __Surname__.
--
-- 'title', 'aSN1Subject_title' - A title such as Mr. or Ms., which is pre-pended to the name to refer
-- formally to the certificate subject.
--
-- 'organization', 'aSN1Subject_organization' - Legal name of the organization with which the certificate subject is
-- affiliated.
--
-- 'serialNumber', 'aSN1Subject_serialNumber' - The certificate serial number.
--
-- 'surname', 'aSN1Subject_surname' - Family name. In the US and the UK, for example, the surname of an
-- individual is ordered last. In Asian cultures the surname is typically
-- ordered first.
--
-- 'distinguishedNameQualifier', 'aSN1Subject_distinguishedNameQualifier' - Disambiguating information for the certificate subject.
newASN1Subject ::
  ASN1Subject
newASN1Subject :: ASN1Subject
newASN1Subject =
  ASN1Subject' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ASN1Subject
ASN1Subject'
    { $sel:givenName:ASN1Subject' :: Maybe Text
givenName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:ASN1Subject' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:commonName:ASN1Subject' :: Maybe Text
commonName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationalUnit:ASN1Subject' :: Maybe Text
organizationalUnit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:country:ASN1Subject' :: Maybe Text
country = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:generationQualifier:ASN1Subject' :: Maybe Text
generationQualifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:locality:ASN1Subject' :: Maybe Text
locality = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pseudonym:ASN1Subject' :: Maybe Text
pseudonym = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initials:ASN1Subject' :: Maybe Text
initials = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:title:ASN1Subject' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organization:ASN1Subject' :: Maybe Text
organization = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serialNumber:ASN1Subject' :: Maybe Text
serialNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:surname:ASN1Subject' :: Maybe Text
surname = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:distinguishedNameQualifier:ASN1Subject' :: Maybe Text
distinguishedNameQualifier = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | First name.
aSN1Subject_givenName :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_givenName :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_givenName = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
givenName :: Maybe Text
$sel:givenName:ASN1Subject' :: ASN1Subject -> Maybe Text
givenName} -> Maybe Text
givenName) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:givenName:ASN1Subject' :: Maybe Text
givenName = Maybe Text
a} :: ASN1Subject)

-- | State in which the subject of the certificate is located.
aSN1Subject_state :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_state :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_state = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
state :: Maybe Text
$sel:state:ASN1Subject' :: ASN1Subject -> Maybe Text
state} -> Maybe Text
state) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:state:ASN1Subject' :: Maybe Text
state = Maybe Text
a} :: ASN1Subject)

-- | For CA and end-entity certificates in a private PKI, the common name
-- (CN) can be any string within the length limit.
--
-- Note: In publicly trusted certificates, the common name must be a fully
-- qualified domain name (FQDN) associated with the certificate subject.
aSN1Subject_commonName :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_commonName :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_commonName = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
commonName :: Maybe Text
$sel:commonName:ASN1Subject' :: ASN1Subject -> Maybe Text
commonName} -> Maybe Text
commonName) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:commonName:ASN1Subject' :: Maybe Text
commonName = Maybe Text
a} :: ASN1Subject)

-- | A subdivision or unit of the organization (such as sales or finance)
-- with which the certificate subject is affiliated.
aSN1Subject_organizationalUnit :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_organizationalUnit :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_organizationalUnit = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
organizationalUnit :: Maybe Text
$sel:organizationalUnit:ASN1Subject' :: ASN1Subject -> Maybe Text
organizationalUnit} -> Maybe Text
organizationalUnit) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:organizationalUnit:ASN1Subject' :: Maybe Text
organizationalUnit = Maybe Text
a} :: ASN1Subject)

-- | Two-digit code that specifies the country in which the certificate
-- subject located.
aSN1Subject_country :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_country :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_country = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
country :: Maybe Text
$sel:country:ASN1Subject' :: ASN1Subject -> Maybe Text
country} -> Maybe Text
country) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:country:ASN1Subject' :: Maybe Text
country = Maybe Text
a} :: ASN1Subject)

-- | Typically a qualifier appended to the name of an individual. Examples
-- include Jr. for junior, Sr. for senior, and III for third.
aSN1Subject_generationQualifier :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_generationQualifier :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_generationQualifier = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
generationQualifier :: Maybe Text
$sel:generationQualifier:ASN1Subject' :: ASN1Subject -> Maybe Text
generationQualifier} -> Maybe Text
generationQualifier) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:generationQualifier:ASN1Subject' :: Maybe Text
generationQualifier = Maybe Text
a} :: ASN1Subject)

-- | The locality (such as a city or town) in which the certificate subject
-- is located.
aSN1Subject_locality :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_locality :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_locality = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
locality :: Maybe Text
$sel:locality:ASN1Subject' :: ASN1Subject -> Maybe Text
locality} -> Maybe Text
locality) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:locality:ASN1Subject' :: Maybe Text
locality = Maybe Text
a} :: ASN1Subject)

-- | Typically a shortened version of a longer __GivenName__. For example,
-- Jonathan is often shortened to John. Elizabeth is often shortened to
-- Beth, Liz, or Eliza.
aSN1Subject_pseudonym :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_pseudonym :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_pseudonym = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
pseudonym :: Maybe Text
$sel:pseudonym:ASN1Subject' :: ASN1Subject -> Maybe Text
pseudonym} -> Maybe Text
pseudonym) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:pseudonym:ASN1Subject' :: Maybe Text
pseudonym = Maybe Text
a} :: ASN1Subject)

-- | Concatenation that typically contains the first letter of the
-- __GivenName__, the first letter of the middle name if one exists, and
-- the first letter of the __Surname__.
aSN1Subject_initials :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_initials :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_initials = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
initials :: Maybe Text
$sel:initials:ASN1Subject' :: ASN1Subject -> Maybe Text
initials} -> Maybe Text
initials) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:initials:ASN1Subject' :: Maybe Text
initials = Maybe Text
a} :: ASN1Subject)

-- | A title such as Mr. or Ms., which is pre-pended to the name to refer
-- formally to the certificate subject.
aSN1Subject_title :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_title :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_title = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
title :: Maybe Text
$sel:title:ASN1Subject' :: ASN1Subject -> Maybe Text
title} -> Maybe Text
title) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:title:ASN1Subject' :: Maybe Text
title = Maybe Text
a} :: ASN1Subject)

-- | Legal name of the organization with which the certificate subject is
-- affiliated.
aSN1Subject_organization :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_organization :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_organization = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
organization :: Maybe Text
$sel:organization:ASN1Subject' :: ASN1Subject -> Maybe Text
organization} -> Maybe Text
organization) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:organization:ASN1Subject' :: Maybe Text
organization = Maybe Text
a} :: ASN1Subject)

-- | The certificate serial number.
aSN1Subject_serialNumber :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_serialNumber :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_serialNumber = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
serialNumber :: Maybe Text
$sel:serialNumber:ASN1Subject' :: ASN1Subject -> Maybe Text
serialNumber} -> Maybe Text
serialNumber) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:serialNumber:ASN1Subject' :: Maybe Text
serialNumber = Maybe Text
a} :: ASN1Subject)

-- | Family name. In the US and the UK, for example, the surname of an
-- individual is ordered last. In Asian cultures the surname is typically
-- ordered first.
aSN1Subject_surname :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_surname :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_surname = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
surname :: Maybe Text
$sel:surname:ASN1Subject' :: ASN1Subject -> Maybe Text
surname} -> Maybe Text
surname) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:surname:ASN1Subject' :: Maybe Text
surname = Maybe Text
a} :: ASN1Subject)

-- | Disambiguating information for the certificate subject.
aSN1Subject_distinguishedNameQualifier :: Lens.Lens' ASN1Subject (Prelude.Maybe Prelude.Text)
aSN1Subject_distinguishedNameQualifier :: (Maybe Text -> f (Maybe Text)) -> ASN1Subject -> f ASN1Subject
aSN1Subject_distinguishedNameQualifier = (ASN1Subject -> Maybe Text)
-> (ASN1Subject -> Maybe Text -> ASN1Subject)
-> Lens ASN1Subject ASN1Subject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ASN1Subject' {Maybe Text
distinguishedNameQualifier :: Maybe Text
$sel:distinguishedNameQualifier:ASN1Subject' :: ASN1Subject -> Maybe Text
distinguishedNameQualifier} -> Maybe Text
distinguishedNameQualifier) (\s :: ASN1Subject
s@ASN1Subject' {} Maybe Text
a -> ASN1Subject
s {$sel:distinguishedNameQualifier:ASN1Subject' :: Maybe Text
distinguishedNameQualifier = Maybe Text
a} :: ASN1Subject)

instance Core.FromJSON ASN1Subject where
  parseJSON :: Value -> Parser ASN1Subject
parseJSON =
    String
-> (Object -> Parser ASN1Subject) -> Value -> Parser ASN1Subject
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ASN1Subject"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ASN1Subject
ASN1Subject'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"GivenName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"State")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"CommonName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"OrganizationalUnit")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"Country")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"GenerationQualifier")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"Locality")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"Pseudonym")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ASN1Subject)
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
"Initials")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> ASN1Subject)
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
"Title")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> ASN1Subject)
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
"Organization")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ASN1Subject)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ASN1Subject)
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
"SerialNumber")
            Parser (Maybe Text -> Maybe Text -> ASN1Subject)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ASN1Subject)
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
"Surname")
            Parser (Maybe Text -> ASN1Subject)
-> Parser (Maybe Text) -> Parser ASN1Subject
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
"DistinguishedNameQualifier")
      )

instance Prelude.Hashable ASN1Subject

instance Prelude.NFData ASN1Subject

instance Core.ToJSON ASN1Subject where
  toJSON :: ASN1Subject -> Value
toJSON ASN1Subject' {Maybe Text
distinguishedNameQualifier :: Maybe Text
surname :: Maybe Text
serialNumber :: Maybe Text
organization :: Maybe Text
title :: Maybe Text
initials :: Maybe Text
pseudonym :: Maybe Text
locality :: Maybe Text
generationQualifier :: Maybe Text
country :: Maybe Text
organizationalUnit :: Maybe Text
commonName :: Maybe Text
state :: Maybe Text
givenName :: Maybe Text
$sel:distinguishedNameQualifier:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:surname:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:serialNumber:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:organization:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:title:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:initials:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:pseudonym:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:locality:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:generationQualifier:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:country:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:organizationalUnit:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:commonName:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:state:ASN1Subject' :: ASN1Subject -> Maybe Text
$sel:givenName:ASN1Subject' :: ASN1Subject -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GivenName" 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
givenName,
            (Text
"State" 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
state,
            (Text
"CommonName" 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
commonName,
            (Text
"OrganizationalUnit" 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
organizationalUnit,
            (Text
"Country" 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
country,
            (Text
"GenerationQualifier" 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
generationQualifier,
            (Text
"Locality" 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
locality,
            (Text
"Pseudonym" 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
pseudonym,
            (Text
"Initials" 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
initials,
            (Text
"Title" 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
title,
            (Text
"Organization" 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
organization,
            (Text
"SerialNumber" 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
serialNumber,
            (Text
"Surname" 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
surname,
            (Text
"DistinguishedNameQualifier" 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
distinguishedNameQualifier
          ]
      )