{-# 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 #-}
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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Origin = Origin'
{
:: Prelude.Maybe CustomHeaders,
Origin -> Maybe CustomOriginConfig
customOriginConfig :: Prelude.Maybe CustomOriginConfig,
Origin -> Maybe Int
connectionTimeout :: Prelude.Maybe Prelude.Int,
Origin -> Maybe Int
connectionAttempts :: Prelude.Maybe Prelude.Int,
Origin -> Maybe S3OriginConfig
s3OriginConfig :: Prelude.Maybe S3OriginConfig,
Origin -> Maybe Text
originPath :: Prelude.Maybe Prelude.Text,
Origin -> Maybe OriginShield
originShield :: Prelude.Maybe OriginShield,
Origin -> Text
id :: Prelude.Text,
Origin -> Text
domainName :: Prelude.Text
}
deriving (Origin -> Origin -> Bool
(Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool) -> Eq Origin
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, ReadPrec [Origin]
ReadPrec Origin
Int -> ReadS Origin
ReadS [Origin]
(Int -> ReadS Origin)
-> ReadS [Origin]
-> ReadPrec Origin
-> ReadPrec [Origin]
-> Read Origin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Origin]
$creadListPrec :: ReadPrec [Origin]
readPrec :: ReadPrec Origin
$creadPrec :: ReadPrec Origin
readList :: ReadS [Origin]
$creadList :: ReadS [Origin]
readsPrec :: Int -> ReadS Origin
$creadsPrec :: Int -> ReadS Origin
Prelude.Read, Int -> Origin -> ShowS
[Origin] -> ShowS
Origin -> String
(Int -> Origin -> ShowS)
-> (Origin -> String) -> ([Origin] -> ShowS) -> Show Origin
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. Origin -> Rep Origin x)
-> (forall x. Rep Origin x -> Origin) -> Generic Origin
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)
newOrigin ::
Prelude.Text ->
Prelude.Text ->
Origin
newOrigin :: Text -> Text -> Origin
newOrigin Text
pId_ Text
pDomainName_ =
Origin' :: Maybe CustomHeaders
-> Maybe CustomOriginConfig
-> Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin
Origin'
{ $sel:customHeaders:Origin' :: Maybe CustomHeaders
customHeaders = Maybe CustomHeaders
forall a. Maybe a
Prelude.Nothing,
$sel:customOriginConfig:Origin' :: Maybe CustomOriginConfig
customOriginConfig = Maybe CustomOriginConfig
forall a. Maybe a
Prelude.Nothing,
$sel:connectionTimeout:Origin' :: Maybe Int
connectionTimeout = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:connectionAttempts:Origin' :: Maybe Int
connectionAttempts = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:s3OriginConfig:Origin' :: Maybe S3OriginConfig
s3OriginConfig = Maybe S3OriginConfig
forall a. Maybe a
Prelude.Nothing,
$sel:originPath:Origin' :: Maybe Text
originPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:originShield:Origin' :: Maybe OriginShield
originShield = Maybe OriginShield
forall a. Maybe a
Prelude.Nothing,
$sel:id:Origin' :: Text
id = Text
pId_,
$sel:domainName:Origin' :: Text
domainName = Text
pDomainName_
}
origin_customHeaders :: Lens.Lens' Origin (Prelude.Maybe CustomHeaders)
= (Origin -> Maybe CustomHeaders)
-> (Origin -> Maybe CustomHeaders -> Origin)
-> Lens Origin Origin (Maybe CustomHeaders) (Maybe 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)
origin_customOriginConfig :: Lens.Lens' Origin (Prelude.Maybe CustomOriginConfig)
origin_customOriginConfig :: (Maybe CustomOriginConfig -> f (Maybe CustomOriginConfig))
-> Origin -> f Origin
origin_customOriginConfig = (Origin -> Maybe CustomOriginConfig)
-> (Origin -> Maybe CustomOriginConfig -> Origin)
-> Lens
Origin Origin (Maybe CustomOriginConfig) (Maybe 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)
origin_connectionTimeout :: Lens.Lens' Origin (Prelude.Maybe Prelude.Int)
origin_connectionTimeout :: (Maybe Int -> f (Maybe Int)) -> Origin -> f Origin
origin_connectionTimeout = (Origin -> Maybe Int)
-> (Origin -> Maybe Int -> Origin)
-> Lens Origin Origin (Maybe Int) (Maybe Int)
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)
origin_connectionAttempts :: Lens.Lens' Origin (Prelude.Maybe Prelude.Int)
origin_connectionAttempts :: (Maybe Int -> f (Maybe Int)) -> Origin -> f Origin
origin_connectionAttempts = (Origin -> Maybe Int)
-> (Origin -> Maybe Int -> Origin)
-> Lens Origin Origin (Maybe Int) (Maybe Int)
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)
origin_s3OriginConfig :: Lens.Lens' Origin (Prelude.Maybe S3OriginConfig)
origin_s3OriginConfig :: (Maybe S3OriginConfig -> f (Maybe S3OriginConfig))
-> Origin -> f Origin
origin_s3OriginConfig = (Origin -> Maybe S3OriginConfig)
-> (Origin -> Maybe S3OriginConfig -> Origin)
-> Lens Origin Origin (Maybe S3OriginConfig) (Maybe 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)
origin_originPath :: Lens.Lens' Origin (Prelude.Maybe Prelude.Text)
origin_originPath :: (Maybe Text -> f (Maybe Text)) -> Origin -> f Origin
origin_originPath = (Origin -> Maybe Text)
-> (Origin -> Maybe Text -> Origin)
-> Lens Origin Origin (Maybe Text) (Maybe Text)
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)
origin_originShield :: Lens.Lens' Origin (Prelude.Maybe OriginShield)
origin_originShield :: (Maybe OriginShield -> f (Maybe OriginShield))
-> Origin -> f Origin
origin_originShield = (Origin -> Maybe OriginShield)
-> (Origin -> Maybe OriginShield -> Origin)
-> Lens Origin Origin (Maybe OriginShield) (Maybe 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)
origin_id :: Lens.Lens' Origin Prelude.Text
origin_id :: (Text -> f Text) -> Origin -> f Origin
origin_id = (Origin -> Text)
-> (Origin -> Text -> Origin) -> Lens Origin Origin Text Text
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)
origin_domainName :: Lens.Lens' Origin Prelude.Text
origin_domainName :: (Text -> f Text) -> Origin -> f Origin
origin_domainName = (Origin -> Text)
-> (Origin -> Text -> Origin) -> Lens Origin Origin Text Text
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 Core.FromXML Origin where
parseXML :: [Node] -> Either String Origin
parseXML [Node]
x =
Maybe CustomHeaders
-> Maybe CustomOriginConfig
-> Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin
Origin'
(Maybe CustomHeaders
-> Maybe CustomOriginConfig
-> Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
-> Either String (Maybe CustomHeaders)
-> Either
String
(Maybe CustomOriginConfig
-> Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe CustomHeaders)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CustomHeaders")
Either
String
(Maybe CustomOriginConfig
-> Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
-> Either String (Maybe CustomOriginConfig)
-> Either
String
(Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe CustomOriginConfig)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CustomOriginConfig")
Either
String
(Maybe Int
-> Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
-> Either String (Maybe Int)
-> Either
String
(Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ConnectionTimeout")
Either
String
(Maybe Int
-> Maybe S3OriginConfig
-> Maybe Text
-> Maybe OriginShield
-> Text
-> Text
-> Origin)
-> Either String (Maybe Int)
-> Either
String
(Maybe S3OriginConfig
-> Maybe Text -> Maybe OriginShield -> Text -> Text -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ConnectionAttempts")
Either
String
(Maybe S3OriginConfig
-> Maybe Text -> Maybe OriginShield -> Text -> Text -> Origin)
-> Either String (Maybe S3OriginConfig)
-> Either
String (Maybe Text -> Maybe OriginShield -> Text -> Text -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe S3OriginConfig)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"S3OriginConfig")
Either
String (Maybe Text -> Maybe OriginShield -> Text -> Text -> Origin)
-> Either String (Maybe Text)
-> Either String (Maybe OriginShield -> Text -> Text -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginPath")
Either String (Maybe OriginShield -> Text -> Text -> Origin)
-> Either String (Maybe OriginShield)
-> Either String (Text -> Text -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe OriginShield)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginShield")
Either String (Text -> Text -> Origin)
-> Either String Text -> Either String (Text -> Origin)
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
"Id")
Either String (Text -> Origin)
-> Either String Text -> Either String Origin
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
"DomainName")
instance Prelude.Hashable Origin
instance Prelude.NFData Origin
instance Core.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
originShield :: Maybe OriginShield
originPath :: Maybe Text
s3OriginConfig :: Maybe S3OriginConfig
connectionAttempts :: Maybe Int
connectionTimeout :: Maybe Int
customOriginConfig :: Maybe CustomOriginConfig
customHeaders :: Maybe CustomHeaders
$sel:domainName:Origin' :: Origin -> Text
$sel:id:Origin' :: Origin -> Text
$sel:originShield:Origin' :: Origin -> Maybe OriginShield
$sel:originPath:Origin' :: Origin -> Maybe Text
$sel:s3OriginConfig:Origin' :: Origin -> Maybe S3OriginConfig
$sel:connectionAttempts:Origin' :: Origin -> Maybe Int
$sel:connectionTimeout:Origin' :: Origin -> Maybe Int
$sel:customOriginConfig:Origin' :: Origin -> Maybe CustomOriginConfig
$sel:customHeaders:Origin' :: Origin -> Maybe CustomHeaders
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"CustomHeaders" Name -> Maybe CustomHeaders -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe CustomHeaders
customHeaders,
Name
"CustomOriginConfig" Name -> Maybe CustomOriginConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe CustomOriginConfig
customOriginConfig,
Name
"ConnectionTimeout" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
connectionTimeout,
Name
"ConnectionAttempts" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
connectionAttempts,
Name
"S3OriginConfig" Name -> Maybe S3OriginConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe S3OriginConfig
s3OriginConfig,
Name
"OriginPath" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
originPath,
Name
"OriginShield" Name -> Maybe OriginShield -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe OriginShield
originShield,
Name
"Id" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
id,
Name
"DomainName" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
domainName
]