{-# 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.SecurityHub.Types.AwsCloudFrontDistributionOriginS3OriginConfig
-- 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.SecurityHub.Types.AwsCloudFrontDistributionOriginS3OriginConfig where

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

-- | Information about an origin that is an S3 bucket that is not configured
-- with static website hosting.
--
-- /See:/ 'newAwsCloudFrontDistributionOriginS3OriginConfig' smart constructor.
data AwsCloudFrontDistributionOriginS3OriginConfig = AwsCloudFrontDistributionOriginS3OriginConfig'
  { -- | The CloudFront origin access identity to associate with the origin.
    AwsCloudFrontDistributionOriginS3OriginConfig -> Maybe Text
originAccessIdentity :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCloudFrontDistributionOriginS3OriginConfig
-> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool
(AwsCloudFrontDistributionOriginS3OriginConfig
 -> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool)
-> (AwsCloudFrontDistributionOriginS3OriginConfig
    -> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool)
-> Eq AwsCloudFrontDistributionOriginS3OriginConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudFrontDistributionOriginS3OriginConfig
-> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool
$c/= :: AwsCloudFrontDistributionOriginS3OriginConfig
-> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool
== :: AwsCloudFrontDistributionOriginS3OriginConfig
-> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool
$c== :: AwsCloudFrontDistributionOriginS3OriginConfig
-> AwsCloudFrontDistributionOriginS3OriginConfig -> Bool
Prelude.Eq, ReadPrec [AwsCloudFrontDistributionOriginS3OriginConfig]
ReadPrec AwsCloudFrontDistributionOriginS3OriginConfig
Int -> ReadS AwsCloudFrontDistributionOriginS3OriginConfig
ReadS [AwsCloudFrontDistributionOriginS3OriginConfig]
(Int -> ReadS AwsCloudFrontDistributionOriginS3OriginConfig)
-> ReadS [AwsCloudFrontDistributionOriginS3OriginConfig]
-> ReadPrec AwsCloudFrontDistributionOriginS3OriginConfig
-> ReadPrec [AwsCloudFrontDistributionOriginS3OriginConfig]
-> Read AwsCloudFrontDistributionOriginS3OriginConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudFrontDistributionOriginS3OriginConfig]
$creadListPrec :: ReadPrec [AwsCloudFrontDistributionOriginS3OriginConfig]
readPrec :: ReadPrec AwsCloudFrontDistributionOriginS3OriginConfig
$creadPrec :: ReadPrec AwsCloudFrontDistributionOriginS3OriginConfig
readList :: ReadS [AwsCloudFrontDistributionOriginS3OriginConfig]
$creadList :: ReadS [AwsCloudFrontDistributionOriginS3OriginConfig]
readsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginS3OriginConfig
$creadsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginS3OriginConfig
Prelude.Read, Int -> AwsCloudFrontDistributionOriginS3OriginConfig -> ShowS
[AwsCloudFrontDistributionOriginS3OriginConfig] -> ShowS
AwsCloudFrontDistributionOriginS3OriginConfig -> String
(Int -> AwsCloudFrontDistributionOriginS3OriginConfig -> ShowS)
-> (AwsCloudFrontDistributionOriginS3OriginConfig -> String)
-> ([AwsCloudFrontDistributionOriginS3OriginConfig] -> ShowS)
-> Show AwsCloudFrontDistributionOriginS3OriginConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudFrontDistributionOriginS3OriginConfig] -> ShowS
$cshowList :: [AwsCloudFrontDistributionOriginS3OriginConfig] -> ShowS
show :: AwsCloudFrontDistributionOriginS3OriginConfig -> String
$cshow :: AwsCloudFrontDistributionOriginS3OriginConfig -> String
showsPrec :: Int -> AwsCloudFrontDistributionOriginS3OriginConfig -> ShowS
$cshowsPrec :: Int -> AwsCloudFrontDistributionOriginS3OriginConfig -> ShowS
Prelude.Show, (forall x.
 AwsCloudFrontDistributionOriginS3OriginConfig
 -> Rep AwsCloudFrontDistributionOriginS3OriginConfig x)
-> (forall x.
    Rep AwsCloudFrontDistributionOriginS3OriginConfig x
    -> AwsCloudFrontDistributionOriginS3OriginConfig)
-> Generic AwsCloudFrontDistributionOriginS3OriginConfig
forall x.
Rep AwsCloudFrontDistributionOriginS3OriginConfig x
-> AwsCloudFrontDistributionOriginS3OriginConfig
forall x.
AwsCloudFrontDistributionOriginS3OriginConfig
-> Rep AwsCloudFrontDistributionOriginS3OriginConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudFrontDistributionOriginS3OriginConfig x
-> AwsCloudFrontDistributionOriginS3OriginConfig
$cfrom :: forall x.
AwsCloudFrontDistributionOriginS3OriginConfig
-> Rep AwsCloudFrontDistributionOriginS3OriginConfig x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudFrontDistributionOriginS3OriginConfig' 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:
--
-- 'originAccessIdentity', 'awsCloudFrontDistributionOriginS3OriginConfig_originAccessIdentity' - The CloudFront origin access identity to associate with the origin.
newAwsCloudFrontDistributionOriginS3OriginConfig ::
  AwsCloudFrontDistributionOriginS3OriginConfig
newAwsCloudFrontDistributionOriginS3OriginConfig :: AwsCloudFrontDistributionOriginS3OriginConfig
newAwsCloudFrontDistributionOriginS3OriginConfig =
  AwsCloudFrontDistributionOriginS3OriginConfig' :: Maybe Text -> AwsCloudFrontDistributionOriginS3OriginConfig
AwsCloudFrontDistributionOriginS3OriginConfig'
    { $sel:originAccessIdentity:AwsCloudFrontDistributionOriginS3OriginConfig' :: Maybe Text
originAccessIdentity =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The CloudFront origin access identity to associate with the origin.
awsCloudFrontDistributionOriginS3OriginConfig_originAccessIdentity :: Lens.Lens' AwsCloudFrontDistributionOriginS3OriginConfig (Prelude.Maybe Prelude.Text)
awsCloudFrontDistributionOriginS3OriginConfig_originAccessIdentity :: (Maybe Text -> f (Maybe Text))
-> AwsCloudFrontDistributionOriginS3OriginConfig
-> f AwsCloudFrontDistributionOriginS3OriginConfig
awsCloudFrontDistributionOriginS3OriginConfig_originAccessIdentity = (AwsCloudFrontDistributionOriginS3OriginConfig -> Maybe Text)
-> (AwsCloudFrontDistributionOriginS3OriginConfig
    -> Maybe Text -> AwsCloudFrontDistributionOriginS3OriginConfig)
-> Lens
     AwsCloudFrontDistributionOriginS3OriginConfig
     AwsCloudFrontDistributionOriginS3OriginConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginS3OriginConfig' {Maybe Text
originAccessIdentity :: Maybe Text
$sel:originAccessIdentity:AwsCloudFrontDistributionOriginS3OriginConfig' :: AwsCloudFrontDistributionOriginS3OriginConfig -> Maybe Text
originAccessIdentity} -> Maybe Text
originAccessIdentity) (\s :: AwsCloudFrontDistributionOriginS3OriginConfig
s@AwsCloudFrontDistributionOriginS3OriginConfig' {} Maybe Text
a -> AwsCloudFrontDistributionOriginS3OriginConfig
s {$sel:originAccessIdentity:AwsCloudFrontDistributionOriginS3OriginConfig' :: Maybe Text
originAccessIdentity = Maybe Text
a} :: AwsCloudFrontDistributionOriginS3OriginConfig)

instance
  Core.FromJSON
    AwsCloudFrontDistributionOriginS3OriginConfig
  where
  parseJSON :: Value -> Parser AwsCloudFrontDistributionOriginS3OriginConfig
parseJSON =
    String
-> (Object -> Parser AwsCloudFrontDistributionOriginS3OriginConfig)
-> Value
-> Parser AwsCloudFrontDistributionOriginS3OriginConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCloudFrontDistributionOriginS3OriginConfig"
      ( \Object
x ->
          Maybe Text -> AwsCloudFrontDistributionOriginS3OriginConfig
AwsCloudFrontDistributionOriginS3OriginConfig'
            (Maybe Text -> AwsCloudFrontDistributionOriginS3OriginConfig)
-> Parser (Maybe Text)
-> Parser AwsCloudFrontDistributionOriginS3OriginConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OriginAccessIdentity")
      )

instance
  Prelude.Hashable
    AwsCloudFrontDistributionOriginS3OriginConfig

instance
  Prelude.NFData
    AwsCloudFrontDistributionOriginS3OriginConfig

instance
  Core.ToJSON
    AwsCloudFrontDistributionOriginS3OriginConfig
  where
  toJSON :: AwsCloudFrontDistributionOriginS3OriginConfig -> Value
toJSON
    AwsCloudFrontDistributionOriginS3OriginConfig' {Maybe Text
originAccessIdentity :: Maybe Text
$sel:originAccessIdentity:AwsCloudFrontDistributionOriginS3OriginConfig' :: AwsCloudFrontDistributionOriginS3OriginConfig -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"OriginAccessIdentity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
                (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
originAccessIdentity
            ]
        )