{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IAM.Types.ServerCertificateMetadata where

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

-- | 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 on which the certificate is set to expire.
    ServerCertificateMetadata -> Maybe ISO8601
expiration :: Prelude.Maybe Data.ISO8601,
    -- | The date when the server certificate was uploaded.
    ServerCertificateMetadata -> Maybe ISO8601
uploadDate :: Prelude.Maybe Data.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
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]
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
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.
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:
--
-- 'expiration', 'serverCertificateMetadata_expiration' - The date on which the certificate is set to expire.
--
-- 'uploadDate', 'serverCertificateMetadata_uploadDate' - The date when the server certificate was uploaded.
--
-- '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'
      { $sel:expiration:ServerCertificateMetadata' :: Maybe ISO8601
expiration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:uploadDate:ServerCertificateMetadata' :: Maybe ISO8601
uploadDate = 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 on which the certificate is set to expire.
serverCertificateMetadata_expiration :: Lens.Lens' ServerCertificateMetadata (Prelude.Maybe Prelude.UTCTime)
serverCertificateMetadata_expiration :: Lens' ServerCertificateMetadata (Maybe UTCTime)
serverCertificateMetadata_expiration = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date when the server certificate was uploaded.
serverCertificateMetadata_uploadDate :: Lens.Lens' ServerCertificateMetadata (Prelude.Maybe Prelude.UTCTime)
serverCertificateMetadata_uploadDate :: Lens' ServerCertificateMetadata (Maybe UTCTime)
serverCertificateMetadata_uploadDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._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 :: Lens' ServerCertificateMetadata Text
serverCertificateMetadata_path = 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 :: Lens' ServerCertificateMetadata Text
serverCertificateMetadata_serverCertificateName = 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 :: Lens' ServerCertificateMetadata Text
serverCertificateMetadata_serverCertificateId = 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 :: Lens' ServerCertificateMetadata Text
serverCertificateMetadata_arn = 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 Data.FromXML ServerCertificateMetadata where
  parseXML :: [Node] -> Either String ServerCertificateMetadata
parseXML [Node]
x =
    Maybe ISO8601
-> Maybe ISO8601
-> Text
-> Text
-> Text
-> Text
-> ServerCertificateMetadata
ServerCertificateMetadata'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Expiration")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"UploadDate")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Path")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ServerCertificateName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ServerCertificateId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Arn")

instance Prelude.Hashable ServerCertificateMetadata where
  hashWithSalt :: Int -> ServerCertificateMetadata -> Int
hashWithSalt Int
_salt ServerCertificateMetadata' {Maybe ISO8601
Text
arn :: Text
serverCertificateId :: Text
serverCertificateName :: Text
path :: Text
uploadDate :: Maybe ISO8601
expiration :: Maybe ISO8601
$sel:arn:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:serverCertificateId:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:serverCertificateName:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:path:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:uploadDate:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
$sel:expiration:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
expiration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
uploadDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
path
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverCertificateName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverCertificateId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData ServerCertificateMetadata where
  rnf :: ServerCertificateMetadata -> ()
rnf ServerCertificateMetadata' {Maybe ISO8601
Text
arn :: Text
serverCertificateId :: Text
serverCertificateName :: Text
path :: Text
uploadDate :: Maybe ISO8601
expiration :: Maybe ISO8601
$sel:arn:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:serverCertificateId:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:serverCertificateName:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:path:ServerCertificateMetadata' :: ServerCertificateMetadata -> Text
$sel:uploadDate:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
$sel:expiration:ServerCertificateMetadata' :: ServerCertificateMetadata -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
expiration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
uploadDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
path
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverCertificateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverCertificateId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn