{-# 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.S3Origin where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3Origin = S3Origin'
{
S3Origin -> Text
domainName :: Prelude.Text,
S3Origin -> Text
originAccessIdentity :: Prelude.Text
}
deriving (S3Origin -> S3Origin -> Bool
(S3Origin -> S3Origin -> Bool)
-> (S3Origin -> S3Origin -> Bool) -> Eq S3Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Origin -> S3Origin -> Bool
$c/= :: S3Origin -> S3Origin -> Bool
== :: S3Origin -> S3Origin -> Bool
$c== :: S3Origin -> S3Origin -> Bool
Prelude.Eq, ReadPrec [S3Origin]
ReadPrec S3Origin
Int -> ReadS S3Origin
ReadS [S3Origin]
(Int -> ReadS S3Origin)
-> ReadS [S3Origin]
-> ReadPrec S3Origin
-> ReadPrec [S3Origin]
-> Read S3Origin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Origin]
$creadListPrec :: ReadPrec [S3Origin]
readPrec :: ReadPrec S3Origin
$creadPrec :: ReadPrec S3Origin
readList :: ReadS [S3Origin]
$creadList :: ReadS [S3Origin]
readsPrec :: Int -> ReadS S3Origin
$creadsPrec :: Int -> ReadS S3Origin
Prelude.Read, Int -> S3Origin -> ShowS
[S3Origin] -> ShowS
S3Origin -> String
(Int -> S3Origin -> ShowS)
-> (S3Origin -> String) -> ([S3Origin] -> ShowS) -> Show S3Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Origin] -> ShowS
$cshowList :: [S3Origin] -> ShowS
show :: S3Origin -> String
$cshow :: S3Origin -> String
showsPrec :: Int -> S3Origin -> ShowS
$cshowsPrec :: Int -> S3Origin -> ShowS
Prelude.Show, (forall x. S3Origin -> Rep S3Origin x)
-> (forall x. Rep S3Origin x -> S3Origin) -> Generic S3Origin
forall x. Rep S3Origin x -> S3Origin
forall x. S3Origin -> Rep S3Origin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Origin x -> S3Origin
$cfrom :: forall x. S3Origin -> Rep S3Origin x
Prelude.Generic)
newS3Origin ::
Prelude.Text ->
Prelude.Text ->
S3Origin
newS3Origin :: Text -> Text -> S3Origin
newS3Origin Text
pDomainName_ Text
pOriginAccessIdentity_ =
S3Origin' :: Text -> Text -> S3Origin
S3Origin'
{ $sel:domainName:S3Origin' :: Text
domainName = Text
pDomainName_,
$sel:originAccessIdentity:S3Origin' :: Text
originAccessIdentity = Text
pOriginAccessIdentity_
}
s3Origin_domainName :: Lens.Lens' S3Origin Prelude.Text
s3Origin_domainName :: (Text -> f Text) -> S3Origin -> f S3Origin
s3Origin_domainName = (S3Origin -> Text)
-> (S3Origin -> Text -> S3Origin)
-> Lens S3Origin S3Origin Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Origin' {Text
domainName :: Text
$sel:domainName:S3Origin' :: S3Origin -> Text
domainName} -> Text
domainName) (\s :: S3Origin
s@S3Origin' {} Text
a -> S3Origin
s {$sel:domainName:S3Origin' :: Text
domainName = Text
a} :: S3Origin)
s3Origin_originAccessIdentity :: Lens.Lens' S3Origin Prelude.Text
s3Origin_originAccessIdentity :: (Text -> f Text) -> S3Origin -> f S3Origin
s3Origin_originAccessIdentity = (S3Origin -> Text)
-> (S3Origin -> Text -> S3Origin)
-> Lens S3Origin S3Origin Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Origin' {Text
originAccessIdentity :: Text
$sel:originAccessIdentity:S3Origin' :: S3Origin -> Text
originAccessIdentity} -> Text
originAccessIdentity) (\s :: S3Origin
s@S3Origin' {} Text
a -> S3Origin
s {$sel:originAccessIdentity:S3Origin' :: Text
originAccessIdentity = Text
a} :: S3Origin)
instance Core.FromXML S3Origin where
parseXML :: [Node] -> Either String S3Origin
parseXML [Node]
x =
Text -> Text -> S3Origin
S3Origin'
(Text -> Text -> S3Origin)
-> Either String Text -> Either String (Text -> S3Origin)
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
"DomainName")
Either String (Text -> S3Origin)
-> Either String Text -> Either String S3Origin
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
"OriginAccessIdentity")
instance Prelude.Hashable S3Origin
instance Prelude.NFData S3Origin
instance Core.ToXML S3Origin where
toXML :: S3Origin -> XML
toXML S3Origin' {Text
originAccessIdentity :: Text
domainName :: Text
$sel:originAccessIdentity:S3Origin' :: S3Origin -> Text
$sel:domainName:S3Origin' :: S3Origin -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"DomainName" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
domainName,
Name
"OriginAccessIdentity" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
originAccessIdentity
]