{-# 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.DescribedHostKey
-- 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.DescribedHostKey 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.Tag

-- | The details for a server host key.
--
-- /See:/ 'newDescribedHostKey' smart constructor.
data DescribedHostKey = DescribedHostKey'
  { -- | The date on which the host key was added to the server.
    DescribedHostKey -> Maybe POSIX
dateImported :: Prelude.Maybe Data.POSIX,
    -- | The text description for this host key.
    DescribedHostKey -> 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.
    DescribedHostKey -> Maybe Text
hostKeyFingerprint :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the host key.
    DescribedHostKey -> Maybe Text
hostKeyId :: Prelude.Maybe Prelude.Text,
    -- | Key-value pairs that can be used to group and search for host keys.
    DescribedHostKey -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | 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@
    DescribedHostKey -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The unique Amazon Resource Name (ARN) for the host key.
    DescribedHostKey -> Text
arn :: Prelude.Text
  }
  deriving (DescribedHostKey -> DescribedHostKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribedHostKey -> DescribedHostKey -> Bool
$c/= :: DescribedHostKey -> DescribedHostKey -> Bool
== :: DescribedHostKey -> DescribedHostKey -> Bool
$c== :: DescribedHostKey -> DescribedHostKey -> Bool
Prelude.Eq, ReadPrec [DescribedHostKey]
ReadPrec DescribedHostKey
Int -> ReadS DescribedHostKey
ReadS [DescribedHostKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribedHostKey]
$creadListPrec :: ReadPrec [DescribedHostKey]
readPrec :: ReadPrec DescribedHostKey
$creadPrec :: ReadPrec DescribedHostKey
readList :: ReadS [DescribedHostKey]
$creadList :: ReadS [DescribedHostKey]
readsPrec :: Int -> ReadS DescribedHostKey
$creadsPrec :: Int -> ReadS DescribedHostKey
Prelude.Read, Int -> DescribedHostKey -> ShowS
[DescribedHostKey] -> ShowS
DescribedHostKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribedHostKey] -> ShowS
$cshowList :: [DescribedHostKey] -> ShowS
show :: DescribedHostKey -> String
$cshow :: DescribedHostKey -> String
showsPrec :: Int -> DescribedHostKey -> ShowS
$cshowsPrec :: Int -> DescribedHostKey -> ShowS
Prelude.Show, forall x. Rep DescribedHostKey x -> DescribedHostKey
forall x. DescribedHostKey -> Rep DescribedHostKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribedHostKey x -> DescribedHostKey
$cfrom :: forall x. DescribedHostKey -> Rep DescribedHostKey x
Prelude.Generic)

-- |
-- Create a value of 'DescribedHostKey' 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', 'describedHostKey_dateImported' - The date on which the host key was added to the server.
--
-- 'description', 'describedHostKey_description' - The text description for this host key.
--
-- 'hostKeyFingerprint', 'describedHostKey_hostKeyFingerprint' - The public key fingerprint, which is a short sequence of bytes used to
-- identify the longer public key.
--
-- 'hostKeyId', 'describedHostKey_hostKeyId' - A unique identifier for the host key.
--
-- 'tags', 'describedHostKey_tags' - Key-value pairs that can be used to group and search for host keys.
--
-- 'type'', 'describedHostKey_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', 'describedHostKey_arn' - The unique Amazon Resource Name (ARN) for the host key.
newDescribedHostKey ::
  -- | 'arn'
  Prelude.Text ->
  DescribedHostKey
newDescribedHostKey :: Text -> DescribedHostKey
newDescribedHostKey Text
pArn_ =
  DescribedHostKey'
    { $sel:dateImported:DescribedHostKey' :: Maybe POSIX
dateImported = forall a. Maybe a
Prelude.Nothing,
      $sel:description:DescribedHostKey' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:hostKeyFingerprint:DescribedHostKey' :: Maybe Text
hostKeyFingerprint = forall a. Maybe a
Prelude.Nothing,
      $sel:hostKeyId:DescribedHostKey' :: Maybe Text
hostKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DescribedHostKey' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:type':DescribedHostKey' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DescribedHostKey' :: Text
arn = Text
pArn_
    }

-- | The date on which the host key was added to the server.
describedHostKey_dateImported :: Lens.Lens' DescribedHostKey (Prelude.Maybe Prelude.UTCTime)
describedHostKey_dateImported :: Lens' DescribedHostKey (Maybe UTCTime)
describedHostKey_dateImported = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedHostKey' {Maybe POSIX
dateImported :: Maybe POSIX
$sel:dateImported:DescribedHostKey' :: DescribedHostKey -> Maybe POSIX
dateImported} -> Maybe POSIX
dateImported) (\s :: DescribedHostKey
s@DescribedHostKey' {} Maybe POSIX
a -> DescribedHostKey
s {$sel:dateImported:DescribedHostKey' :: Maybe POSIX
dateImported = Maybe POSIX
a} :: DescribedHostKey) 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 text description for this host key.
describedHostKey_description :: Lens.Lens' DescribedHostKey (Prelude.Maybe Prelude.Text)
describedHostKey_description :: Lens' DescribedHostKey (Maybe Text)
describedHostKey_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedHostKey' {Maybe Text
description :: Maybe Text
$sel:description:DescribedHostKey' :: DescribedHostKey -> Maybe Text
description} -> Maybe Text
description) (\s :: DescribedHostKey
s@DescribedHostKey' {} Maybe Text
a -> DescribedHostKey
s {$sel:description:DescribedHostKey' :: Maybe Text
description = Maybe Text
a} :: DescribedHostKey)

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

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

-- | Key-value pairs that can be used to group and search for host keys.
describedHostKey_tags :: Lens.Lens' DescribedHostKey (Prelude.Maybe (Prelude.NonEmpty Tag))
describedHostKey_tags :: Lens' DescribedHostKey (Maybe (NonEmpty Tag))
describedHostKey_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedHostKey' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:DescribedHostKey' :: DescribedHostKey -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: DescribedHostKey
s@DescribedHostKey' {} Maybe (NonEmpty Tag)
a -> DescribedHostKey
s {$sel:tags:DescribedHostKey' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: DescribedHostKey) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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@
describedHostKey_type :: Lens.Lens' DescribedHostKey (Prelude.Maybe Prelude.Text)
describedHostKey_type :: Lens' DescribedHostKey (Maybe Text)
describedHostKey_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedHostKey' {Maybe Text
type' :: Maybe Text
$sel:type':DescribedHostKey' :: DescribedHostKey -> Maybe Text
type'} -> Maybe Text
type') (\s :: DescribedHostKey
s@DescribedHostKey' {} Maybe Text
a -> DescribedHostKey
s {$sel:type':DescribedHostKey' :: Maybe Text
type' = Maybe Text
a} :: DescribedHostKey)

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

instance Data.FromJSON DescribedHostKey where
  parseJSON :: Value -> Parser DescribedHostKey
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DescribedHostKey"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Maybe Text
-> Text
-> DescribedHostKey
DescribedHostKey'
            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
"HostKeyFingerprint")
            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
"Tags")
            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 DescribedHostKey where
  hashWithSalt :: Int -> DescribedHostKey -> Int
hashWithSalt Int
_salt DescribedHostKey' {Maybe (NonEmpty Tag)
Maybe Text
Maybe POSIX
Text
arn :: Text
type' :: Maybe Text
tags :: Maybe (NonEmpty Tag)
hostKeyId :: Maybe Text
hostKeyFingerprint :: Maybe Text
description :: Maybe Text
dateImported :: Maybe POSIX
$sel:arn:DescribedHostKey' :: DescribedHostKey -> Text
$sel:type':DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:tags:DescribedHostKey' :: DescribedHostKey -> Maybe (NonEmpty Tag)
$sel:hostKeyId:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:hostKeyFingerprint:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:description:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:dateImported:DescribedHostKey' :: DescribedHostKey -> 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
hostKeyFingerprint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      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 DescribedHostKey where
  rnf :: DescribedHostKey -> ()
rnf DescribedHostKey' {Maybe (NonEmpty Tag)
Maybe Text
Maybe POSIX
Text
arn :: Text
type' :: Maybe Text
tags :: Maybe (NonEmpty Tag)
hostKeyId :: Maybe Text
hostKeyFingerprint :: Maybe Text
description :: Maybe Text
dateImported :: Maybe POSIX
$sel:arn:DescribedHostKey' :: DescribedHostKey -> Text
$sel:type':DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:tags:DescribedHostKey' :: DescribedHostKey -> Maybe (NonEmpty Tag)
$sel:hostKeyId:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:hostKeyFingerprint:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:description:DescribedHostKey' :: DescribedHostKey -> Maybe Text
$sel:dateImported:DescribedHostKey' :: DescribedHostKey -> 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
hostKeyFingerprint
      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 (NonEmpty Tag)
tags
      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