{-# 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.Transfer.Types.ListedCertificate
-- 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.Transfer.Types.ListedCertificate 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
import Amazonka.Transfer.Types.CertificateStatusType
import Amazonka.Transfer.Types.CertificateType
import Amazonka.Transfer.Types.CertificateUsageType

-- | Describes the properties of a certificate.
--
-- /See:/ 'newListedCertificate' smart constructor.
data ListedCertificate = ListedCertificate'
  { -- | An optional date that specifies when the certificate becomes active.
    ListedCertificate -> Maybe POSIX
activeDate :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) of the specified certificate.
    ListedCertificate -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | An array of identifiers for the imported certificates. You use this
    -- identifier for working with profiles and partner profiles.
    ListedCertificate -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
    -- | The name or short description that\'s used to identify the certificate.
    ListedCertificate -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | An optional date that specifies when the certificate becomes inactive.
    ListedCertificate -> Maybe POSIX
inactiveDate :: Prelude.Maybe Data.POSIX,
    -- | The certificate can be either @ACTIVE@, @PENDING_ROTATION@, or
    -- @INACTIVE@. @PENDING_ROTATION@ means that this certificate will replace
    -- the current certificate when it expires.
    ListedCertificate -> Maybe CertificateStatusType
status :: Prelude.Maybe CertificateStatusType,
    -- | The type for the certificate. If a private key has been specified for
    -- the certificate, its type is @CERTIFICATE_WITH_PRIVATE_KEY@. If there is
    -- no private key, the type is @CERTIFICATE@.
    ListedCertificate -> Maybe CertificateType
type' :: Prelude.Maybe CertificateType,
    -- | Specifies whether this certificate is used for signing or encryption.
    ListedCertificate -> Maybe CertificateUsageType
usage :: Prelude.Maybe CertificateUsageType
  }
  deriving (ListedCertificate -> ListedCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedCertificate -> ListedCertificate -> Bool
$c/= :: ListedCertificate -> ListedCertificate -> Bool
== :: ListedCertificate -> ListedCertificate -> Bool
$c== :: ListedCertificate -> ListedCertificate -> Bool
Prelude.Eq, ReadPrec [ListedCertificate]
ReadPrec ListedCertificate
Int -> ReadS ListedCertificate
ReadS [ListedCertificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedCertificate]
$creadListPrec :: ReadPrec [ListedCertificate]
readPrec :: ReadPrec ListedCertificate
$creadPrec :: ReadPrec ListedCertificate
readList :: ReadS [ListedCertificate]
$creadList :: ReadS [ListedCertificate]
readsPrec :: Int -> ReadS ListedCertificate
$creadsPrec :: Int -> ReadS ListedCertificate
Prelude.Read, Int -> ListedCertificate -> ShowS
[ListedCertificate] -> ShowS
ListedCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedCertificate] -> ShowS
$cshowList :: [ListedCertificate] -> ShowS
show :: ListedCertificate -> String
$cshow :: ListedCertificate -> String
showsPrec :: Int -> ListedCertificate -> ShowS
$cshowsPrec :: Int -> ListedCertificate -> ShowS
Prelude.Show, forall x. Rep ListedCertificate x -> ListedCertificate
forall x. ListedCertificate -> Rep ListedCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedCertificate x -> ListedCertificate
$cfrom :: forall x. ListedCertificate -> Rep ListedCertificate x
Prelude.Generic)

-- |
-- Create a value of 'ListedCertificate' 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:
--
-- 'activeDate', 'listedCertificate_activeDate' - An optional date that specifies when the certificate becomes active.
--
-- 'arn', 'listedCertificate_arn' - The Amazon Resource Name (ARN) of the specified certificate.
--
-- 'certificateId', 'listedCertificate_certificateId' - An array of identifiers for the imported certificates. You use this
-- identifier for working with profiles and partner profiles.
--
-- 'description', 'listedCertificate_description' - The name or short description that\'s used to identify the certificate.
--
-- 'inactiveDate', 'listedCertificate_inactiveDate' - An optional date that specifies when the certificate becomes inactive.
--
-- 'status', 'listedCertificate_status' - The certificate can be either @ACTIVE@, @PENDING_ROTATION@, or
-- @INACTIVE@. @PENDING_ROTATION@ means that this certificate will replace
-- the current certificate when it expires.
--
-- 'type'', 'listedCertificate_type' - The type for the certificate. If a private key has been specified for
-- the certificate, its type is @CERTIFICATE_WITH_PRIVATE_KEY@. If there is
-- no private key, the type is @CERTIFICATE@.
--
-- 'usage', 'listedCertificate_usage' - Specifies whether this certificate is used for signing or encryption.
newListedCertificate ::
  ListedCertificate
newListedCertificate :: ListedCertificate
newListedCertificate =
  ListedCertificate'
    { $sel:activeDate:ListedCertificate' :: Maybe POSIX
activeDate = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListedCertificate' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:certificateId:ListedCertificate' :: Maybe Text
certificateId = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ListedCertificate' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:inactiveDate:ListedCertificate' :: Maybe POSIX
inactiveDate = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListedCertificate' :: Maybe CertificateStatusType
status = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ListedCertificate' :: Maybe CertificateType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:usage:ListedCertificate' :: Maybe CertificateUsageType
usage = forall a. Maybe a
Prelude.Nothing
    }

-- | An optional date that specifies when the certificate becomes active.
listedCertificate_activeDate :: Lens.Lens' ListedCertificate (Prelude.Maybe Prelude.UTCTime)
listedCertificate_activeDate :: Lens' ListedCertificate (Maybe UTCTime)
listedCertificate_activeDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe POSIX
activeDate :: Maybe POSIX
$sel:activeDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
activeDate} -> Maybe POSIX
activeDate) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe POSIX
a -> ListedCertificate
s {$sel:activeDate:ListedCertificate' :: Maybe POSIX
activeDate = Maybe POSIX
a} :: ListedCertificate) 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 Amazon Resource Name (ARN) of the specified certificate.
listedCertificate_arn :: Lens.Lens' ListedCertificate (Prelude.Maybe Prelude.Text)
listedCertificate_arn :: Lens' ListedCertificate (Maybe Text)
listedCertificate_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe Text
arn :: Maybe Text
$sel:arn:ListedCertificate' :: ListedCertificate -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe Text
a -> ListedCertificate
s {$sel:arn:ListedCertificate' :: Maybe Text
arn = Maybe Text
a} :: ListedCertificate)

-- | An array of identifiers for the imported certificates. You use this
-- identifier for working with profiles and partner profiles.
listedCertificate_certificateId :: Lens.Lens' ListedCertificate (Prelude.Maybe Prelude.Text)
listedCertificate_certificateId :: Lens' ListedCertificate (Maybe Text)
listedCertificate_certificateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:ListedCertificate' :: ListedCertificate -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe Text
a -> ListedCertificate
s {$sel:certificateId:ListedCertificate' :: Maybe Text
certificateId = Maybe Text
a} :: ListedCertificate)

-- | The name or short description that\'s used to identify the certificate.
listedCertificate_description :: Lens.Lens' ListedCertificate (Prelude.Maybe Prelude.Text)
listedCertificate_description :: Lens' ListedCertificate (Maybe Text)
listedCertificate_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe Text
description :: Maybe Text
$sel:description:ListedCertificate' :: ListedCertificate -> Maybe Text
description} -> Maybe Text
description) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe Text
a -> ListedCertificate
s {$sel:description:ListedCertificate' :: Maybe Text
description = Maybe Text
a} :: ListedCertificate)

-- | An optional date that specifies when the certificate becomes inactive.
listedCertificate_inactiveDate :: Lens.Lens' ListedCertificate (Prelude.Maybe Prelude.UTCTime)
listedCertificate_inactiveDate :: Lens' ListedCertificate (Maybe UTCTime)
listedCertificate_inactiveDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe POSIX
inactiveDate :: Maybe POSIX
$sel:inactiveDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
inactiveDate} -> Maybe POSIX
inactiveDate) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe POSIX
a -> ListedCertificate
s {$sel:inactiveDate:ListedCertificate' :: Maybe POSIX
inactiveDate = Maybe POSIX
a} :: ListedCertificate) 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 certificate can be either @ACTIVE@, @PENDING_ROTATION@, or
-- @INACTIVE@. @PENDING_ROTATION@ means that this certificate will replace
-- the current certificate when it expires.
listedCertificate_status :: Lens.Lens' ListedCertificate (Prelude.Maybe CertificateStatusType)
listedCertificate_status :: Lens' ListedCertificate (Maybe CertificateStatusType)
listedCertificate_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe CertificateStatusType
status :: Maybe CertificateStatusType
$sel:status:ListedCertificate' :: ListedCertificate -> Maybe CertificateStatusType
status} -> Maybe CertificateStatusType
status) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe CertificateStatusType
a -> ListedCertificate
s {$sel:status:ListedCertificate' :: Maybe CertificateStatusType
status = Maybe CertificateStatusType
a} :: ListedCertificate)

-- | The type for the certificate. If a private key has been specified for
-- the certificate, its type is @CERTIFICATE_WITH_PRIVATE_KEY@. If there is
-- no private key, the type is @CERTIFICATE@.
listedCertificate_type :: Lens.Lens' ListedCertificate (Prelude.Maybe CertificateType)
listedCertificate_type :: Lens' ListedCertificate (Maybe CertificateType)
listedCertificate_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe CertificateType
type' :: Maybe CertificateType
$sel:type':ListedCertificate' :: ListedCertificate -> Maybe CertificateType
type'} -> Maybe CertificateType
type') (\s :: ListedCertificate
s@ListedCertificate' {} Maybe CertificateType
a -> ListedCertificate
s {$sel:type':ListedCertificate' :: Maybe CertificateType
type' = Maybe CertificateType
a} :: ListedCertificate)

-- | Specifies whether this certificate is used for signing or encryption.
listedCertificate_usage :: Lens.Lens' ListedCertificate (Prelude.Maybe CertificateUsageType)
listedCertificate_usage :: Lens' ListedCertificate (Maybe CertificateUsageType)
listedCertificate_usage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedCertificate' {Maybe CertificateUsageType
usage :: Maybe CertificateUsageType
$sel:usage:ListedCertificate' :: ListedCertificate -> Maybe CertificateUsageType
usage} -> Maybe CertificateUsageType
usage) (\s :: ListedCertificate
s@ListedCertificate' {} Maybe CertificateUsageType
a -> ListedCertificate
s {$sel:usage:ListedCertificate' :: Maybe CertificateUsageType
usage = Maybe CertificateUsageType
a} :: ListedCertificate)

instance Data.FromJSON ListedCertificate where
  parseJSON :: Value -> Parser ListedCertificate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListedCertificate"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe CertificateStatusType
-> Maybe CertificateType
-> Maybe CertificateUsageType
-> ListedCertificate
ListedCertificate'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ActiveDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CertificateId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InactiveDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Usage")
      )

instance Prelude.Hashable ListedCertificate where
  hashWithSalt :: Int -> ListedCertificate -> Int
hashWithSalt Int
_salt ListedCertificate' {Maybe Text
Maybe POSIX
Maybe CertificateStatusType
Maybe CertificateType
Maybe CertificateUsageType
usage :: Maybe CertificateUsageType
type' :: Maybe CertificateType
status :: Maybe CertificateStatusType
inactiveDate :: Maybe POSIX
description :: Maybe Text
certificateId :: Maybe Text
arn :: Maybe Text
activeDate :: Maybe POSIX
$sel:usage:ListedCertificate' :: ListedCertificate -> Maybe CertificateUsageType
$sel:type':ListedCertificate' :: ListedCertificate -> Maybe CertificateType
$sel:status:ListedCertificate' :: ListedCertificate -> Maybe CertificateStatusType
$sel:inactiveDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
$sel:description:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:certificateId:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:arn:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:activeDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
activeDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
inactiveDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CertificateStatusType
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CertificateType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CertificateUsageType
usage

instance Prelude.NFData ListedCertificate where
  rnf :: ListedCertificate -> ()
rnf ListedCertificate' {Maybe Text
Maybe POSIX
Maybe CertificateStatusType
Maybe CertificateType
Maybe CertificateUsageType
usage :: Maybe CertificateUsageType
type' :: Maybe CertificateType
status :: Maybe CertificateStatusType
inactiveDate :: Maybe POSIX
description :: Maybe Text
certificateId :: Maybe Text
arn :: Maybe Text
activeDate :: Maybe POSIX
$sel:usage:ListedCertificate' :: ListedCertificate -> Maybe CertificateUsageType
$sel:type':ListedCertificate' :: ListedCertificate -> Maybe CertificateType
$sel:status:ListedCertificate' :: ListedCertificate -> Maybe CertificateStatusType
$sel:inactiveDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
$sel:description:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:certificateId:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:arn:ListedCertificate' :: ListedCertificate -> Maybe Text
$sel:activeDate:ListedCertificate' :: ListedCertificate -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
activeDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
inactiveDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CertificateStatusType
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CertificateType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CertificateUsageType
usage