{-# 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.CloudFront.Types.PublicKeySummary
-- 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.CloudFront.Types.PublicKeySummary 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 public key.
--
-- /See:/ 'newPublicKeySummary' smart constructor.
data PublicKeySummary = PublicKeySummary'
  { -- | A comment to describe the public key. The comment cannot be longer than
    -- 128 characters.
    PublicKeySummary -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the public key.
    PublicKeySummary -> Text
id :: Prelude.Text,
    -- | A name to help identify the public key.
    PublicKeySummary -> Text
name :: Prelude.Text,
    -- | The date and time when the public key was uploaded.
    PublicKeySummary -> ISO8601
createdTime :: Data.ISO8601,
    -- | The public key.
    PublicKeySummary -> Text
encodedKey :: Prelude.Text
  }
  deriving (PublicKeySummary -> PublicKeySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublicKeySummary -> PublicKeySummary -> Bool
$c/= :: PublicKeySummary -> PublicKeySummary -> Bool
== :: PublicKeySummary -> PublicKeySummary -> Bool
$c== :: PublicKeySummary -> PublicKeySummary -> Bool
Prelude.Eq, ReadPrec [PublicKeySummary]
ReadPrec PublicKeySummary
Int -> ReadS PublicKeySummary
ReadS [PublicKeySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublicKeySummary]
$creadListPrec :: ReadPrec [PublicKeySummary]
readPrec :: ReadPrec PublicKeySummary
$creadPrec :: ReadPrec PublicKeySummary
readList :: ReadS [PublicKeySummary]
$creadList :: ReadS [PublicKeySummary]
readsPrec :: Int -> ReadS PublicKeySummary
$creadsPrec :: Int -> ReadS PublicKeySummary
Prelude.Read, Int -> PublicKeySummary -> ShowS
[PublicKeySummary] -> ShowS
PublicKeySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublicKeySummary] -> ShowS
$cshowList :: [PublicKeySummary] -> ShowS
show :: PublicKeySummary -> String
$cshow :: PublicKeySummary -> String
showsPrec :: Int -> PublicKeySummary -> ShowS
$cshowsPrec :: Int -> PublicKeySummary -> ShowS
Prelude.Show, forall x. Rep PublicKeySummary x -> PublicKeySummary
forall x. PublicKeySummary -> Rep PublicKeySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublicKeySummary x -> PublicKeySummary
$cfrom :: forall x. PublicKeySummary -> Rep PublicKeySummary x
Prelude.Generic)

-- |
-- Create a value of 'PublicKeySummary' 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:
--
-- 'comment', 'publicKeySummary_comment' - A comment to describe the public key. The comment cannot be longer than
-- 128 characters.
--
-- 'id', 'publicKeySummary_id' - The identifier of the public key.
--
-- 'name', 'publicKeySummary_name' - A name to help identify the public key.
--
-- 'createdTime', 'publicKeySummary_createdTime' - The date and time when the public key was uploaded.
--
-- 'encodedKey', 'publicKeySummary_encodedKey' - The public key.
newPublicKeySummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'createdTime'
  Prelude.UTCTime ->
  -- | 'encodedKey'
  Prelude.Text ->
  PublicKeySummary
newPublicKeySummary :: Text -> Text -> UTCTime -> Text -> PublicKeySummary
newPublicKeySummary
  Text
pId_
  Text
pName_
  UTCTime
pCreatedTime_
  Text
pEncodedKey_ =
    PublicKeySummary'
      { $sel:comment:PublicKeySummary' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
        $sel:id:PublicKeySummary' :: Text
id = Text
pId_,
        $sel:name:PublicKeySummary' :: Text
name = Text
pName_,
        $sel:createdTime:PublicKeySummary' :: ISO8601
createdTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedTime_,
        $sel:encodedKey:PublicKeySummary' :: Text
encodedKey = Text
pEncodedKey_
      }

-- | A comment to describe the public key. The comment cannot be longer than
-- 128 characters.
publicKeySummary_comment :: Lens.Lens' PublicKeySummary (Prelude.Maybe Prelude.Text)
publicKeySummary_comment :: Lens' PublicKeySummary (Maybe Text)
publicKeySummary_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeySummary' {Maybe Text
comment :: Maybe Text
$sel:comment:PublicKeySummary' :: PublicKeySummary -> Maybe Text
comment} -> Maybe Text
comment) (\s :: PublicKeySummary
s@PublicKeySummary' {} Maybe Text
a -> PublicKeySummary
s {$sel:comment:PublicKeySummary' :: Maybe Text
comment = Maybe Text
a} :: PublicKeySummary)

-- | The identifier of the public key.
publicKeySummary_id :: Lens.Lens' PublicKeySummary Prelude.Text
publicKeySummary_id :: Lens' PublicKeySummary Text
publicKeySummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeySummary' {Text
id :: Text
$sel:id:PublicKeySummary' :: PublicKeySummary -> Text
id} -> Text
id) (\s :: PublicKeySummary
s@PublicKeySummary' {} Text
a -> PublicKeySummary
s {$sel:id:PublicKeySummary' :: Text
id = Text
a} :: PublicKeySummary)

-- | A name to help identify the public key.
publicKeySummary_name :: Lens.Lens' PublicKeySummary Prelude.Text
publicKeySummary_name :: Lens' PublicKeySummary Text
publicKeySummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeySummary' {Text
name :: Text
$sel:name:PublicKeySummary' :: PublicKeySummary -> Text
name} -> Text
name) (\s :: PublicKeySummary
s@PublicKeySummary' {} Text
a -> PublicKeySummary
s {$sel:name:PublicKeySummary' :: Text
name = Text
a} :: PublicKeySummary)

-- | The date and time when the public key was uploaded.
publicKeySummary_createdTime :: Lens.Lens' PublicKeySummary Prelude.UTCTime
publicKeySummary_createdTime :: Lens' PublicKeySummary UTCTime
publicKeySummary_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeySummary' {ISO8601
createdTime :: ISO8601
$sel:createdTime:PublicKeySummary' :: PublicKeySummary -> ISO8601
createdTime} -> ISO8601
createdTime) (\s :: PublicKeySummary
s@PublicKeySummary' {} ISO8601
a -> PublicKeySummary
s {$sel:createdTime:PublicKeySummary' :: ISO8601
createdTime = ISO8601
a} :: PublicKeySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The public key.
publicKeySummary_encodedKey :: Lens.Lens' PublicKeySummary Prelude.Text
publicKeySummary_encodedKey :: Lens' PublicKeySummary Text
publicKeySummary_encodedKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeySummary' {Text
encodedKey :: Text
$sel:encodedKey:PublicKeySummary' :: PublicKeySummary -> Text
encodedKey} -> Text
encodedKey) (\s :: PublicKeySummary
s@PublicKeySummary' {} Text
a -> PublicKeySummary
s {$sel:encodedKey:PublicKeySummary' :: Text
encodedKey = Text
a} :: PublicKeySummary)

instance Data.FromXML PublicKeySummary where
  parseXML :: [Node] -> Either String PublicKeySummary
parseXML [Node]
x =
    Maybe Text -> Text -> Text -> ISO8601 -> Text -> PublicKeySummary
PublicKeySummary'
      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
"Comment")
      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
"Id")
      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
"Name")
      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
"CreatedTime")
      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
"EncodedKey")

instance Prelude.Hashable PublicKeySummary where
  hashWithSalt :: Int -> PublicKeySummary -> Int
hashWithSalt Int
_salt PublicKeySummary' {Maybe Text
Text
ISO8601
encodedKey :: Text
createdTime :: ISO8601
name :: Text
id :: Text
comment :: Maybe Text
$sel:encodedKey:PublicKeySummary' :: PublicKeySummary -> Text
$sel:createdTime:PublicKeySummary' :: PublicKeySummary -> ISO8601
$sel:name:PublicKeySummary' :: PublicKeySummary -> Text
$sel:id:PublicKeySummary' :: PublicKeySummary -> Text
$sel:comment:PublicKeySummary' :: PublicKeySummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
encodedKey

instance Prelude.NFData PublicKeySummary where
  rnf :: PublicKeySummary -> ()
rnf PublicKeySummary' {Maybe Text
Text
ISO8601
encodedKey :: Text
createdTime :: ISO8601
name :: Text
id :: Text
comment :: Maybe Text
$sel:encodedKey:PublicKeySummary' :: PublicKeySummary -> Text
$sel:createdTime:PublicKeySummary' :: PublicKeySummary -> ISO8601
$sel:name:PublicKeySummary' :: PublicKeySummary -> Text
$sel:id:PublicKeySummary' :: PublicKeySummary -> Text
$sel:comment:PublicKeySummary' :: PublicKeySummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
encodedKey