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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsCloudFrontDistributionOriginS3OriginConfig

-- | A complex type that describes the S3 bucket, HTTP server (for example, a
-- web server), AWS Elemental MediaStore, or other server from which
-- CloudFront gets your files.
--
-- /See:/ 'newAwsCloudFrontDistributionOriginItem' smart constructor.
data AwsCloudFrontDistributionOriginItem = AwsCloudFrontDistributionOriginItem'
  { -- | An origin that is an S3 bucket that is not configured with static
    -- website hosting.
    AwsCloudFrontDistributionOriginItem
-> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig :: Prelude.Maybe AwsCloudFrontDistributionOriginS3OriginConfig,
    -- | An optional element that causes CloudFront to request your content from
    -- a directory in your Amazon S3 bucket or your custom origin.
    AwsCloudFrontDistributionOriginItem -> Maybe Text
originPath :: Prelude.Maybe Prelude.Text,
    -- | Amazon S3 origins: The DNS name of the S3 bucket from which you want
    -- CloudFront to get objects for this origin.
    AwsCloudFrontDistributionOriginItem -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the origin or origin group.
    AwsCloudFrontDistributionOriginItem -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsCloudFrontDistributionOriginItem
-> AwsCloudFrontDistributionOriginItem -> Bool
(AwsCloudFrontDistributionOriginItem
 -> AwsCloudFrontDistributionOriginItem -> Bool)
-> (AwsCloudFrontDistributionOriginItem
    -> AwsCloudFrontDistributionOriginItem -> Bool)
-> Eq AwsCloudFrontDistributionOriginItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudFrontDistributionOriginItem
-> AwsCloudFrontDistributionOriginItem -> Bool
$c/= :: AwsCloudFrontDistributionOriginItem
-> AwsCloudFrontDistributionOriginItem -> Bool
== :: AwsCloudFrontDistributionOriginItem
-> AwsCloudFrontDistributionOriginItem -> Bool
$c== :: AwsCloudFrontDistributionOriginItem
-> AwsCloudFrontDistributionOriginItem -> Bool
Prelude.Eq, ReadPrec [AwsCloudFrontDistributionOriginItem]
ReadPrec AwsCloudFrontDistributionOriginItem
Int -> ReadS AwsCloudFrontDistributionOriginItem
ReadS [AwsCloudFrontDistributionOriginItem]
(Int -> ReadS AwsCloudFrontDistributionOriginItem)
-> ReadS [AwsCloudFrontDistributionOriginItem]
-> ReadPrec AwsCloudFrontDistributionOriginItem
-> ReadPrec [AwsCloudFrontDistributionOriginItem]
-> Read AwsCloudFrontDistributionOriginItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudFrontDistributionOriginItem]
$creadListPrec :: ReadPrec [AwsCloudFrontDistributionOriginItem]
readPrec :: ReadPrec AwsCloudFrontDistributionOriginItem
$creadPrec :: ReadPrec AwsCloudFrontDistributionOriginItem
readList :: ReadS [AwsCloudFrontDistributionOriginItem]
$creadList :: ReadS [AwsCloudFrontDistributionOriginItem]
readsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginItem
$creadsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginItem
Prelude.Read, Int -> AwsCloudFrontDistributionOriginItem -> ShowS
[AwsCloudFrontDistributionOriginItem] -> ShowS
AwsCloudFrontDistributionOriginItem -> String
(Int -> AwsCloudFrontDistributionOriginItem -> ShowS)
-> (AwsCloudFrontDistributionOriginItem -> String)
-> ([AwsCloudFrontDistributionOriginItem] -> ShowS)
-> Show AwsCloudFrontDistributionOriginItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudFrontDistributionOriginItem] -> ShowS
$cshowList :: [AwsCloudFrontDistributionOriginItem] -> ShowS
show :: AwsCloudFrontDistributionOriginItem -> String
$cshow :: AwsCloudFrontDistributionOriginItem -> String
showsPrec :: Int -> AwsCloudFrontDistributionOriginItem -> ShowS
$cshowsPrec :: Int -> AwsCloudFrontDistributionOriginItem -> ShowS
Prelude.Show, (forall x.
 AwsCloudFrontDistributionOriginItem
 -> Rep AwsCloudFrontDistributionOriginItem x)
-> (forall x.
    Rep AwsCloudFrontDistributionOriginItem x
    -> AwsCloudFrontDistributionOriginItem)
-> Generic AwsCloudFrontDistributionOriginItem
forall x.
Rep AwsCloudFrontDistributionOriginItem x
-> AwsCloudFrontDistributionOriginItem
forall x.
AwsCloudFrontDistributionOriginItem
-> Rep AwsCloudFrontDistributionOriginItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudFrontDistributionOriginItem x
-> AwsCloudFrontDistributionOriginItem
$cfrom :: forall x.
AwsCloudFrontDistributionOriginItem
-> Rep AwsCloudFrontDistributionOriginItem x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudFrontDistributionOriginItem' 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:
--
-- 's3OriginConfig', 'awsCloudFrontDistributionOriginItem_s3OriginConfig' - An origin that is an S3 bucket that is not configured with static
-- website hosting.
--
-- 'originPath', 'awsCloudFrontDistributionOriginItem_originPath' - An optional element that causes CloudFront to request your content from
-- a directory in your Amazon S3 bucket or your custom origin.
--
-- 'domainName', 'awsCloudFrontDistributionOriginItem_domainName' - Amazon S3 origins: The DNS name of the S3 bucket from which you want
-- CloudFront to get objects for this origin.
--
-- 'id', 'awsCloudFrontDistributionOriginItem_id' - A unique identifier for the origin or origin group.
newAwsCloudFrontDistributionOriginItem ::
  AwsCloudFrontDistributionOriginItem
newAwsCloudFrontDistributionOriginItem :: AwsCloudFrontDistributionOriginItem
newAwsCloudFrontDistributionOriginItem =
  AwsCloudFrontDistributionOriginItem' :: Maybe AwsCloudFrontDistributionOriginS3OriginConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsCloudFrontDistributionOriginItem
AwsCloudFrontDistributionOriginItem'
    { $sel:s3OriginConfig:AwsCloudFrontDistributionOriginItem' :: Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig =
        Maybe AwsCloudFrontDistributionOriginS3OriginConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:originPath:AwsCloudFrontDistributionOriginItem' :: Maybe Text
originPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:AwsCloudFrontDistributionOriginItem' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:AwsCloudFrontDistributionOriginItem' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An origin that is an S3 bucket that is not configured with static
-- website hosting.
awsCloudFrontDistributionOriginItem_s3OriginConfig :: Lens.Lens' AwsCloudFrontDistributionOriginItem (Prelude.Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
awsCloudFrontDistributionOriginItem_s3OriginConfig :: (Maybe AwsCloudFrontDistributionOriginS3OriginConfig
 -> f (Maybe AwsCloudFrontDistributionOriginS3OriginConfig))
-> AwsCloudFrontDistributionOriginItem
-> f AwsCloudFrontDistributionOriginItem
awsCloudFrontDistributionOriginItem_s3OriginConfig = (AwsCloudFrontDistributionOriginItem
 -> Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
-> (AwsCloudFrontDistributionOriginItem
    -> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
    -> AwsCloudFrontDistributionOriginItem)
-> Lens
     AwsCloudFrontDistributionOriginItem
     AwsCloudFrontDistributionOriginItem
     (Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
     (Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginItem' {Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig :: Maybe AwsCloudFrontDistributionOriginS3OriginConfig
$sel:s3OriginConfig:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem
-> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig} -> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig) (\s :: AwsCloudFrontDistributionOriginItem
s@AwsCloudFrontDistributionOriginItem' {} Maybe AwsCloudFrontDistributionOriginS3OriginConfig
a -> AwsCloudFrontDistributionOriginItem
s {$sel:s3OriginConfig:AwsCloudFrontDistributionOriginItem' :: Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig = Maybe AwsCloudFrontDistributionOriginS3OriginConfig
a} :: AwsCloudFrontDistributionOriginItem)

-- | An optional element that causes CloudFront to request your content from
-- a directory in your Amazon S3 bucket or your custom origin.
awsCloudFrontDistributionOriginItem_originPath :: Lens.Lens' AwsCloudFrontDistributionOriginItem (Prelude.Maybe Prelude.Text)
awsCloudFrontDistributionOriginItem_originPath :: (Maybe Text -> f (Maybe Text))
-> AwsCloudFrontDistributionOriginItem
-> f AwsCloudFrontDistributionOriginItem
awsCloudFrontDistributionOriginItem_originPath = (AwsCloudFrontDistributionOriginItem -> Maybe Text)
-> (AwsCloudFrontDistributionOriginItem
    -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Lens
     AwsCloudFrontDistributionOriginItem
     AwsCloudFrontDistributionOriginItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginItem' {Maybe Text
originPath :: Maybe Text
$sel:originPath:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
originPath} -> Maybe Text
originPath) (\s :: AwsCloudFrontDistributionOriginItem
s@AwsCloudFrontDistributionOriginItem' {} Maybe Text
a -> AwsCloudFrontDistributionOriginItem
s {$sel:originPath:AwsCloudFrontDistributionOriginItem' :: Maybe Text
originPath = Maybe Text
a} :: AwsCloudFrontDistributionOriginItem)

-- | Amazon S3 origins: The DNS name of the S3 bucket from which you want
-- CloudFront to get objects for this origin.
awsCloudFrontDistributionOriginItem_domainName :: Lens.Lens' AwsCloudFrontDistributionOriginItem (Prelude.Maybe Prelude.Text)
awsCloudFrontDistributionOriginItem_domainName :: (Maybe Text -> f (Maybe Text))
-> AwsCloudFrontDistributionOriginItem
-> f AwsCloudFrontDistributionOriginItem
awsCloudFrontDistributionOriginItem_domainName = (AwsCloudFrontDistributionOriginItem -> Maybe Text)
-> (AwsCloudFrontDistributionOriginItem
    -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Lens
     AwsCloudFrontDistributionOriginItem
     AwsCloudFrontDistributionOriginItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginItem' {Maybe Text
domainName :: Maybe Text
$sel:domainName:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: AwsCloudFrontDistributionOriginItem
s@AwsCloudFrontDistributionOriginItem' {} Maybe Text
a -> AwsCloudFrontDistributionOriginItem
s {$sel:domainName:AwsCloudFrontDistributionOriginItem' :: Maybe Text
domainName = Maybe Text
a} :: AwsCloudFrontDistributionOriginItem)

-- | A unique identifier for the origin or origin group.
awsCloudFrontDistributionOriginItem_id :: Lens.Lens' AwsCloudFrontDistributionOriginItem (Prelude.Maybe Prelude.Text)
awsCloudFrontDistributionOriginItem_id :: (Maybe Text -> f (Maybe Text))
-> AwsCloudFrontDistributionOriginItem
-> f AwsCloudFrontDistributionOriginItem
awsCloudFrontDistributionOriginItem_id = (AwsCloudFrontDistributionOriginItem -> Maybe Text)
-> (AwsCloudFrontDistributionOriginItem
    -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Lens
     AwsCloudFrontDistributionOriginItem
     AwsCloudFrontDistributionOriginItem
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginItem' {Maybe Text
id :: Maybe Text
$sel:id:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
id} -> Maybe Text
id) (\s :: AwsCloudFrontDistributionOriginItem
s@AwsCloudFrontDistributionOriginItem' {} Maybe Text
a -> AwsCloudFrontDistributionOriginItem
s {$sel:id:AwsCloudFrontDistributionOriginItem' :: Maybe Text
id = Maybe Text
a} :: AwsCloudFrontDistributionOriginItem)

instance
  Core.FromJSON
    AwsCloudFrontDistributionOriginItem
  where
  parseJSON :: Value -> Parser AwsCloudFrontDistributionOriginItem
parseJSON =
    String
-> (Object -> Parser AwsCloudFrontDistributionOriginItem)
-> Value
-> Parser AwsCloudFrontDistributionOriginItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCloudFrontDistributionOriginItem"
      ( \Object
x ->
          Maybe AwsCloudFrontDistributionOriginS3OriginConfig
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsCloudFrontDistributionOriginItem
AwsCloudFrontDistributionOriginItem'
            (Maybe AwsCloudFrontDistributionOriginS3OriginConfig
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AwsCloudFrontDistributionOriginItem)
-> Parser (Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe AwsCloudFrontDistributionOriginS3OriginConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3OriginConfig")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
forall (f :: * -> *) a b. Applicative f => 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
"OriginPath")
            Parser
  (Maybe Text -> Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsCloudFrontDistributionOriginItem)
forall (f :: * -> *) a b. Applicative f => 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
"DomainName")
            Parser (Maybe Text -> AwsCloudFrontDistributionOriginItem)
-> Parser (Maybe Text)
-> Parser AwsCloudFrontDistributionOriginItem
forall (f :: * -> *) a b. Applicative f => 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
"Id")
      )

instance
  Prelude.Hashable
    AwsCloudFrontDistributionOriginItem

instance
  Prelude.NFData
    AwsCloudFrontDistributionOriginItem

instance
  Core.ToJSON
    AwsCloudFrontDistributionOriginItem
  where
  toJSON :: AwsCloudFrontDistributionOriginItem -> Value
toJSON AwsCloudFrontDistributionOriginItem' {Maybe Text
Maybe AwsCloudFrontDistributionOriginS3OriginConfig
id :: Maybe Text
domainName :: Maybe Text
originPath :: Maybe Text
s3OriginConfig :: Maybe AwsCloudFrontDistributionOriginS3OriginConfig
$sel:id:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
$sel:domainName:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
$sel:originPath:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem -> Maybe Text
$sel:s3OriginConfig:AwsCloudFrontDistributionOriginItem' :: AwsCloudFrontDistributionOriginItem
-> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3OriginConfig" Text -> AwsCloudFrontDistributionOriginS3OriginConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AwsCloudFrontDistributionOriginS3OriginConfig -> Pair)
-> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsCloudFrontDistributionOriginS3OriginConfig
s3OriginConfig,
            (Text
"OriginPath" 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
originPath,
            (Text
"DomainName" 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
domainName,
            (Text
"Id" 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
id
          ]
      )