{-# 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.S3.Types.RedirectAllRequestsTo where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.Protocol
data RedirectAllRequestsTo = RedirectAllRequestsTo'
{
RedirectAllRequestsTo -> Maybe Protocol
protocol :: Prelude.Maybe Protocol,
RedirectAllRequestsTo -> Text
hostName :: Prelude.Text
}
deriving (RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool
(RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool)
-> (RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool)
-> Eq RedirectAllRequestsTo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool
$c/= :: RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool
== :: RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool
$c== :: RedirectAllRequestsTo -> RedirectAllRequestsTo -> Bool
Prelude.Eq, ReadPrec [RedirectAllRequestsTo]
ReadPrec RedirectAllRequestsTo
Int -> ReadS RedirectAllRequestsTo
ReadS [RedirectAllRequestsTo]
(Int -> ReadS RedirectAllRequestsTo)
-> ReadS [RedirectAllRequestsTo]
-> ReadPrec RedirectAllRequestsTo
-> ReadPrec [RedirectAllRequestsTo]
-> Read RedirectAllRequestsTo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RedirectAllRequestsTo]
$creadListPrec :: ReadPrec [RedirectAllRequestsTo]
readPrec :: ReadPrec RedirectAllRequestsTo
$creadPrec :: ReadPrec RedirectAllRequestsTo
readList :: ReadS [RedirectAllRequestsTo]
$creadList :: ReadS [RedirectAllRequestsTo]
readsPrec :: Int -> ReadS RedirectAllRequestsTo
$creadsPrec :: Int -> ReadS RedirectAllRequestsTo
Prelude.Read, Int -> RedirectAllRequestsTo -> ShowS
[RedirectAllRequestsTo] -> ShowS
RedirectAllRequestsTo -> String
(Int -> RedirectAllRequestsTo -> ShowS)
-> (RedirectAllRequestsTo -> String)
-> ([RedirectAllRequestsTo] -> ShowS)
-> Show RedirectAllRequestsTo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedirectAllRequestsTo] -> ShowS
$cshowList :: [RedirectAllRequestsTo] -> ShowS
show :: RedirectAllRequestsTo -> String
$cshow :: RedirectAllRequestsTo -> String
showsPrec :: Int -> RedirectAllRequestsTo -> ShowS
$cshowsPrec :: Int -> RedirectAllRequestsTo -> ShowS
Prelude.Show, (forall x. RedirectAllRequestsTo -> Rep RedirectAllRequestsTo x)
-> (forall x. Rep RedirectAllRequestsTo x -> RedirectAllRequestsTo)
-> Generic RedirectAllRequestsTo
forall x. Rep RedirectAllRequestsTo x -> RedirectAllRequestsTo
forall x. RedirectAllRequestsTo -> Rep RedirectAllRequestsTo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RedirectAllRequestsTo x -> RedirectAllRequestsTo
$cfrom :: forall x. RedirectAllRequestsTo -> Rep RedirectAllRequestsTo x
Prelude.Generic)
newRedirectAllRequestsTo ::
Prelude.Text ->
RedirectAllRequestsTo
newRedirectAllRequestsTo :: Text -> RedirectAllRequestsTo
newRedirectAllRequestsTo Text
pHostName_ =
RedirectAllRequestsTo' :: Maybe Protocol -> Text -> RedirectAllRequestsTo
RedirectAllRequestsTo'
{ $sel:protocol:RedirectAllRequestsTo' :: Maybe Protocol
protocol = Maybe Protocol
forall a. Maybe a
Prelude.Nothing,
$sel:hostName:RedirectAllRequestsTo' :: Text
hostName = Text
pHostName_
}
redirectAllRequestsTo_protocol :: Lens.Lens' RedirectAllRequestsTo (Prelude.Maybe Protocol)
redirectAllRequestsTo_protocol :: (Maybe Protocol -> f (Maybe Protocol))
-> RedirectAllRequestsTo -> f RedirectAllRequestsTo
redirectAllRequestsTo_protocol = (RedirectAllRequestsTo -> Maybe Protocol)
-> (RedirectAllRequestsTo
-> Maybe Protocol -> RedirectAllRequestsTo)
-> Lens
RedirectAllRequestsTo
RedirectAllRequestsTo
(Maybe Protocol)
(Maybe Protocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedirectAllRequestsTo' {Maybe Protocol
protocol :: Maybe Protocol
$sel:protocol:RedirectAllRequestsTo' :: RedirectAllRequestsTo -> Maybe Protocol
protocol} -> Maybe Protocol
protocol) (\s :: RedirectAllRequestsTo
s@RedirectAllRequestsTo' {} Maybe Protocol
a -> RedirectAllRequestsTo
s {$sel:protocol:RedirectAllRequestsTo' :: Maybe Protocol
protocol = Maybe Protocol
a} :: RedirectAllRequestsTo)
redirectAllRequestsTo_hostName :: Lens.Lens' RedirectAllRequestsTo Prelude.Text
redirectAllRequestsTo_hostName :: (Text -> f Text)
-> RedirectAllRequestsTo -> f RedirectAllRequestsTo
redirectAllRequestsTo_hostName = (RedirectAllRequestsTo -> Text)
-> (RedirectAllRequestsTo -> Text -> RedirectAllRequestsTo)
-> Lens RedirectAllRequestsTo RedirectAllRequestsTo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedirectAllRequestsTo' {Text
hostName :: Text
$sel:hostName:RedirectAllRequestsTo' :: RedirectAllRequestsTo -> Text
hostName} -> Text
hostName) (\s :: RedirectAllRequestsTo
s@RedirectAllRequestsTo' {} Text
a -> RedirectAllRequestsTo
s {$sel:hostName:RedirectAllRequestsTo' :: Text
hostName = Text
a} :: RedirectAllRequestsTo)
instance Core.FromXML RedirectAllRequestsTo where
parseXML :: [Node] -> Either String RedirectAllRequestsTo
parseXML [Node]
x =
Maybe Protocol -> Text -> RedirectAllRequestsTo
RedirectAllRequestsTo'
(Maybe Protocol -> Text -> RedirectAllRequestsTo)
-> Either String (Maybe Protocol)
-> Either String (Text -> RedirectAllRequestsTo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Protocol)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Protocol")
Either String (Text -> RedirectAllRequestsTo)
-> Either String Text -> Either String RedirectAllRequestsTo
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
"HostName")
instance Prelude.Hashable RedirectAllRequestsTo
instance Prelude.NFData RedirectAllRequestsTo
instance Core.ToXML RedirectAllRequestsTo where
toXML :: RedirectAllRequestsTo -> XML
toXML RedirectAllRequestsTo' {Maybe Protocol
Text
hostName :: Text
protocol :: Maybe Protocol
$sel:hostName:RedirectAllRequestsTo' :: RedirectAllRequestsTo -> Text
$sel:protocol:RedirectAllRequestsTo' :: RedirectAllRequestsTo -> Maybe Protocol
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Protocol" Name -> Maybe Protocol -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Protocol
protocol,
Name
"HostName" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
hostName
]