{-# 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.ListedHostKey
-- 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.ListedHostKey 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

-- | Returns properties of the host key that\'s specified.
--
-- /See:/ 'newListedHostKey' smart constructor.
data ListedHostKey = ListedHostKey'
  { -- | The date on which the host key was added to the server.
    ListedHostKey -> Maybe POSIX
dateImported :: Prelude.Maybe Data.POSIX,
    -- | The current description for the host key. You can change it by calling
    -- the @UpdateHostKey@ operation and providing a new description.
    ListedHostKey -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The public key fingerprint, which is a short sequence of bytes used to
    -- identify the longer public key.
    ListedHostKey -> Maybe Text
fingerprint :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the host key.
    ListedHostKey -> Maybe Text
hostKeyId :: Prelude.Maybe Prelude.Text,
    -- | The encryption algorithm that is used for the host key. The @Type@
    -- parameter is specified by using one of the following values:
    --
    -- -   @ssh-rsa@
    --
    -- -   @ssh-ed25519@
    --
    -- -   @ecdsa-sha2-nistp256@
    --
    -- -   @ecdsa-sha2-nistp384@
    --
    -- -   @ecdsa-sha2-nistp521@
    ListedHostKey -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The unique Amazon Resource Name (ARN) of the host key.
    ListedHostKey -> Text
arn :: Prelude.Text
  }
  deriving (ListedHostKey -> ListedHostKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedHostKey -> ListedHostKey -> Bool
$c/= :: ListedHostKey -> ListedHostKey -> Bool
== :: ListedHostKey -> ListedHostKey -> Bool
$c== :: ListedHostKey -> ListedHostKey -> Bool
Prelude.Eq, ReadPrec [ListedHostKey]
ReadPrec ListedHostKey
Int -> ReadS ListedHostKey
ReadS [ListedHostKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedHostKey]
$creadListPrec :: ReadPrec [ListedHostKey]
readPrec :: ReadPrec ListedHostKey
$creadPrec :: ReadPrec ListedHostKey
readList :: ReadS [ListedHostKey]
$creadList :: ReadS [ListedHostKey]
readsPrec :: Int -> ReadS ListedHostKey
$creadsPrec :: Int -> ReadS ListedHostKey
Prelude.Read, Int -> ListedHostKey -> ShowS
[ListedHostKey] -> ShowS
ListedHostKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedHostKey] -> ShowS
$cshowList :: [ListedHostKey] -> ShowS
show :: ListedHostKey -> String
$cshow :: ListedHostKey -> String
showsPrec :: Int -> ListedHostKey -> ShowS
$cshowsPrec :: Int -> ListedHostKey -> ShowS
Prelude.Show, forall x. Rep ListedHostKey x -> ListedHostKey
forall x. ListedHostKey -> Rep ListedHostKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedHostKey x -> ListedHostKey
$cfrom :: forall x. ListedHostKey -> Rep ListedHostKey x
Prelude.Generic)

-- |
-- Create a value of 'ListedHostKey' 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:
--
-- 'dateImported', 'listedHostKey_dateImported' - The date on which the host key was added to the server.
--
-- 'description', 'listedHostKey_description' - The current description for the host key. You can change it by calling
-- the @UpdateHostKey@ operation and providing a new description.
--
-- 'fingerprint', 'listedHostKey_fingerprint' - The public key fingerprint, which is a short sequence of bytes used to
-- identify the longer public key.
--
-- 'hostKeyId', 'listedHostKey_hostKeyId' - A unique identifier for the host key.
--
-- 'type'', 'listedHostKey_type' - The encryption algorithm that is used for the host key. The @Type@
-- parameter is specified by using one of the following values:
--
-- -   @ssh-rsa@
--
-- -   @ssh-ed25519@
--
-- -   @ecdsa-sha2-nistp256@
--
-- -   @ecdsa-sha2-nistp384@
--
-- -   @ecdsa-sha2-nistp521@
--
-- 'arn', 'listedHostKey_arn' - The unique Amazon Resource Name (ARN) of the host key.
newListedHostKey ::
  -- | 'arn'
  Prelude.Text ->
  ListedHostKey
newListedHostKey :: Text -> ListedHostKey
newListedHostKey Text
pArn_ =
  ListedHostKey'
    { $sel:dateImported:ListedHostKey' :: Maybe POSIX
dateImported = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ListedHostKey' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:fingerprint:ListedHostKey' :: Maybe Text
fingerprint = forall a. Maybe a
Prelude.Nothing,
      $sel:hostKeyId:ListedHostKey' :: Maybe Text
hostKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ListedHostKey' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListedHostKey' :: Text
arn = Text
pArn_
    }

-- | The date on which the host key was added to the server.
listedHostKey_dateImported :: Lens.Lens' ListedHostKey (Prelude.Maybe Prelude.UTCTime)
listedHostKey_dateImported :: Lens' ListedHostKey (Maybe UTCTime)
listedHostKey_dateImported = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Maybe POSIX
dateImported :: Maybe POSIX
$sel:dateImported:ListedHostKey' :: ListedHostKey -> Maybe POSIX
dateImported} -> Maybe POSIX
dateImported) (\s :: ListedHostKey
s@ListedHostKey' {} Maybe POSIX
a -> ListedHostKey
s {$sel:dateImported:ListedHostKey' :: Maybe POSIX
dateImported = Maybe POSIX
a} :: ListedHostKey) 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 current description for the host key. You can change it by calling
-- the @UpdateHostKey@ operation and providing a new description.
listedHostKey_description :: Lens.Lens' ListedHostKey (Prelude.Maybe Prelude.Text)
listedHostKey_description :: Lens' ListedHostKey (Maybe Text)
listedHostKey_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Maybe Text
description :: Maybe Text
$sel:description:ListedHostKey' :: ListedHostKey -> Maybe Text
description} -> Maybe Text
description) (\s :: ListedHostKey
s@ListedHostKey' {} Maybe Text
a -> ListedHostKey
s {$sel:description:ListedHostKey' :: Maybe Text
description = Maybe Text
a} :: ListedHostKey)

-- | The public key fingerprint, which is a short sequence of bytes used to
-- identify the longer public key.
listedHostKey_fingerprint :: Lens.Lens' ListedHostKey (Prelude.Maybe Prelude.Text)
listedHostKey_fingerprint :: Lens' ListedHostKey (Maybe Text)
listedHostKey_fingerprint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Maybe Text
fingerprint :: Maybe Text
$sel:fingerprint:ListedHostKey' :: ListedHostKey -> Maybe Text
fingerprint} -> Maybe Text
fingerprint) (\s :: ListedHostKey
s@ListedHostKey' {} Maybe Text
a -> ListedHostKey
s {$sel:fingerprint:ListedHostKey' :: Maybe Text
fingerprint = Maybe Text
a} :: ListedHostKey)

-- | A unique identifier for the host key.
listedHostKey_hostKeyId :: Lens.Lens' ListedHostKey (Prelude.Maybe Prelude.Text)
listedHostKey_hostKeyId :: Lens' ListedHostKey (Maybe Text)
listedHostKey_hostKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Maybe Text
hostKeyId :: Maybe Text
$sel:hostKeyId:ListedHostKey' :: ListedHostKey -> Maybe Text
hostKeyId} -> Maybe Text
hostKeyId) (\s :: ListedHostKey
s@ListedHostKey' {} Maybe Text
a -> ListedHostKey
s {$sel:hostKeyId:ListedHostKey' :: Maybe Text
hostKeyId = Maybe Text
a} :: ListedHostKey)

-- | The encryption algorithm that is used for the host key. The @Type@
-- parameter is specified by using one of the following values:
--
-- -   @ssh-rsa@
--
-- -   @ssh-ed25519@
--
-- -   @ecdsa-sha2-nistp256@
--
-- -   @ecdsa-sha2-nistp384@
--
-- -   @ecdsa-sha2-nistp521@
listedHostKey_type :: Lens.Lens' ListedHostKey (Prelude.Maybe Prelude.Text)
listedHostKey_type :: Lens' ListedHostKey (Maybe Text)
listedHostKey_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Maybe Text
type' :: Maybe Text
$sel:type':ListedHostKey' :: ListedHostKey -> Maybe Text
type'} -> Maybe Text
type') (\s :: ListedHostKey
s@ListedHostKey' {} Maybe Text
a -> ListedHostKey
s {$sel:type':ListedHostKey' :: Maybe Text
type' = Maybe Text
a} :: ListedHostKey)

-- | The unique Amazon Resource Name (ARN) of the host key.
listedHostKey_arn :: Lens.Lens' ListedHostKey Prelude.Text
listedHostKey_arn :: Lens' ListedHostKey Text
listedHostKey_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedHostKey' {Text
arn :: Text
$sel:arn:ListedHostKey' :: ListedHostKey -> Text
arn} -> Text
arn) (\s :: ListedHostKey
s@ListedHostKey' {} Text
a -> ListedHostKey
s {$sel:arn:ListedHostKey' :: Text
arn = Text
a} :: ListedHostKey)

instance Data.FromJSON ListedHostKey where
  parseJSON :: Value -> Parser ListedHostKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListedHostKey"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> ListedHostKey
ListedHostKey'
            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
"DateImported")
            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
"Fingerprint")
            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
"HostKeyId")
            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 a
Data..: Key
"Arn")
      )

instance Prelude.Hashable ListedHostKey where
  hashWithSalt :: Int -> ListedHostKey -> Int
hashWithSalt Int
_salt ListedHostKey' {Maybe Text
Maybe POSIX
Text
arn :: Text
type' :: Maybe Text
hostKeyId :: Maybe Text
fingerprint :: Maybe Text
description :: Maybe Text
dateImported :: Maybe POSIX
$sel:arn:ListedHostKey' :: ListedHostKey -> Text
$sel:type':ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:hostKeyId:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:fingerprint:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:description:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:dateImported:ListedHostKey' :: ListedHostKey -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
dateImported
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fingerprint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData ListedHostKey where
  rnf :: ListedHostKey -> ()
rnf ListedHostKey' {Maybe Text
Maybe POSIX
Text
arn :: Text
type' :: Maybe Text
hostKeyId :: Maybe Text
fingerprint :: Maybe Text
description :: Maybe Text
dateImported :: Maybe POSIX
$sel:arn:ListedHostKey' :: ListedHostKey -> Text
$sel:type':ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:hostKeyId:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:fingerprint:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:description:ListedHostKey' :: ListedHostKey -> Maybe Text
$sel:dateImported:ListedHostKey' :: ListedHostKey -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
dateImported
      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 Text
fingerprint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn