{-# 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.WebsiteConfiguration 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.ErrorDocument
import Amazonka.S3.Types.IndexDocument
import Amazonka.S3.Types.RedirectAllRequestsTo
import Amazonka.S3.Types.RoutingRule
data WebsiteConfiguration = WebsiteConfiguration'
{
WebsiteConfiguration -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo :: Prelude.Maybe RedirectAllRequestsTo,
WebsiteConfiguration -> Maybe ErrorDocument
errorDocument :: Prelude.Maybe ErrorDocument,
WebsiteConfiguration -> Maybe IndexDocument
indexDocument :: Prelude.Maybe IndexDocument,
WebsiteConfiguration -> Maybe [RoutingRule]
routingRules :: Prelude.Maybe [RoutingRule]
}
deriving (WebsiteConfiguration -> WebsiteConfiguration -> Bool
(WebsiteConfiguration -> WebsiteConfiguration -> Bool)
-> (WebsiteConfiguration -> WebsiteConfiguration -> Bool)
-> Eq WebsiteConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WebsiteConfiguration -> WebsiteConfiguration -> Bool
$c/= :: WebsiteConfiguration -> WebsiteConfiguration -> Bool
== :: WebsiteConfiguration -> WebsiteConfiguration -> Bool
$c== :: WebsiteConfiguration -> WebsiteConfiguration -> Bool
Prelude.Eq, ReadPrec [WebsiteConfiguration]
ReadPrec WebsiteConfiguration
Int -> ReadS WebsiteConfiguration
ReadS [WebsiteConfiguration]
(Int -> ReadS WebsiteConfiguration)
-> ReadS [WebsiteConfiguration]
-> ReadPrec WebsiteConfiguration
-> ReadPrec [WebsiteConfiguration]
-> Read WebsiteConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WebsiteConfiguration]
$creadListPrec :: ReadPrec [WebsiteConfiguration]
readPrec :: ReadPrec WebsiteConfiguration
$creadPrec :: ReadPrec WebsiteConfiguration
readList :: ReadS [WebsiteConfiguration]
$creadList :: ReadS [WebsiteConfiguration]
readsPrec :: Int -> ReadS WebsiteConfiguration
$creadsPrec :: Int -> ReadS WebsiteConfiguration
Prelude.Read, Int -> WebsiteConfiguration -> ShowS
[WebsiteConfiguration] -> ShowS
WebsiteConfiguration -> String
(Int -> WebsiteConfiguration -> ShowS)
-> (WebsiteConfiguration -> String)
-> ([WebsiteConfiguration] -> ShowS)
-> Show WebsiteConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WebsiteConfiguration] -> ShowS
$cshowList :: [WebsiteConfiguration] -> ShowS
show :: WebsiteConfiguration -> String
$cshow :: WebsiteConfiguration -> String
showsPrec :: Int -> WebsiteConfiguration -> ShowS
$cshowsPrec :: Int -> WebsiteConfiguration -> ShowS
Prelude.Show, (forall x. WebsiteConfiguration -> Rep WebsiteConfiguration x)
-> (forall x. Rep WebsiteConfiguration x -> WebsiteConfiguration)
-> Generic WebsiteConfiguration
forall x. Rep WebsiteConfiguration x -> WebsiteConfiguration
forall x. WebsiteConfiguration -> Rep WebsiteConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WebsiteConfiguration x -> WebsiteConfiguration
$cfrom :: forall x. WebsiteConfiguration -> Rep WebsiteConfiguration x
Prelude.Generic)
newWebsiteConfiguration ::
WebsiteConfiguration
newWebsiteConfiguration :: WebsiteConfiguration
newWebsiteConfiguration =
WebsiteConfiguration' :: Maybe RedirectAllRequestsTo
-> Maybe ErrorDocument
-> Maybe IndexDocument
-> Maybe [RoutingRule]
-> WebsiteConfiguration
WebsiteConfiguration'
{ $sel:redirectAllRequestsTo:WebsiteConfiguration' :: Maybe RedirectAllRequestsTo
redirectAllRequestsTo =
Maybe RedirectAllRequestsTo
forall a. Maybe a
Prelude.Nothing,
$sel:errorDocument:WebsiteConfiguration' :: Maybe ErrorDocument
errorDocument = Maybe ErrorDocument
forall a. Maybe a
Prelude.Nothing,
$sel:indexDocument:WebsiteConfiguration' :: Maybe IndexDocument
indexDocument = Maybe IndexDocument
forall a. Maybe a
Prelude.Nothing,
$sel:routingRules:WebsiteConfiguration' :: Maybe [RoutingRule]
routingRules = Maybe [RoutingRule]
forall a. Maybe a
Prelude.Nothing
}
websiteConfiguration_redirectAllRequestsTo :: Lens.Lens' WebsiteConfiguration (Prelude.Maybe RedirectAllRequestsTo)
websiteConfiguration_redirectAllRequestsTo :: (Maybe RedirectAllRequestsTo -> f (Maybe RedirectAllRequestsTo))
-> WebsiteConfiguration -> f WebsiteConfiguration
websiteConfiguration_redirectAllRequestsTo = (WebsiteConfiguration -> Maybe RedirectAllRequestsTo)
-> (WebsiteConfiguration
-> Maybe RedirectAllRequestsTo -> WebsiteConfiguration)
-> Lens
WebsiteConfiguration
WebsiteConfiguration
(Maybe RedirectAllRequestsTo)
(Maybe RedirectAllRequestsTo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebsiteConfiguration' {Maybe RedirectAllRequestsTo
redirectAllRequestsTo :: Maybe RedirectAllRequestsTo
$sel:redirectAllRequestsTo:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo} -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo) (\s :: WebsiteConfiguration
s@WebsiteConfiguration' {} Maybe RedirectAllRequestsTo
a -> WebsiteConfiguration
s {$sel:redirectAllRequestsTo:WebsiteConfiguration' :: Maybe RedirectAllRequestsTo
redirectAllRequestsTo = Maybe RedirectAllRequestsTo
a} :: WebsiteConfiguration)
websiteConfiguration_errorDocument :: Lens.Lens' WebsiteConfiguration (Prelude.Maybe ErrorDocument)
websiteConfiguration_errorDocument :: (Maybe ErrorDocument -> f (Maybe ErrorDocument))
-> WebsiteConfiguration -> f WebsiteConfiguration
websiteConfiguration_errorDocument = (WebsiteConfiguration -> Maybe ErrorDocument)
-> (WebsiteConfiguration
-> Maybe ErrorDocument -> WebsiteConfiguration)
-> Lens
WebsiteConfiguration
WebsiteConfiguration
(Maybe ErrorDocument)
(Maybe ErrorDocument)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebsiteConfiguration' {Maybe ErrorDocument
errorDocument :: Maybe ErrorDocument
$sel:errorDocument:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe ErrorDocument
errorDocument} -> Maybe ErrorDocument
errorDocument) (\s :: WebsiteConfiguration
s@WebsiteConfiguration' {} Maybe ErrorDocument
a -> WebsiteConfiguration
s {$sel:errorDocument:WebsiteConfiguration' :: Maybe ErrorDocument
errorDocument = Maybe ErrorDocument
a} :: WebsiteConfiguration)
websiteConfiguration_indexDocument :: Lens.Lens' WebsiteConfiguration (Prelude.Maybe IndexDocument)
websiteConfiguration_indexDocument :: (Maybe IndexDocument -> f (Maybe IndexDocument))
-> WebsiteConfiguration -> f WebsiteConfiguration
websiteConfiguration_indexDocument = (WebsiteConfiguration -> Maybe IndexDocument)
-> (WebsiteConfiguration
-> Maybe IndexDocument -> WebsiteConfiguration)
-> Lens
WebsiteConfiguration
WebsiteConfiguration
(Maybe IndexDocument)
(Maybe IndexDocument)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebsiteConfiguration' {Maybe IndexDocument
indexDocument :: Maybe IndexDocument
$sel:indexDocument:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe IndexDocument
indexDocument} -> Maybe IndexDocument
indexDocument) (\s :: WebsiteConfiguration
s@WebsiteConfiguration' {} Maybe IndexDocument
a -> WebsiteConfiguration
s {$sel:indexDocument:WebsiteConfiguration' :: Maybe IndexDocument
indexDocument = Maybe IndexDocument
a} :: WebsiteConfiguration)
websiteConfiguration_routingRules :: Lens.Lens' WebsiteConfiguration (Prelude.Maybe [RoutingRule])
websiteConfiguration_routingRules :: (Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> WebsiteConfiguration -> f WebsiteConfiguration
websiteConfiguration_routingRules = (WebsiteConfiguration -> Maybe [RoutingRule])
-> (WebsiteConfiguration
-> Maybe [RoutingRule] -> WebsiteConfiguration)
-> Lens
WebsiteConfiguration
WebsiteConfiguration
(Maybe [RoutingRule])
(Maybe [RoutingRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WebsiteConfiguration' {Maybe [RoutingRule]
routingRules :: Maybe [RoutingRule]
$sel:routingRules:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe [RoutingRule]
routingRules} -> Maybe [RoutingRule]
routingRules) (\s :: WebsiteConfiguration
s@WebsiteConfiguration' {} Maybe [RoutingRule]
a -> WebsiteConfiguration
s {$sel:routingRules:WebsiteConfiguration' :: Maybe [RoutingRule]
routingRules = Maybe [RoutingRule]
a} :: WebsiteConfiguration) ((Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> WebsiteConfiguration -> f WebsiteConfiguration)
-> ((Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> (Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> WebsiteConfiguration
-> f WebsiteConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RoutingRule] [RoutingRule] [RoutingRule] [RoutingRule]
-> Iso
(Maybe [RoutingRule])
(Maybe [RoutingRule])
(Maybe [RoutingRule])
(Maybe [RoutingRule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [RoutingRule] [RoutingRule] [RoutingRule] [RoutingRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable WebsiteConfiguration
instance Prelude.NFData WebsiteConfiguration
instance Core.ToXML WebsiteConfiguration where
toXML :: WebsiteConfiguration -> XML
toXML WebsiteConfiguration' {Maybe [RoutingRule]
Maybe ErrorDocument
Maybe IndexDocument
Maybe RedirectAllRequestsTo
routingRules :: Maybe [RoutingRule]
indexDocument :: Maybe IndexDocument
errorDocument :: Maybe ErrorDocument
redirectAllRequestsTo :: Maybe RedirectAllRequestsTo
$sel:routingRules:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe [RoutingRule]
$sel:indexDocument:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe IndexDocument
$sel:errorDocument:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe ErrorDocument
$sel:redirectAllRequestsTo:WebsiteConfiguration' :: WebsiteConfiguration -> Maybe RedirectAllRequestsTo
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"RedirectAllRequestsTo"
Name -> Maybe RedirectAllRequestsTo -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe RedirectAllRequestsTo
redirectAllRequestsTo,
Name
"ErrorDocument" Name -> Maybe ErrorDocument -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ErrorDocument
errorDocument,
Name
"IndexDocument" Name -> Maybe IndexDocument -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe IndexDocument
indexDocument,
Name
"RoutingRules"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML
( Name -> [RoutingRule] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"RoutingRule"
([RoutingRule] -> XML) -> Maybe [RoutingRule] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RoutingRule]
routingRules
)
]