{-# 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.CloudFrontOriginAccessIdentitySummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFront.Types.CloudFrontOriginAccessIdentitySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Summary of the information about a CloudFront origin access identity.
--
-- /See:/ 'newCloudFrontOriginAccessIdentitySummary' smart constructor.
data CloudFrontOriginAccessIdentitySummary = CloudFrontOriginAccessIdentitySummary'
  { -- | The ID for the origin access identity. For example: @E74FTE3AJFJ256A@.
    CloudFrontOriginAccessIdentitySummary -> Text
id :: Prelude.Text,
    -- | The Amazon S3 canonical user ID for the origin access identity, which
    -- you use when giving the origin access identity read permission to an
    -- object in Amazon S3.
    CloudFrontOriginAccessIdentitySummary -> Text
s3CanonicalUserId :: Prelude.Text,
    -- | The comment for this origin access identity, as originally specified
    -- when created.
    CloudFrontOriginAccessIdentitySummary -> Text
comment :: Prelude.Text
  }
  deriving (CloudFrontOriginAccessIdentitySummary
-> CloudFrontOriginAccessIdentitySummary -> Bool
(CloudFrontOriginAccessIdentitySummary
 -> CloudFrontOriginAccessIdentitySummary -> Bool)
-> (CloudFrontOriginAccessIdentitySummary
    -> CloudFrontOriginAccessIdentitySummary -> Bool)
-> Eq CloudFrontOriginAccessIdentitySummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFrontOriginAccessIdentitySummary
-> CloudFrontOriginAccessIdentitySummary -> Bool
$c/= :: CloudFrontOriginAccessIdentitySummary
-> CloudFrontOriginAccessIdentitySummary -> Bool
== :: CloudFrontOriginAccessIdentitySummary
-> CloudFrontOriginAccessIdentitySummary -> Bool
$c== :: CloudFrontOriginAccessIdentitySummary
-> CloudFrontOriginAccessIdentitySummary -> Bool
Prelude.Eq, ReadPrec [CloudFrontOriginAccessIdentitySummary]
ReadPrec CloudFrontOriginAccessIdentitySummary
Int -> ReadS CloudFrontOriginAccessIdentitySummary
ReadS [CloudFrontOriginAccessIdentitySummary]
(Int -> ReadS CloudFrontOriginAccessIdentitySummary)
-> ReadS [CloudFrontOriginAccessIdentitySummary]
-> ReadPrec CloudFrontOriginAccessIdentitySummary
-> ReadPrec [CloudFrontOriginAccessIdentitySummary]
-> Read CloudFrontOriginAccessIdentitySummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFrontOriginAccessIdentitySummary]
$creadListPrec :: ReadPrec [CloudFrontOriginAccessIdentitySummary]
readPrec :: ReadPrec CloudFrontOriginAccessIdentitySummary
$creadPrec :: ReadPrec CloudFrontOriginAccessIdentitySummary
readList :: ReadS [CloudFrontOriginAccessIdentitySummary]
$creadList :: ReadS [CloudFrontOriginAccessIdentitySummary]
readsPrec :: Int -> ReadS CloudFrontOriginAccessIdentitySummary
$creadsPrec :: Int -> ReadS CloudFrontOriginAccessIdentitySummary
Prelude.Read, Int -> CloudFrontOriginAccessIdentitySummary -> ShowS
[CloudFrontOriginAccessIdentitySummary] -> ShowS
CloudFrontOriginAccessIdentitySummary -> String
(Int -> CloudFrontOriginAccessIdentitySummary -> ShowS)
-> (CloudFrontOriginAccessIdentitySummary -> String)
-> ([CloudFrontOriginAccessIdentitySummary] -> ShowS)
-> Show CloudFrontOriginAccessIdentitySummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFrontOriginAccessIdentitySummary] -> ShowS
$cshowList :: [CloudFrontOriginAccessIdentitySummary] -> ShowS
show :: CloudFrontOriginAccessIdentitySummary -> String
$cshow :: CloudFrontOriginAccessIdentitySummary -> String
showsPrec :: Int -> CloudFrontOriginAccessIdentitySummary -> ShowS
$cshowsPrec :: Int -> CloudFrontOriginAccessIdentitySummary -> ShowS
Prelude.Show, (forall x.
 CloudFrontOriginAccessIdentitySummary
 -> Rep CloudFrontOriginAccessIdentitySummary x)
-> (forall x.
    Rep CloudFrontOriginAccessIdentitySummary x
    -> CloudFrontOriginAccessIdentitySummary)
-> Generic CloudFrontOriginAccessIdentitySummary
forall x.
Rep CloudFrontOriginAccessIdentitySummary x
-> CloudFrontOriginAccessIdentitySummary
forall x.
CloudFrontOriginAccessIdentitySummary
-> Rep CloudFrontOriginAccessIdentitySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudFrontOriginAccessIdentitySummary x
-> CloudFrontOriginAccessIdentitySummary
$cfrom :: forall x.
CloudFrontOriginAccessIdentitySummary
-> Rep CloudFrontOriginAccessIdentitySummary x
Prelude.Generic)

-- |
-- Create a value of 'CloudFrontOriginAccessIdentitySummary' 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:
--
-- 'id', 'cloudFrontOriginAccessIdentitySummary_id' - The ID for the origin access identity. For example: @E74FTE3AJFJ256A@.
--
-- 's3CanonicalUserId', 'cloudFrontOriginAccessIdentitySummary_s3CanonicalUserId' - The Amazon S3 canonical user ID for the origin access identity, which
-- you use when giving the origin access identity read permission to an
-- object in Amazon S3.
--
-- 'comment', 'cloudFrontOriginAccessIdentitySummary_comment' - The comment for this origin access identity, as originally specified
-- when created.
newCloudFrontOriginAccessIdentitySummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 's3CanonicalUserId'
  Prelude.Text ->
  -- | 'comment'
  Prelude.Text ->
  CloudFrontOriginAccessIdentitySummary
newCloudFrontOriginAccessIdentitySummary :: Text -> Text -> Text -> CloudFrontOriginAccessIdentitySummary
newCloudFrontOriginAccessIdentitySummary
  Text
pId_
  Text
pS3CanonicalUserId_
  Text
pComment_ =
    CloudFrontOriginAccessIdentitySummary' :: Text -> Text -> Text -> CloudFrontOriginAccessIdentitySummary
CloudFrontOriginAccessIdentitySummary'
      { $sel:id:CloudFrontOriginAccessIdentitySummary' :: Text
id = Text
pId_,
        $sel:s3CanonicalUserId:CloudFrontOriginAccessIdentitySummary' :: Text
s3CanonicalUserId =
          Text
pS3CanonicalUserId_,
        $sel:comment:CloudFrontOriginAccessIdentitySummary' :: Text
comment = Text
pComment_
      }

-- | The ID for the origin access identity. For example: @E74FTE3AJFJ256A@.
cloudFrontOriginAccessIdentitySummary_id :: Lens.Lens' CloudFrontOriginAccessIdentitySummary Prelude.Text
cloudFrontOriginAccessIdentitySummary_id :: (Text -> f Text)
-> CloudFrontOriginAccessIdentitySummary
-> f CloudFrontOriginAccessIdentitySummary
cloudFrontOriginAccessIdentitySummary_id = (CloudFrontOriginAccessIdentitySummary -> Text)
-> (CloudFrontOriginAccessIdentitySummary
    -> Text -> CloudFrontOriginAccessIdentitySummary)
-> Lens
     CloudFrontOriginAccessIdentitySummary
     CloudFrontOriginAccessIdentitySummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentitySummary' {Text
id :: Text
$sel:id:CloudFrontOriginAccessIdentitySummary' :: CloudFrontOriginAccessIdentitySummary -> Text
id} -> Text
id) (\s :: CloudFrontOriginAccessIdentitySummary
s@CloudFrontOriginAccessIdentitySummary' {} Text
a -> CloudFrontOriginAccessIdentitySummary
s {$sel:id:CloudFrontOriginAccessIdentitySummary' :: Text
id = Text
a} :: CloudFrontOriginAccessIdentitySummary)

-- | The Amazon S3 canonical user ID for the origin access identity, which
-- you use when giving the origin access identity read permission to an
-- object in Amazon S3.
cloudFrontOriginAccessIdentitySummary_s3CanonicalUserId :: Lens.Lens' CloudFrontOriginAccessIdentitySummary Prelude.Text
cloudFrontOriginAccessIdentitySummary_s3CanonicalUserId :: (Text -> f Text)
-> CloudFrontOriginAccessIdentitySummary
-> f CloudFrontOriginAccessIdentitySummary
cloudFrontOriginAccessIdentitySummary_s3CanonicalUserId = (CloudFrontOriginAccessIdentitySummary -> Text)
-> (CloudFrontOriginAccessIdentitySummary
    -> Text -> CloudFrontOriginAccessIdentitySummary)
-> Lens
     CloudFrontOriginAccessIdentitySummary
     CloudFrontOriginAccessIdentitySummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentitySummary' {Text
s3CanonicalUserId :: Text
$sel:s3CanonicalUserId:CloudFrontOriginAccessIdentitySummary' :: CloudFrontOriginAccessIdentitySummary -> Text
s3CanonicalUserId} -> Text
s3CanonicalUserId) (\s :: CloudFrontOriginAccessIdentitySummary
s@CloudFrontOriginAccessIdentitySummary' {} Text
a -> CloudFrontOriginAccessIdentitySummary
s {$sel:s3CanonicalUserId:CloudFrontOriginAccessIdentitySummary' :: Text
s3CanonicalUserId = Text
a} :: CloudFrontOriginAccessIdentitySummary)

-- | The comment for this origin access identity, as originally specified
-- when created.
cloudFrontOriginAccessIdentitySummary_comment :: Lens.Lens' CloudFrontOriginAccessIdentitySummary Prelude.Text
cloudFrontOriginAccessIdentitySummary_comment :: (Text -> f Text)
-> CloudFrontOriginAccessIdentitySummary
-> f CloudFrontOriginAccessIdentitySummary
cloudFrontOriginAccessIdentitySummary_comment = (CloudFrontOriginAccessIdentitySummary -> Text)
-> (CloudFrontOriginAccessIdentitySummary
    -> Text -> CloudFrontOriginAccessIdentitySummary)
-> Lens
     CloudFrontOriginAccessIdentitySummary
     CloudFrontOriginAccessIdentitySummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentitySummary' {Text
comment :: Text
$sel:comment:CloudFrontOriginAccessIdentitySummary' :: CloudFrontOriginAccessIdentitySummary -> Text
comment} -> Text
comment) (\s :: CloudFrontOriginAccessIdentitySummary
s@CloudFrontOriginAccessIdentitySummary' {} Text
a -> CloudFrontOriginAccessIdentitySummary
s {$sel:comment:CloudFrontOriginAccessIdentitySummary' :: Text
comment = Text
a} :: CloudFrontOriginAccessIdentitySummary)

instance
  Core.FromXML
    CloudFrontOriginAccessIdentitySummary
  where
  parseXML :: [Node] -> Either String CloudFrontOriginAccessIdentitySummary
parseXML [Node]
x =
    Text -> Text -> Text -> CloudFrontOriginAccessIdentitySummary
CloudFrontOriginAccessIdentitySummary'
      (Text -> Text -> Text -> CloudFrontOriginAccessIdentitySummary)
-> Either String Text
-> Either
     String (Text -> Text -> CloudFrontOriginAccessIdentitySummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either
  String (Text -> Text -> CloudFrontOriginAccessIdentitySummary)
-> Either String Text
-> Either String (Text -> CloudFrontOriginAccessIdentitySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"S3CanonicalUserId")
      Either String (Text -> CloudFrontOriginAccessIdentitySummary)
-> Either String Text
-> Either String CloudFrontOriginAccessIdentitySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Comment")

instance
  Prelude.Hashable
    CloudFrontOriginAccessIdentitySummary

instance
  Prelude.NFData
    CloudFrontOriginAccessIdentitySummary