{-# 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.IAM.Types.ServerCertificateMetadata
-- 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.IAM.Types.ServerCertificateMetadata where

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

-- | Contains information about a server certificate without its certificate
-- body, certificate chain, and private key.
--
-- This data type is used as a response element in the
-- UploadServerCertificate and ListServerCertificates operations.
--
-- /See:/ 'newServerCertificateMetadata' smart constructor.
data ServerCertificateMetadata = ServerCertificateMetadata'
  { -- | The date when the server certificate was uploaded.
    ServerCertificateMetadata -> Maybe ISO8601
uploadDate :: Prelude.Maybe Core.ISO8601,
    -- | The date on which the certificate is set to expire.
    ServerCertificateMetadata -> Maybe ISO8601
expiration :: Prelude.Maybe Core.ISO8601,
    -- | The path to the server certificate. For more information about paths,
    -- see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    ServerCertificateMetadata -> Text
path :: Prelude.Text,
    -- | The name that identifies the server certificate.
    ServerCertificateMetadata -> Text
serverCertificateName :: Prelude.Text,
    -- | The stable and unique string identifying the server certificate. For
    -- more information about IDs, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    ServerCertificateMetadata -> Text
serverCertificateId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) specifying the server certificate. For
    -- more information about ARNs and how to use them in policies, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    ServerCertificateMetadata -> Text
arn :: Prelude.Text
  }
  deriving (ServerCertificateMetadata -> ServerCertificateMetadata -> Bool
(ServerCertificateMetadata -> ServerCertificateMetadata -> Bool)
-> (ServerCertificateMetadata -> ServerCertificateMetadata -> Bool)
-> Eq ServerCertificateMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerCertificateMetadata -> ServerCertificateMetadata -> Bool
$c/= :: ServerCertificateMetadata -> ServerCertificateMetadata -> Bool
== :: ServerCertificateMetadata -> ServerCertificateMetadata -> Bool
$c== :: ServerCertificateMetadata -> ServerCertificateMetadata -> Bool
Prelude.Eq, ReadPrec [ServerCertificateMetadata]
ReadPrec ServerCertificateMetadata
Int -> ReadS ServerCertificateMetadata
ReadS [ServerCertificateMetadata]
(Int -> ReadS ServerCertificateMetadata)
-> ReadS [ServerCertificateMetadata]
-> ReadPrec ServerCertificateMetadata
-> ReadPrec [ServerCertificateMetadata]
-> Read ServerCertificateMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerCertificateMetadata]
$creadListPrec :: ReadPrec [ServerCertificateMetadata]
readPrec :: ReadPrec ServerCertificateMetadata
$creadPrec :: ReadPrec ServerCertificateMetadata
readList :: ReadS [ServerCertificateMetadata]
$creadList :: ReadS [ServerCertificateMetadata]
readsPrec :: Int -> ReadS ServerCertificateMetadata
$creadsPrec :: Int -> ReadS ServerCertificateMetadata
Prelude.Read, Int -> ServerCertificateMetadata -> ShowS
[ServerCertificateMetadata] -> ShowS
ServerCertificateMetadata -> String
(Int -> ServerCertificateMetadata -> ShowS)
-> (ServerCertificateMetadata -> String)
-> ([ServerCertificateMetadata] -> ShowS)
-> Show ServerCertificateMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerCertificateMetadata] -> ShowS
$cshowList :: [ServerCertificateMetadata] -> ShowS
show :: ServerCertificateMetadata -> String
$cshow :: ServerCertificateMetadata -> String
showsPrec :: Int -> ServerCertificateMetadata -> ShowS
$cshowsPrec :: Int -> ServerCertificateMetadata -> ShowS
Prelude.Show, (forall x.
 ServerCertificateMetadata -> Rep ServerCertificateMetadata x)
-> (forall x.
    Rep ServerCertificateMetadata x -> ServerCertificateMetadata)
-> Generic ServerCertificateMetadata
forall x.
Rep ServerCertificateMetadata x -> ServerCertificateMetadata
forall x.
ServerCertificateMetadata -> Rep ServerCertificateMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServerCertificateMetadata x -> ServerCertificateMetadata
$cfrom :: forall x.
ServerCertificateMetadata -> Rep ServerCertificateMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ServerCertificateMetadata' 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:
--
-- 'uploadDate', 'serverCertificateMetadata_uploadDate' - The date when the server certificate was uploaded.
--
-- 'expiration', 'serverCertificateMetadata_expiration' - The date on which the certificate is set to expire.
--
-- 'path', 'serverCertificateMetadata_path' - The path to the server certificate. For more information about paths,
-- see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'serverCertificateName', 'serverCertificateMetadata_serverCertificateName' - The name that identifies the server certificate.
--
-- 'serverCertificateId', 'serverCertificateMetadata_serverCertificateId' - The stable and unique string identifying the server certificate. For
-- more information about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'arn', 'serverCertificateMetadata_arn' - The Amazon Resource Name (ARN) specifying the server certificate. For
-- more information about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
newServerCertificateMetadata ::
  -- | 'path'
  Prelude.Text ->
  -- | 'serverCertificateName'
  Prelude.Text ->
  -- | 'serverCertificateId'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  ServerCertificateMetadata
newServerCertificateMetadata :: Text -> Text -> Text -> Text -> ServerCertificateMetadata
newServerCertificateMetadata
  Text
pPath_
  Text
pServerCertificateName_
  Text
pServerCertificateId_
  Text
pArn_ =
    ServerCertificateMetadata' :: Maybe ISO8601
-> Maybe ISO8601
-> Text
-> Text
-> Text
-> Text
-> ServerCertificateMetadata
ServerCertificateMetadata'
      { $sel:uploadDate:ServerCertificateMetadata' :: Maybe ISO8601
uploadDate =
          Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
        $sel:expiration:ServerCertificateMetadata' :: Maybe ISO8601
expiration = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
        $sel:path:ServerCertificateMetadata' :: Text
path = Text
pPath_,
        $sel:serverCertificateName:ServerCertificateMetadata' :: Text
serverCertificateName = Text
pServerCertificateName_,
        $sel:serverCertificateId:ServerCertificateMetadata' :: Text
serverCertificateId = Text
pServerCertificateId_,
        $sel:arn:ServerCertificateMetadata' :: Text
arn = Text
pArn_
      }

-- | The date when the server certificate was uploaded.
serverCertificateMetadata_uploadDate :: Lens.Lens' ServerCertificateMetadata (Prelude.Maybe Prelude.UTCTime)
serverCertificateMetadata_uploadDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_uploadDate = (ServerCertificateMetadata -> Maybe ISO8601)
-> (ServerCertificateMetadata
    -> Maybe ISO8601 -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata
     ServerCertificateMetadata
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Maybe ISO8601
uploadDate :: Maybe ISO8601
$sel:uploadDate:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
uploadDate} -> Maybe ISO8601
uploadDate) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Maybe ISO8601
a -> ServerCertificateMetadata
s {$sel:uploadDate:ServerCertificateMetadata' :: Maybe ISO8601
uploadDate = Maybe ISO8601
a} :: ServerCertificateMetadata) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ServerCertificateMetadata -> f ServerCertificateMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerCertificateMetadata
-> f ServerCertificateMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date on which the certificate is set to expire.
serverCertificateMetadata_expiration :: Lens.Lens' ServerCertificateMetadata (Prelude.Maybe Prelude.UTCTime)
serverCertificateMetadata_expiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_expiration = (ServerCertificateMetadata -> Maybe ISO8601)
-> (ServerCertificateMetadata
    -> Maybe ISO8601 -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata
     ServerCertificateMetadata
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Maybe ISO8601
expiration :: Maybe ISO8601
$sel:expiration:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
expiration} -> Maybe ISO8601
expiration) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Maybe ISO8601
a -> ServerCertificateMetadata
s {$sel:expiration:ServerCertificateMetadata' :: Maybe ISO8601
expiration = Maybe ISO8601
a} :: ServerCertificateMetadata) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> ServerCertificateMetadata -> f ServerCertificateMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServerCertificateMetadata
-> f ServerCertificateMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The path to the server certificate. For more information about paths,
-- see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
serverCertificateMetadata_path :: Lens.Lens' ServerCertificateMetadata Prelude.Text
serverCertificateMetadata_path :: (Text -> f Text)
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_path = (ServerCertificateMetadata -> Text)
-> (ServerCertificateMetadata -> Text -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata ServerCertificateMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Text
path :: Text
$sel:path:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
path} -> Text
path) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Text
a -> ServerCertificateMetadata
s {$sel:path:ServerCertificateMetadata' :: Text
path = Text
a} :: ServerCertificateMetadata)

-- | The name that identifies the server certificate.
serverCertificateMetadata_serverCertificateName :: Lens.Lens' ServerCertificateMetadata Prelude.Text
serverCertificateMetadata_serverCertificateName :: (Text -> f Text)
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_serverCertificateName = (ServerCertificateMetadata -> Text)
-> (ServerCertificateMetadata -> Text -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata ServerCertificateMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Text
serverCertificateName :: Text
$sel:serverCertificateName:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
serverCertificateName} -> Text
serverCertificateName) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Text
a -> ServerCertificateMetadata
s {$sel:serverCertificateName:ServerCertificateMetadata' :: Text
serverCertificateName = Text
a} :: ServerCertificateMetadata)

-- | The stable and unique string identifying the server certificate. For
-- more information about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
serverCertificateMetadata_serverCertificateId :: Lens.Lens' ServerCertificateMetadata Prelude.Text
serverCertificateMetadata_serverCertificateId :: (Text -> f Text)
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_serverCertificateId = (ServerCertificateMetadata -> Text)
-> (ServerCertificateMetadata -> Text -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata ServerCertificateMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Text
serverCertificateId :: Text
$sel:serverCertificateId:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
serverCertificateId} -> Text
serverCertificateId) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Text
a -> ServerCertificateMetadata
s {$sel:serverCertificateId:ServerCertificateMetadata' :: Text
serverCertificateId = Text
a} :: ServerCertificateMetadata)

-- | The Amazon Resource Name (ARN) specifying the server certificate. For
-- more information about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
serverCertificateMetadata_arn :: Lens.Lens' ServerCertificateMetadata Prelude.Text
serverCertificateMetadata_arn :: (Text -> f Text)
-> ServerCertificateMetadata -> f ServerCertificateMetadata
serverCertificateMetadata_arn = (ServerCertificateMetadata -> Text)
-> (ServerCertificateMetadata -> Text -> ServerCertificateMetadata)
-> Lens
     ServerCertificateMetadata ServerCertificateMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateMetadata' {Text
arn :: Text
$sel:arn:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
arn} -> Text
arn) (\s :: ServerCertificateMetadata
s@ServerCertificateMetadata' {} Text
a -> ServerCertificateMetadata
s {$sel:arn:ServerCertificateMetadata' :: Text
arn = Text
a} :: ServerCertificateMetadata)

instance Core.FromXML ServerCertificateMetadata where
  parseXML :: [Node] -> Either String ServerCertificateMetadata
parseXML [Node]
x =
    Maybe ISO8601
-> Maybe ISO8601
-> Text
-> Text
-> Text
-> Text
-> ServerCertificateMetadata
ServerCertificateMetadata'
      (Maybe ISO8601
 -> Maybe ISO8601
 -> Text
 -> Text
 -> Text
 -> Text
 -> ServerCertificateMetadata)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe ISO8601
      -> Text -> Text -> Text -> Text -> ServerCertificateMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UploadDate")
      Either
  String
  (Maybe ISO8601
   -> Text -> Text -> Text -> Text -> ServerCertificateMetadata)
-> Either String (Maybe ISO8601)
-> Either
     String (Text -> Text -> Text -> Text -> ServerCertificateMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Expiration")
      Either
  String (Text -> Text -> Text -> Text -> ServerCertificateMetadata)
-> Either String Text
-> Either
     String (Text -> Text -> Text -> ServerCertificateMetadata)
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
"Path")
      Either String (Text -> Text -> Text -> ServerCertificateMetadata)
-> Either String Text
-> Either String (Text -> Text -> ServerCertificateMetadata)
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
"ServerCertificateName")
      Either String (Text -> Text -> ServerCertificateMetadata)
-> Either String Text
-> Either String (Text -> ServerCertificateMetadata)
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
"ServerCertificateId")
      Either String (Text -> ServerCertificateMetadata)
-> Either String Text -> Either String ServerCertificateMetadata
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
"Arn")

instance Prelude.Hashable ServerCertificateMetadata

instance Prelude.NFData ServerCertificateMetadata