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

import Amazonka.CloudFront.Types.CustomHeaders
import Amazonka.CloudFront.Types.CustomOriginConfig
import Amazonka.CloudFront.Types.OriginShield
import Amazonka.CloudFront.Types.S3OriginConfig
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

-- | An origin.
--
-- An origin is the location where content is stored, and from which
-- CloudFront gets content to serve to viewers. To specify an origin:
--
-- -   Use @S3OriginConfig@ to specify an Amazon S3 bucket that is not
--     configured with static website hosting.
--
-- -   Use @CustomOriginConfig@ to specify all other kinds of origins,
--     including:
--
--     -   An Amazon S3 bucket that is configured with static website
--         hosting
--
--     -   An Elastic Load Balancing load balancer
--
--     -   An AWS Elemental MediaPackage endpoint
--
--     -   An AWS Elemental MediaStore container
--
--     -   Any other HTTP server, running on an Amazon EC2 instance or any
--         other kind of host
--
-- For the current maximum number of origins that you can specify per
-- distribution, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-web-distributions General Quotas on Web Distributions>
-- in the /Amazon CloudFront Developer Guide/ (quotas were formerly
-- referred to as limits).
--
-- /See:/ 'newOrigin' smart constructor.
data Origin = Origin'
  { -- | The number of times that CloudFront attempts to connect to the origin.
    -- The minimum number is 1, the maximum is 3, and the default (if you
    -- don\'t specify otherwise) is 3.
    --
    -- For a custom origin (including an Amazon S3 bucket that\'s configured
    -- with static website hosting), this value also specifies the number of
    -- times that CloudFront attempts to get a response from the origin, in the
    -- case of an
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-attempts Origin Connection Attempts>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe Int
connectionAttempts :: Prelude.Maybe Prelude.Int,
    -- | The number of seconds that CloudFront waits when trying to establish a
    -- connection to the origin. The minimum timeout is 1 second, the maximum
    -- is 10 seconds, and the default (if you don\'t specify otherwise) is 10
    -- seconds.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-timeout Origin Connection Timeout>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe Int
connectionTimeout :: Prelude.Maybe Prelude.Int,
    -- | A list of HTTP header names and values that CloudFront adds to the
    -- requests that it sends to the origin.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html Adding Custom Headers to Origin Requests>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe CustomHeaders
customHeaders :: Prelude.Maybe CustomHeaders,
    -- | Use this type to specify an origin that is not an Amazon S3 bucket, with
    -- one exception. If the Amazon S3 bucket is configured with static website
    -- hosting, use this type. If the Amazon S3 bucket is not configured with
    -- static website hosting, use the @S3OriginConfig@ type instead.
    Origin -> Maybe CustomOriginConfig
customOriginConfig :: Prelude.Maybe CustomOriginConfig,
    -- | The unique identifier of an origin access control for this origin.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html Restricting access to an Amazon S3 origin>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe Text
originAccessControlId :: Prelude.Maybe Prelude.Text,
    -- | An optional path that CloudFront appends to the origin domain name when
    -- CloudFront requests content from the origin.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginPath Origin Path>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe Text
originPath :: Prelude.Maybe Prelude.Text,
    -- | CloudFront Origin Shield. Using Origin Shield can help reduce the load
    -- on your origin.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html Using Origin Shield>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Maybe OriginShield
originShield :: Prelude.Maybe OriginShield,
    -- | Use this type to specify an origin that is an Amazon S3 bucket that is
    -- not configured with static website hosting. To specify any other type of
    -- origin, including an Amazon S3 bucket that is configured with static
    -- website hosting, use the @CustomOriginConfig@ type instead.
    Origin -> Maybe S3OriginConfig
s3OriginConfig :: Prelude.Maybe S3OriginConfig,
    -- | A unique identifier for the origin. This value must be unique within the
    -- distribution.
    --
    -- Use this value to specify the @TargetOriginId@ in a @CacheBehavior@ or
    -- @DefaultCacheBehavior@.
    Origin -> Text
id :: Prelude.Text,
    -- | The domain name for the origin.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesDomainName Origin Domain Name>
    -- in the /Amazon CloudFront Developer Guide/.
    Origin -> Text
domainName :: Prelude.Text
  }
  deriving (Origin -> Origin -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Origin -> Origin -> Bool
$c/= :: Origin -> Origin -> Bool
== :: Origin -> Origin -> Bool
$c== :: Origin -> Origin -> Bool
Prelude.Eq, Int -> Origin -> ShowS
[Origin] -> ShowS
Origin -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Origin] -> ShowS
$cshowList :: [Origin] -> ShowS
show :: Origin -> String
$cshow :: Origin -> String
showsPrec :: Int -> Origin -> ShowS
$cshowsPrec :: Int -> Origin -> ShowS
Prelude.Show, forall x. Rep Origin x -> Origin
forall x. Origin -> Rep Origin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Origin x -> Origin
$cfrom :: forall x. Origin -> Rep Origin x
Prelude.Generic)

-- |
-- Create a value of 'Origin' 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:
--
-- 'connectionAttempts', 'origin_connectionAttempts' - The number of times that CloudFront attempts to connect to the origin.
-- The minimum number is 1, the maximum is 3, and the default (if you
-- don\'t specify otherwise) is 3.
--
-- For a custom origin (including an Amazon S3 bucket that\'s configured
-- with static website hosting), this value also specifies the number of
-- times that CloudFront attempts to get a response from the origin, in the
-- case of an
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-attempts Origin Connection Attempts>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'connectionTimeout', 'origin_connectionTimeout' - The number of seconds that CloudFront waits when trying to establish a
-- connection to the origin. The minimum timeout is 1 second, the maximum
-- is 10 seconds, and the default (if you don\'t specify otherwise) is 10
-- seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-timeout Origin Connection Timeout>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'customHeaders', 'origin_customHeaders' - A list of HTTP header names and values that CloudFront adds to the
-- requests that it sends to the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html Adding Custom Headers to Origin Requests>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'customOriginConfig', 'origin_customOriginConfig' - Use this type to specify an origin that is not an Amazon S3 bucket, with
-- one exception. If the Amazon S3 bucket is configured with static website
-- hosting, use this type. If the Amazon S3 bucket is not configured with
-- static website hosting, use the @S3OriginConfig@ type instead.
--
-- 'originAccessControlId', 'origin_originAccessControlId' - The unique identifier of an origin access control for this origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html Restricting access to an Amazon S3 origin>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'originPath', 'origin_originPath' - An optional path that CloudFront appends to the origin domain name when
-- CloudFront requests content from the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginPath Origin Path>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'originShield', 'origin_originShield' - CloudFront Origin Shield. Using Origin Shield can help reduce the load
-- on your origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html Using Origin Shield>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 's3OriginConfig', 'origin_s3OriginConfig' - Use this type to specify an origin that is an Amazon S3 bucket that is
-- not configured with static website hosting. To specify any other type of
-- origin, including an Amazon S3 bucket that is configured with static
-- website hosting, use the @CustomOriginConfig@ type instead.
--
-- 'id', 'origin_id' - A unique identifier for the origin. This value must be unique within the
-- distribution.
--
-- Use this value to specify the @TargetOriginId@ in a @CacheBehavior@ or
-- @DefaultCacheBehavior@.
--
-- 'domainName', 'origin_domainName' - The domain name for the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesDomainName Origin Domain Name>
-- in the /Amazon CloudFront Developer Guide/.
newOrigin ::
  -- | 'id'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  Origin
newOrigin :: Text -> Text -> Origin
newOrigin Text
pId_ Text
pDomainName_ =
  Origin'
    { $sel:connectionAttempts:Origin' :: Maybe Int
connectionAttempts = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionTimeout:Origin' :: Maybe Int
connectionTimeout = forall a. Maybe a
Prelude.Nothing,
      $sel:customHeaders:Origin' :: Maybe CustomHeaders
customHeaders = forall a. Maybe a
Prelude.Nothing,
      $sel:customOriginConfig:Origin' :: Maybe CustomOriginConfig
customOriginConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:originAccessControlId:Origin' :: Maybe Text
originAccessControlId = forall a. Maybe a
Prelude.Nothing,
      $sel:originPath:Origin' :: Maybe Text
originPath = forall a. Maybe a
Prelude.Nothing,
      $sel:originShield:Origin' :: Maybe OriginShield
originShield = forall a. Maybe a
Prelude.Nothing,
      $sel:s3OriginConfig:Origin' :: Maybe S3OriginConfig
s3OriginConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Origin' :: Text
id = Text
pId_,
      $sel:domainName:Origin' :: Text
domainName = Text
pDomainName_
    }

-- | The number of times that CloudFront attempts to connect to the origin.
-- The minimum number is 1, the maximum is 3, and the default (if you
-- don\'t specify otherwise) is 3.
--
-- For a custom origin (including an Amazon S3 bucket that\'s configured
-- with static website hosting), this value also specifies the number of
-- times that CloudFront attempts to get a response from the origin, in the
-- case of an
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginResponseTimeout Origin Response Timeout>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-attempts Origin Connection Attempts>
-- in the /Amazon CloudFront Developer Guide/.
origin_connectionAttempts :: Lens.Lens' Origin (Prelude.Maybe Prelude.Int)
origin_connectionAttempts :: Lens' Origin (Maybe Int)
origin_connectionAttempts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe Int
connectionAttempts :: Maybe Int
$sel:connectionAttempts:Origin' :: Origin -> Maybe Int
connectionAttempts} -> Maybe Int
connectionAttempts) (\s :: Origin
s@Origin' {} Maybe Int
a -> Origin
s {$sel:connectionAttempts:Origin' :: Maybe Int
connectionAttempts = Maybe Int
a} :: Origin)

-- | The number of seconds that CloudFront waits when trying to establish a
-- connection to the origin. The minimum timeout is 1 second, the maximum
-- is 10 seconds, and the default (if you don\'t specify otherwise) is 10
-- seconds.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-timeout Origin Connection Timeout>
-- in the /Amazon CloudFront Developer Guide/.
origin_connectionTimeout :: Lens.Lens' Origin (Prelude.Maybe Prelude.Int)
origin_connectionTimeout :: Lens' Origin (Maybe Int)
origin_connectionTimeout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe Int
connectionTimeout :: Maybe Int
$sel:connectionTimeout:Origin' :: Origin -> Maybe Int
connectionTimeout} -> Maybe Int
connectionTimeout) (\s :: Origin
s@Origin' {} Maybe Int
a -> Origin
s {$sel:connectionTimeout:Origin' :: Maybe Int
connectionTimeout = Maybe Int
a} :: Origin)

-- | A list of HTTP header names and values that CloudFront adds to the
-- requests that it sends to the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html Adding Custom Headers to Origin Requests>
-- in the /Amazon CloudFront Developer Guide/.
origin_customHeaders :: Lens.Lens' Origin (Prelude.Maybe CustomHeaders)
origin_customHeaders :: Lens' Origin (Maybe CustomHeaders)
origin_customHeaders = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe CustomHeaders
customHeaders :: Maybe CustomHeaders
$sel:customHeaders:Origin' :: Origin -> Maybe CustomHeaders
customHeaders} -> Maybe CustomHeaders
customHeaders) (\s :: Origin
s@Origin' {} Maybe CustomHeaders
a -> Origin
s {$sel:customHeaders:Origin' :: Maybe CustomHeaders
customHeaders = Maybe CustomHeaders
a} :: Origin)

-- | Use this type to specify an origin that is not an Amazon S3 bucket, with
-- one exception. If the Amazon S3 bucket is configured with static website
-- hosting, use this type. If the Amazon S3 bucket is not configured with
-- static website hosting, use the @S3OriginConfig@ type instead.
origin_customOriginConfig :: Lens.Lens' Origin (Prelude.Maybe CustomOriginConfig)
origin_customOriginConfig :: Lens' Origin (Maybe CustomOriginConfig)
origin_customOriginConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe CustomOriginConfig
customOriginConfig :: Maybe CustomOriginConfig
$sel:customOriginConfig:Origin' :: Origin -> Maybe CustomOriginConfig
customOriginConfig} -> Maybe CustomOriginConfig
customOriginConfig) (\s :: Origin
s@Origin' {} Maybe CustomOriginConfig
a -> Origin
s {$sel:customOriginConfig:Origin' :: Maybe CustomOriginConfig
customOriginConfig = Maybe CustomOriginConfig
a} :: Origin)

-- | The unique identifier of an origin access control for this origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html Restricting access to an Amazon S3 origin>
-- in the /Amazon CloudFront Developer Guide/.
origin_originAccessControlId :: Lens.Lens' Origin (Prelude.Maybe Prelude.Text)
origin_originAccessControlId :: Lens' Origin (Maybe Text)
origin_originAccessControlId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe Text
originAccessControlId :: Maybe Text
$sel:originAccessControlId:Origin' :: Origin -> Maybe Text
originAccessControlId} -> Maybe Text
originAccessControlId) (\s :: Origin
s@Origin' {} Maybe Text
a -> Origin
s {$sel:originAccessControlId:Origin' :: Maybe Text
originAccessControlId = Maybe Text
a} :: Origin)

-- | An optional path that CloudFront appends to the origin domain name when
-- CloudFront requests content from the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginPath Origin Path>
-- in the /Amazon CloudFront Developer Guide/.
origin_originPath :: Lens.Lens' Origin (Prelude.Maybe Prelude.Text)
origin_originPath :: Lens' Origin (Maybe Text)
origin_originPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe Text
originPath :: Maybe Text
$sel:originPath:Origin' :: Origin -> Maybe Text
originPath} -> Maybe Text
originPath) (\s :: Origin
s@Origin' {} Maybe Text
a -> Origin
s {$sel:originPath:Origin' :: Maybe Text
originPath = Maybe Text
a} :: Origin)

-- | CloudFront Origin Shield. Using Origin Shield can help reduce the load
-- on your origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/origin-shield.html Using Origin Shield>
-- in the /Amazon CloudFront Developer Guide/.
origin_originShield :: Lens.Lens' Origin (Prelude.Maybe OriginShield)
origin_originShield :: Lens' Origin (Maybe OriginShield)
origin_originShield = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe OriginShield
originShield :: Maybe OriginShield
$sel:originShield:Origin' :: Origin -> Maybe OriginShield
originShield} -> Maybe OriginShield
originShield) (\s :: Origin
s@Origin' {} Maybe OriginShield
a -> Origin
s {$sel:originShield:Origin' :: Maybe OriginShield
originShield = Maybe OriginShield
a} :: Origin)

-- | Use this type to specify an origin that is an Amazon S3 bucket that is
-- not configured with static website hosting. To specify any other type of
-- origin, including an Amazon S3 bucket that is configured with static
-- website hosting, use the @CustomOriginConfig@ type instead.
origin_s3OriginConfig :: Lens.Lens' Origin (Prelude.Maybe S3OriginConfig)
origin_s3OriginConfig :: Lens' Origin (Maybe S3OriginConfig)
origin_s3OriginConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe S3OriginConfig
s3OriginConfig :: Maybe S3OriginConfig
$sel:s3OriginConfig:Origin' :: Origin -> Maybe S3OriginConfig
s3OriginConfig} -> Maybe S3OriginConfig
s3OriginConfig) (\s :: Origin
s@Origin' {} Maybe S3OriginConfig
a -> Origin
s {$sel:s3OriginConfig:Origin' :: Maybe S3OriginConfig
s3OriginConfig = Maybe S3OriginConfig
a} :: Origin)

-- | A unique identifier for the origin. This value must be unique within the
-- distribution.
--
-- Use this value to specify the @TargetOriginId@ in a @CacheBehavior@ or
-- @DefaultCacheBehavior@.
origin_id :: Lens.Lens' Origin Prelude.Text
origin_id :: Lens' Origin Text
origin_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Text
id :: Text
$sel:id:Origin' :: Origin -> Text
id} -> Text
id) (\s :: Origin
s@Origin' {} Text
a -> Origin
s {$sel:id:Origin' :: Text
id = Text
a} :: Origin)

-- | The domain name for the origin.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesDomainName Origin Domain Name>
-- in the /Amazon CloudFront Developer Guide/.
origin_domainName :: Lens.Lens' Origin Prelude.Text
origin_domainName :: Lens' Origin Text
origin_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Text
domainName :: Text
$sel:domainName:Origin' :: Origin -> Text
domainName} -> Text
domainName) (\s :: Origin
s@Origin' {} Text
a -> Origin
s {$sel:domainName:Origin' :: Text
domainName = Text
a} :: Origin)

instance Data.FromXML Origin where
  parseXML :: [Node] -> Either String Origin
parseXML [Node]
x =
    Maybe Int
-> Maybe Int
-> Maybe CustomHeaders
-> Maybe CustomOriginConfig
-> Maybe Text
-> Maybe Text
-> Maybe OriginShield
-> Maybe S3OriginConfig
-> Text
-> Text
-> Origin
Origin'
      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
"ConnectionAttempts")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ConnectionTimeout")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CustomHeaders")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CustomOriginConfig")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OriginAccessControlId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OriginPath")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OriginShield")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"S3OriginConfig")
      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
"DomainName")

instance Prelude.Hashable Origin where
  hashWithSalt :: Int -> Origin -> Int
hashWithSalt Int
_salt Origin' {Maybe Int
Maybe Text
Maybe CustomHeaders
Maybe OriginShield
Maybe S3OriginConfig
Maybe CustomOriginConfig
Text
domainName :: Text
id :: Text
s3OriginConfig :: Maybe S3OriginConfig
originShield :: Maybe OriginShield
originPath :: Maybe Text
originAccessControlId :: Maybe Text
customOriginConfig :: Maybe CustomOriginConfig
customHeaders :: Maybe CustomHeaders
connectionTimeout :: Maybe Int
connectionAttempts :: Maybe Int
$sel:domainName:Origin' :: Origin -> Text
$sel:id:Origin' :: Origin -> Text
$sel:s3OriginConfig:Origin' :: Origin -> Maybe S3OriginConfig
$sel:originShield:Origin' :: Origin -> Maybe OriginShield
$sel:originPath:Origin' :: Origin -> Maybe Text
$sel:originAccessControlId:Origin' :: Origin -> Maybe Text
$sel:customOriginConfig:Origin' :: Origin -> Maybe CustomOriginConfig
$sel:customHeaders:Origin' :: Origin -> Maybe CustomHeaders
$sel:connectionTimeout:Origin' :: Origin -> Maybe Int
$sel:connectionAttempts:Origin' :: Origin -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
connectionAttempts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
connectionTimeout
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomHeaders
customHeaders
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomOriginConfig
customOriginConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originAccessControlId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OriginShield
originShield
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3OriginConfig
s3OriginConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

instance Prelude.NFData Origin where
  rnf :: Origin -> ()
rnf Origin' {Maybe Int
Maybe Text
Maybe CustomHeaders
Maybe OriginShield
Maybe S3OriginConfig
Maybe CustomOriginConfig
Text
domainName :: Text
id :: Text
s3OriginConfig :: Maybe S3OriginConfig
originShield :: Maybe OriginShield
originPath :: Maybe Text
originAccessControlId :: Maybe Text
customOriginConfig :: Maybe CustomOriginConfig
customHeaders :: Maybe CustomHeaders
connectionTimeout :: Maybe Int
connectionAttempts :: Maybe Int
$sel:domainName:Origin' :: Origin -> Text
$sel:id:Origin' :: Origin -> Text
$sel:s3OriginConfig:Origin' :: Origin -> Maybe S3OriginConfig
$sel:originShield:Origin' :: Origin -> Maybe OriginShield
$sel:originPath:Origin' :: Origin -> Maybe Text
$sel:originAccessControlId:Origin' :: Origin -> Maybe Text
$sel:customOriginConfig:Origin' :: Origin -> Maybe CustomOriginConfig
$sel:customHeaders:Origin' :: Origin -> Maybe CustomHeaders
$sel:connectionTimeout:Origin' :: Origin -> Maybe Int
$sel:connectionAttempts:Origin' :: Origin -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
connectionAttempts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
connectionTimeout
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomHeaders
customHeaders
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomOriginConfig
customOriginConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originAccessControlId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OriginShield
originShield
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3OriginConfig
s3OriginConfig
      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
domainName

instance Data.ToXML Origin where
  toXML :: Origin -> XML
toXML Origin' {Maybe Int
Maybe Text
Maybe CustomHeaders
Maybe OriginShield
Maybe S3OriginConfig
Maybe CustomOriginConfig
Text
domainName :: Text
id :: Text
s3OriginConfig :: Maybe S3OriginConfig
originShield :: Maybe OriginShield
originPath :: Maybe Text
originAccessControlId :: Maybe Text
customOriginConfig :: Maybe CustomOriginConfig
customHeaders :: Maybe CustomHeaders
connectionTimeout :: Maybe Int
connectionAttempts :: Maybe Int
$sel:domainName:Origin' :: Origin -> Text
$sel:id:Origin' :: Origin -> Text
$sel:s3OriginConfig:Origin' :: Origin -> Maybe S3OriginConfig
$sel:originShield:Origin' :: Origin -> Maybe OriginShield
$sel:originPath:Origin' :: Origin -> Maybe Text
$sel:originAccessControlId:Origin' :: Origin -> Maybe Text
$sel:customOriginConfig:Origin' :: Origin -> Maybe CustomOriginConfig
$sel:customHeaders:Origin' :: Origin -> Maybe CustomHeaders
$sel:connectionTimeout:Origin' :: Origin -> Maybe Int
$sel:connectionAttempts:Origin' :: Origin -> Maybe Int
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"ConnectionAttempts" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Int
connectionAttempts,
        Name
"ConnectionTimeout" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Int
connectionTimeout,
        Name
"CustomHeaders" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe CustomHeaders
customHeaders,
        Name
"CustomOriginConfig" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe CustomOriginConfig
customOriginConfig,
        Name
"OriginAccessControlId"
          forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
originAccessControlId,
        Name
"OriginPath" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
originPath,
        Name
"OriginShield" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe OriginShield
originShield,
        Name
"S3OriginConfig" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe S3OriginConfig
s3OriginConfig,
        Name
"Id" forall a. ToXML a => Name -> a -> XML
Data.@= Text
id,
        Name
"DomainName" forall a. ToXML a => Name -> a -> XML
Data.@= Text
domainName
      ]