{-# 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.SSHPublicKeyMetadata
-- 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.SSHPublicKeyMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types.StatusType
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an SSH public key, without the key\'s body or
-- fingerprint.
--
-- This data type is used as a response element in the ListSSHPublicKeys
-- operation.
--
-- /See:/ 'newSSHPublicKeyMetadata' smart constructor.
data SSHPublicKeyMetadata = SSHPublicKeyMetadata'
  { -- | The name of the IAM user associated with the SSH public key.
    SSHPublicKeyMetadata -> Text
userName :: Prelude.Text,
    -- | The unique identifier for the SSH public key.
    SSHPublicKeyMetadata -> Text
sSHPublicKeyId :: Prelude.Text,
    -- | The status of the SSH public key. @Active@ means that the key can be
    -- used for authentication with an CodeCommit repository. @Inactive@ means
    -- that the key cannot be used.
    SSHPublicKeyMetadata -> StatusType
status :: StatusType,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the SSH
    -- public key was uploaded.
    SSHPublicKeyMetadata -> ISO8601
uploadDate :: Data.ISO8601
  }
  deriving (SSHPublicKeyMetadata -> SSHPublicKeyMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SSHPublicKeyMetadata -> SSHPublicKeyMetadata -> Bool
$c/= :: SSHPublicKeyMetadata -> SSHPublicKeyMetadata -> Bool
== :: SSHPublicKeyMetadata -> SSHPublicKeyMetadata -> Bool
$c== :: SSHPublicKeyMetadata -> SSHPublicKeyMetadata -> Bool
Prelude.Eq, ReadPrec [SSHPublicKeyMetadata]
ReadPrec SSHPublicKeyMetadata
Int -> ReadS SSHPublicKeyMetadata
ReadS [SSHPublicKeyMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SSHPublicKeyMetadata]
$creadListPrec :: ReadPrec [SSHPublicKeyMetadata]
readPrec :: ReadPrec SSHPublicKeyMetadata
$creadPrec :: ReadPrec SSHPublicKeyMetadata
readList :: ReadS [SSHPublicKeyMetadata]
$creadList :: ReadS [SSHPublicKeyMetadata]
readsPrec :: Int -> ReadS SSHPublicKeyMetadata
$creadsPrec :: Int -> ReadS SSHPublicKeyMetadata
Prelude.Read, Int -> SSHPublicKeyMetadata -> ShowS
[SSHPublicKeyMetadata] -> ShowS
SSHPublicKeyMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SSHPublicKeyMetadata] -> ShowS
$cshowList :: [SSHPublicKeyMetadata] -> ShowS
show :: SSHPublicKeyMetadata -> String
$cshow :: SSHPublicKeyMetadata -> String
showsPrec :: Int -> SSHPublicKeyMetadata -> ShowS
$cshowsPrec :: Int -> SSHPublicKeyMetadata -> ShowS
Prelude.Show, forall x. Rep SSHPublicKeyMetadata x -> SSHPublicKeyMetadata
forall x. SSHPublicKeyMetadata -> Rep SSHPublicKeyMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SSHPublicKeyMetadata x -> SSHPublicKeyMetadata
$cfrom :: forall x. SSHPublicKeyMetadata -> Rep SSHPublicKeyMetadata x
Prelude.Generic)

-- |
-- Create a value of 'SSHPublicKeyMetadata' 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:
--
-- 'userName', 'sSHPublicKeyMetadata_userName' - The name of the IAM user associated with the SSH public key.
--
-- 'sSHPublicKeyId', 'sSHPublicKeyMetadata_sSHPublicKeyId' - The unique identifier for the SSH public key.
--
-- 'status', 'sSHPublicKeyMetadata_status' - The status of the SSH public key. @Active@ means that the key can be
-- used for authentication with an CodeCommit repository. @Inactive@ means
-- that the key cannot be used.
--
-- 'uploadDate', 'sSHPublicKeyMetadata_uploadDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the SSH
-- public key was uploaded.
newSSHPublicKeyMetadata ::
  -- | 'userName'
  Prelude.Text ->
  -- | 'sSHPublicKeyId'
  Prelude.Text ->
  -- | 'status'
  StatusType ->
  -- | 'uploadDate'
  Prelude.UTCTime ->
  SSHPublicKeyMetadata
newSSHPublicKeyMetadata :: Text -> Text -> StatusType -> UTCTime -> SSHPublicKeyMetadata
newSSHPublicKeyMetadata
  Text
pUserName_
  Text
pSSHPublicKeyId_
  StatusType
pStatus_
  UTCTime
pUploadDate_ =
    SSHPublicKeyMetadata'
      { $sel:userName:SSHPublicKeyMetadata' :: Text
userName = Text
pUserName_,
        $sel:sSHPublicKeyId:SSHPublicKeyMetadata' :: Text
sSHPublicKeyId = Text
pSSHPublicKeyId_,
        $sel:status:SSHPublicKeyMetadata' :: StatusType
status = StatusType
pStatus_,
        $sel:uploadDate:SSHPublicKeyMetadata' :: ISO8601
uploadDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUploadDate_
      }

-- | The name of the IAM user associated with the SSH public key.
sSHPublicKeyMetadata_userName :: Lens.Lens' SSHPublicKeyMetadata Prelude.Text
sSHPublicKeyMetadata_userName :: Lens' SSHPublicKeyMetadata Text
sSHPublicKeyMetadata_userName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSHPublicKeyMetadata' {Text
userName :: Text
$sel:userName:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
userName} -> Text
userName) (\s :: SSHPublicKeyMetadata
s@SSHPublicKeyMetadata' {} Text
a -> SSHPublicKeyMetadata
s {$sel:userName:SSHPublicKeyMetadata' :: Text
userName = Text
a} :: SSHPublicKeyMetadata)

-- | The unique identifier for the SSH public key.
sSHPublicKeyMetadata_sSHPublicKeyId :: Lens.Lens' SSHPublicKeyMetadata Prelude.Text
sSHPublicKeyMetadata_sSHPublicKeyId :: Lens' SSHPublicKeyMetadata Text
sSHPublicKeyMetadata_sSHPublicKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSHPublicKeyMetadata' {Text
sSHPublicKeyId :: Text
$sel:sSHPublicKeyId:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
sSHPublicKeyId} -> Text
sSHPublicKeyId) (\s :: SSHPublicKeyMetadata
s@SSHPublicKeyMetadata' {} Text
a -> SSHPublicKeyMetadata
s {$sel:sSHPublicKeyId:SSHPublicKeyMetadata' :: Text
sSHPublicKeyId = Text
a} :: SSHPublicKeyMetadata)

-- | The status of the SSH public key. @Active@ means that the key can be
-- used for authentication with an CodeCommit repository. @Inactive@ means
-- that the key cannot be used.
sSHPublicKeyMetadata_status :: Lens.Lens' SSHPublicKeyMetadata StatusType
sSHPublicKeyMetadata_status :: Lens' SSHPublicKeyMetadata StatusType
sSHPublicKeyMetadata_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSHPublicKeyMetadata' {StatusType
status :: StatusType
$sel:status:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> StatusType
status} -> StatusType
status) (\s :: SSHPublicKeyMetadata
s@SSHPublicKeyMetadata' {} StatusType
a -> SSHPublicKeyMetadata
s {$sel:status:SSHPublicKeyMetadata' :: StatusType
status = StatusType
a} :: SSHPublicKeyMetadata)

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the SSH
-- public key was uploaded.
sSHPublicKeyMetadata_uploadDate :: Lens.Lens' SSHPublicKeyMetadata Prelude.UTCTime
sSHPublicKeyMetadata_uploadDate :: Lens' SSHPublicKeyMetadata UTCTime
sSHPublicKeyMetadata_uploadDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSHPublicKeyMetadata' {ISO8601
uploadDate :: ISO8601
$sel:uploadDate:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> ISO8601
uploadDate} -> ISO8601
uploadDate) (\s :: SSHPublicKeyMetadata
s@SSHPublicKeyMetadata' {} ISO8601
a -> SSHPublicKeyMetadata
s {$sel:uploadDate:SSHPublicKeyMetadata' :: ISO8601
uploadDate = ISO8601
a} :: SSHPublicKeyMetadata) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML SSHPublicKeyMetadata where
  parseXML :: [Node] -> Either String SSHPublicKeyMetadata
parseXML [Node]
x =
    Text -> Text -> StatusType -> ISO8601 -> SSHPublicKeyMetadata
SSHPublicKeyMetadata'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"UserName")
      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
"SSHPublicKeyId")
      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
"Status")
      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
"UploadDate")

instance Prelude.Hashable SSHPublicKeyMetadata where
  hashWithSalt :: Int -> SSHPublicKeyMetadata -> Int
hashWithSalt Int
_salt SSHPublicKeyMetadata' {Text
ISO8601
StatusType
uploadDate :: ISO8601
status :: StatusType
sSHPublicKeyId :: Text
userName :: Text
$sel:uploadDate:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> ISO8601
$sel:status:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> StatusType
$sel:sSHPublicKeyId:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
$sel:userName:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sSHPublicKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StatusType
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
uploadDate

instance Prelude.NFData SSHPublicKeyMetadata where
  rnf :: SSHPublicKeyMetadata -> ()
rnf SSHPublicKeyMetadata' {Text
ISO8601
StatusType
uploadDate :: ISO8601
status :: StatusType
sSHPublicKeyId :: Text
userName :: Text
$sel:uploadDate:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> ISO8601
$sel:status:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> StatusType
$sel:sSHPublicKeyId:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
$sel:userName:SSHPublicKeyMetadata' :: SSHPublicKeyMetadata -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
userName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sSHPublicKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StatusType
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
uploadDate