{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.S3.GetBucketWebsite
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the website configuration for a bucket. To host website on
-- Amazon S3, you can configure a bucket as website by adding a website
-- configuration. For more information about hosting websites, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html Hosting Websites on Amazon S3>.
--
-- This GET action requires the @S3:GetBucketWebsite@ permission. By
-- default, only the bucket owner can read the bucket website
-- configuration. However, bucket owners can allow other users to read the
-- website configuration by writing a bucket policy granting them the
-- @S3:GetBucketWebsite@ permission.
--
-- The following operations are related to @DeleteBucketWebsite@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketWebsite.html DeleteBucketWebsite>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketWebsite.html PutBucketWebsite>
module Amazonka.S3.GetBucketWebsite
  ( -- * Creating a Request
    GetBucketWebsite (..),
    newGetBucketWebsite,

    -- * Request Lenses
    getBucketWebsite_expectedBucketOwner,
    getBucketWebsite_bucket,

    -- * Destructuring the Response
    GetBucketWebsiteResponse (..),
    newGetBucketWebsiteResponse,

    -- * Response Lenses
    getBucketWebsiteResponse_redirectAllRequestsTo,
    getBucketWebsiteResponse_errorDocument,
    getBucketWebsiteResponse_indexDocument,
    getBucketWebsiteResponse_routingRules,
    getBucketWebsiteResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types

-- | /See:/ 'newGetBucketWebsite' smart constructor.
data GetBucketWebsite = GetBucketWebsite'
  { -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request will fail with an HTTP
    -- @403 (Access Denied)@ error.
    GetBucketWebsite -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The bucket name for which to get the website configuration.
    GetBucketWebsite -> BucketName
bucket :: BucketName
  }
  deriving (GetBucketWebsite -> GetBucketWebsite -> Bool
(GetBucketWebsite -> GetBucketWebsite -> Bool)
-> (GetBucketWebsite -> GetBucketWebsite -> Bool)
-> Eq GetBucketWebsite
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketWebsite -> GetBucketWebsite -> Bool
$c/= :: GetBucketWebsite -> GetBucketWebsite -> Bool
== :: GetBucketWebsite -> GetBucketWebsite -> Bool
$c== :: GetBucketWebsite -> GetBucketWebsite -> Bool
Prelude.Eq, ReadPrec [GetBucketWebsite]
ReadPrec GetBucketWebsite
Int -> ReadS GetBucketWebsite
ReadS [GetBucketWebsite]
(Int -> ReadS GetBucketWebsite)
-> ReadS [GetBucketWebsite]
-> ReadPrec GetBucketWebsite
-> ReadPrec [GetBucketWebsite]
-> Read GetBucketWebsite
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketWebsite]
$creadListPrec :: ReadPrec [GetBucketWebsite]
readPrec :: ReadPrec GetBucketWebsite
$creadPrec :: ReadPrec GetBucketWebsite
readList :: ReadS [GetBucketWebsite]
$creadList :: ReadS [GetBucketWebsite]
readsPrec :: Int -> ReadS GetBucketWebsite
$creadsPrec :: Int -> ReadS GetBucketWebsite
Prelude.Read, Int -> GetBucketWebsite -> ShowS
[GetBucketWebsite] -> ShowS
GetBucketWebsite -> String
(Int -> GetBucketWebsite -> ShowS)
-> (GetBucketWebsite -> String)
-> ([GetBucketWebsite] -> ShowS)
-> Show GetBucketWebsite
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketWebsite] -> ShowS
$cshowList :: [GetBucketWebsite] -> ShowS
show :: GetBucketWebsite -> String
$cshow :: GetBucketWebsite -> String
showsPrec :: Int -> GetBucketWebsite -> ShowS
$cshowsPrec :: Int -> GetBucketWebsite -> ShowS
Prelude.Show, (forall x. GetBucketWebsite -> Rep GetBucketWebsite x)
-> (forall x. Rep GetBucketWebsite x -> GetBucketWebsite)
-> Generic GetBucketWebsite
forall x. Rep GetBucketWebsite x -> GetBucketWebsite
forall x. GetBucketWebsite -> Rep GetBucketWebsite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBucketWebsite x -> GetBucketWebsite
$cfrom :: forall x. GetBucketWebsite -> Rep GetBucketWebsite x
Prelude.Generic)

-- |
-- Create a value of 'GetBucketWebsite' 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:
--
-- 'expectedBucketOwner', 'getBucketWebsite_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- 'bucket', 'getBucketWebsite_bucket' - The bucket name for which to get the website configuration.
newGetBucketWebsite ::
  -- | 'bucket'
  BucketName ->
  GetBucketWebsite
newGetBucketWebsite :: BucketName -> GetBucketWebsite
newGetBucketWebsite BucketName
pBucket_ =
  GetBucketWebsite' :: Maybe Text -> BucketName -> GetBucketWebsite
GetBucketWebsite'
    { $sel:expectedBucketOwner:GetBucketWebsite' :: Maybe Text
expectedBucketOwner =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:GetBucketWebsite' :: BucketName
bucket = BucketName
pBucket_
    }

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
getBucketWebsite_expectedBucketOwner :: Lens.Lens' GetBucketWebsite (Prelude.Maybe Prelude.Text)
getBucketWebsite_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketWebsite -> f GetBucketWebsite
getBucketWebsite_expectedBucketOwner = (GetBucketWebsite -> Maybe Text)
-> (GetBucketWebsite -> Maybe Text -> GetBucketWebsite)
-> Lens GetBucketWebsite GetBucketWebsite (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsite' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketWebsite' :: GetBucketWebsite -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketWebsite
s@GetBucketWebsite' {} Maybe Text
a -> GetBucketWebsite
s {$sel:expectedBucketOwner:GetBucketWebsite' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketWebsite)

-- | The bucket name for which to get the website configuration.
getBucketWebsite_bucket :: Lens.Lens' GetBucketWebsite BucketName
getBucketWebsite_bucket :: (BucketName -> f BucketName)
-> GetBucketWebsite -> f GetBucketWebsite
getBucketWebsite_bucket = (GetBucketWebsite -> BucketName)
-> (GetBucketWebsite -> BucketName -> GetBucketWebsite)
-> Lens GetBucketWebsite GetBucketWebsite BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsite' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketWebsite' :: GetBucketWebsite -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketWebsite
s@GetBucketWebsite' {} BucketName
a -> GetBucketWebsite
s {$sel:bucket:GetBucketWebsite' :: BucketName
bucket = BucketName
a} :: GetBucketWebsite)

instance Core.AWSRequest GetBucketWebsite where
  type
    AWSResponse GetBucketWebsite =
      GetBucketWebsiteResponse
  request :: GetBucketWebsite -> Request GetBucketWebsite
request =
    Request GetBucketWebsite -> Request GetBucketWebsite
forall a. Request a -> Request a
Request.s3vhost
      (Request GetBucketWebsite -> Request GetBucketWebsite)
-> (GetBucketWebsite -> Request GetBucketWebsite)
-> GetBucketWebsite
-> Request GetBucketWebsite
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetBucketWebsite -> Request GetBucketWebsite
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetBucketWebsite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBucketWebsite)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse GetBucketWebsite))
-> Logger
-> Service
-> Proxy GetBucketWebsite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBucketWebsite)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe RedirectAllRequestsTo
-> Maybe ErrorDocument
-> Maybe IndexDocument
-> Maybe [RoutingRule]
-> Int
-> GetBucketWebsiteResponse
GetBucketWebsiteResponse'
            (Maybe RedirectAllRequestsTo
 -> Maybe ErrorDocument
 -> Maybe IndexDocument
 -> Maybe [RoutingRule]
 -> Int
 -> GetBucketWebsiteResponse)
-> Either String (Maybe RedirectAllRequestsTo)
-> Either
     String
     (Maybe ErrorDocument
      -> Maybe IndexDocument
      -> Maybe [RoutingRule]
      -> Int
      -> GetBucketWebsiteResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe RedirectAllRequestsTo)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RedirectAllRequestsTo")
            Either
  String
  (Maybe ErrorDocument
   -> Maybe IndexDocument
   -> Maybe [RoutingRule]
   -> Int
   -> GetBucketWebsiteResponse)
-> Either String (Maybe ErrorDocument)
-> Either
     String
     (Maybe IndexDocument
      -> Maybe [RoutingRule] -> Int -> GetBucketWebsiteResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ErrorDocument)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ErrorDocument")
            Either
  String
  (Maybe IndexDocument
   -> Maybe [RoutingRule] -> Int -> GetBucketWebsiteResponse)
-> Either String (Maybe IndexDocument)
-> Either
     String (Maybe [RoutingRule] -> Int -> GetBucketWebsiteResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe IndexDocument)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IndexDocument")
            Either
  String (Maybe [RoutingRule] -> Int -> GetBucketWebsiteResponse)
-> Either String (Maybe [RoutingRule])
-> Either String (Int -> GetBucketWebsiteResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RoutingRules" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [RoutingRule]))
-> Either String (Maybe [RoutingRule])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [RoutingRule])
-> [Node] -> Either String (Maybe [RoutingRule])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [RoutingRule]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"RoutingRule")
                        )
            Either String (Int -> GetBucketWebsiteResponse)
-> Either String Int -> Either String GetBucketWebsiteResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetBucketWebsite

instance Prelude.NFData GetBucketWebsite

instance Core.ToHeaders GetBucketWebsite where
  toHeaders :: GetBucketWebsite -> ResponseHeaders
toHeaders GetBucketWebsite' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketWebsite' :: GetBucketWebsite -> BucketName
$sel:expectedBucketOwner:GetBucketWebsite' :: GetBucketWebsite -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-expected-bucket-owner"
          HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
      ]

instance Core.ToPath GetBucketWebsite where
  toPath :: GetBucketWebsite -> ByteString
toPath GetBucketWebsite' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketWebsite' :: GetBucketWebsite -> BucketName
$sel:expectedBucketOwner:GetBucketWebsite' :: GetBucketWebsite -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]

instance Core.ToQuery GetBucketWebsite where
  toQuery :: GetBucketWebsite -> QueryString
toQuery = QueryString -> GetBucketWebsite -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"website"])

-- | /See:/ 'newGetBucketWebsiteResponse' smart constructor.
data GetBucketWebsiteResponse = GetBucketWebsiteResponse'
  { -- | Specifies the redirect behavior of all requests to a website endpoint of
    -- an Amazon S3 bucket.
    GetBucketWebsiteResponse -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo :: Prelude.Maybe RedirectAllRequestsTo,
    -- | The object key name of the website error document to use for 4XX class
    -- errors.
    GetBucketWebsiteResponse -> Maybe ErrorDocument
errorDocument :: Prelude.Maybe ErrorDocument,
    -- | The name of the index document for the website (for example
    -- @index.html@).
    GetBucketWebsiteResponse -> Maybe IndexDocument
indexDocument :: Prelude.Maybe IndexDocument,
    -- | Rules that define when a redirect is applied and the redirect behavior.
    GetBucketWebsiteResponse -> Maybe [RoutingRule]
routingRules :: Prelude.Maybe [RoutingRule],
    -- | The response's http status code.
    GetBucketWebsiteResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool
(GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool)
-> (GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool)
-> Eq GetBucketWebsiteResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool
$c/= :: GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool
== :: GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool
$c== :: GetBucketWebsiteResponse -> GetBucketWebsiteResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketWebsiteResponse]
ReadPrec GetBucketWebsiteResponse
Int -> ReadS GetBucketWebsiteResponse
ReadS [GetBucketWebsiteResponse]
(Int -> ReadS GetBucketWebsiteResponse)
-> ReadS [GetBucketWebsiteResponse]
-> ReadPrec GetBucketWebsiteResponse
-> ReadPrec [GetBucketWebsiteResponse]
-> Read GetBucketWebsiteResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketWebsiteResponse]
$creadListPrec :: ReadPrec [GetBucketWebsiteResponse]
readPrec :: ReadPrec GetBucketWebsiteResponse
$creadPrec :: ReadPrec GetBucketWebsiteResponse
readList :: ReadS [GetBucketWebsiteResponse]
$creadList :: ReadS [GetBucketWebsiteResponse]
readsPrec :: Int -> ReadS GetBucketWebsiteResponse
$creadsPrec :: Int -> ReadS GetBucketWebsiteResponse
Prelude.Read, Int -> GetBucketWebsiteResponse -> ShowS
[GetBucketWebsiteResponse] -> ShowS
GetBucketWebsiteResponse -> String
(Int -> GetBucketWebsiteResponse -> ShowS)
-> (GetBucketWebsiteResponse -> String)
-> ([GetBucketWebsiteResponse] -> ShowS)
-> Show GetBucketWebsiteResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketWebsiteResponse] -> ShowS
$cshowList :: [GetBucketWebsiteResponse] -> ShowS
show :: GetBucketWebsiteResponse -> String
$cshow :: GetBucketWebsiteResponse -> String
showsPrec :: Int -> GetBucketWebsiteResponse -> ShowS
$cshowsPrec :: Int -> GetBucketWebsiteResponse -> ShowS
Prelude.Show, (forall x.
 GetBucketWebsiteResponse -> Rep GetBucketWebsiteResponse x)
-> (forall x.
    Rep GetBucketWebsiteResponse x -> GetBucketWebsiteResponse)
-> Generic GetBucketWebsiteResponse
forall x.
Rep GetBucketWebsiteResponse x -> GetBucketWebsiteResponse
forall x.
GetBucketWebsiteResponse -> Rep GetBucketWebsiteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketWebsiteResponse x -> GetBucketWebsiteResponse
$cfrom :: forall x.
GetBucketWebsiteResponse -> Rep GetBucketWebsiteResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetBucketWebsiteResponse' 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:
--
-- 'redirectAllRequestsTo', 'getBucketWebsiteResponse_redirectAllRequestsTo' - Specifies the redirect behavior of all requests to a website endpoint of
-- an Amazon S3 bucket.
--
-- 'errorDocument', 'getBucketWebsiteResponse_errorDocument' - The object key name of the website error document to use for 4XX class
-- errors.
--
-- 'indexDocument', 'getBucketWebsiteResponse_indexDocument' - The name of the index document for the website (for example
-- @index.html@).
--
-- 'routingRules', 'getBucketWebsiteResponse_routingRules' - Rules that define when a redirect is applied and the redirect behavior.
--
-- 'httpStatus', 'getBucketWebsiteResponse_httpStatus' - The response's http status code.
newGetBucketWebsiteResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBucketWebsiteResponse
newGetBucketWebsiteResponse :: Int -> GetBucketWebsiteResponse
newGetBucketWebsiteResponse Int
pHttpStatus_ =
  GetBucketWebsiteResponse' :: Maybe RedirectAllRequestsTo
-> Maybe ErrorDocument
-> Maybe IndexDocument
-> Maybe [RoutingRule]
-> Int
-> GetBucketWebsiteResponse
GetBucketWebsiteResponse'
    { $sel:redirectAllRequestsTo:GetBucketWebsiteResponse' :: Maybe RedirectAllRequestsTo
redirectAllRequestsTo =
        Maybe RedirectAllRequestsTo
forall a. Maybe a
Prelude.Nothing,
      $sel:errorDocument:GetBucketWebsiteResponse' :: Maybe ErrorDocument
errorDocument = Maybe ErrorDocument
forall a. Maybe a
Prelude.Nothing,
      $sel:indexDocument:GetBucketWebsiteResponse' :: Maybe IndexDocument
indexDocument = Maybe IndexDocument
forall a. Maybe a
Prelude.Nothing,
      $sel:routingRules:GetBucketWebsiteResponse' :: Maybe [RoutingRule]
routingRules = Maybe [RoutingRule]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBucketWebsiteResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Specifies the redirect behavior of all requests to a website endpoint of
-- an Amazon S3 bucket.
getBucketWebsiteResponse_redirectAllRequestsTo :: Lens.Lens' GetBucketWebsiteResponse (Prelude.Maybe RedirectAllRequestsTo)
getBucketWebsiteResponse_redirectAllRequestsTo :: (Maybe RedirectAllRequestsTo -> f (Maybe RedirectAllRequestsTo))
-> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse
getBucketWebsiteResponse_redirectAllRequestsTo = (GetBucketWebsiteResponse -> Maybe RedirectAllRequestsTo)
-> (GetBucketWebsiteResponse
    -> Maybe RedirectAllRequestsTo -> GetBucketWebsiteResponse)
-> Lens
     GetBucketWebsiteResponse
     GetBucketWebsiteResponse
     (Maybe RedirectAllRequestsTo)
     (Maybe RedirectAllRequestsTo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsiteResponse' {Maybe RedirectAllRequestsTo
redirectAllRequestsTo :: Maybe RedirectAllRequestsTo
$sel:redirectAllRequestsTo:GetBucketWebsiteResponse' :: GetBucketWebsiteResponse -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo} -> Maybe RedirectAllRequestsTo
redirectAllRequestsTo) (\s :: GetBucketWebsiteResponse
s@GetBucketWebsiteResponse' {} Maybe RedirectAllRequestsTo
a -> GetBucketWebsiteResponse
s {$sel:redirectAllRequestsTo:GetBucketWebsiteResponse' :: Maybe RedirectAllRequestsTo
redirectAllRequestsTo = Maybe RedirectAllRequestsTo
a} :: GetBucketWebsiteResponse)

-- | The object key name of the website error document to use for 4XX class
-- errors.
getBucketWebsiteResponse_errorDocument :: Lens.Lens' GetBucketWebsiteResponse (Prelude.Maybe ErrorDocument)
getBucketWebsiteResponse_errorDocument :: (Maybe ErrorDocument -> f (Maybe ErrorDocument))
-> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse
getBucketWebsiteResponse_errorDocument = (GetBucketWebsiteResponse -> Maybe ErrorDocument)
-> (GetBucketWebsiteResponse
    -> Maybe ErrorDocument -> GetBucketWebsiteResponse)
-> Lens
     GetBucketWebsiteResponse
     GetBucketWebsiteResponse
     (Maybe ErrorDocument)
     (Maybe ErrorDocument)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsiteResponse' {Maybe ErrorDocument
errorDocument :: Maybe ErrorDocument
$sel:errorDocument:GetBucketWebsiteResponse' :: GetBucketWebsiteResponse -> Maybe ErrorDocument
errorDocument} -> Maybe ErrorDocument
errorDocument) (\s :: GetBucketWebsiteResponse
s@GetBucketWebsiteResponse' {} Maybe ErrorDocument
a -> GetBucketWebsiteResponse
s {$sel:errorDocument:GetBucketWebsiteResponse' :: Maybe ErrorDocument
errorDocument = Maybe ErrorDocument
a} :: GetBucketWebsiteResponse)

-- | The name of the index document for the website (for example
-- @index.html@).
getBucketWebsiteResponse_indexDocument :: Lens.Lens' GetBucketWebsiteResponse (Prelude.Maybe IndexDocument)
getBucketWebsiteResponse_indexDocument :: (Maybe IndexDocument -> f (Maybe IndexDocument))
-> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse
getBucketWebsiteResponse_indexDocument = (GetBucketWebsiteResponse -> Maybe IndexDocument)
-> (GetBucketWebsiteResponse
    -> Maybe IndexDocument -> GetBucketWebsiteResponse)
-> Lens
     GetBucketWebsiteResponse
     GetBucketWebsiteResponse
     (Maybe IndexDocument)
     (Maybe IndexDocument)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsiteResponse' {Maybe IndexDocument
indexDocument :: Maybe IndexDocument
$sel:indexDocument:GetBucketWebsiteResponse' :: GetBucketWebsiteResponse -> Maybe IndexDocument
indexDocument} -> Maybe IndexDocument
indexDocument) (\s :: GetBucketWebsiteResponse
s@GetBucketWebsiteResponse' {} Maybe IndexDocument
a -> GetBucketWebsiteResponse
s {$sel:indexDocument:GetBucketWebsiteResponse' :: Maybe IndexDocument
indexDocument = Maybe IndexDocument
a} :: GetBucketWebsiteResponse)

-- | Rules that define when a redirect is applied and the redirect behavior.
getBucketWebsiteResponse_routingRules :: Lens.Lens' GetBucketWebsiteResponse (Prelude.Maybe [RoutingRule])
getBucketWebsiteResponse_routingRules :: (Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse
getBucketWebsiteResponse_routingRules = (GetBucketWebsiteResponse -> Maybe [RoutingRule])
-> (GetBucketWebsiteResponse
    -> Maybe [RoutingRule] -> GetBucketWebsiteResponse)
-> Lens
     GetBucketWebsiteResponse
     GetBucketWebsiteResponse
     (Maybe [RoutingRule])
     (Maybe [RoutingRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsiteResponse' {Maybe [RoutingRule]
routingRules :: Maybe [RoutingRule]
$sel:routingRules:GetBucketWebsiteResponse' :: GetBucketWebsiteResponse -> Maybe [RoutingRule]
routingRules} -> Maybe [RoutingRule]
routingRules) (\s :: GetBucketWebsiteResponse
s@GetBucketWebsiteResponse' {} Maybe [RoutingRule]
a -> GetBucketWebsiteResponse
s {$sel:routingRules:GetBucketWebsiteResponse' :: Maybe [RoutingRule]
routingRules = Maybe [RoutingRule]
a} :: GetBucketWebsiteResponse) ((Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
 -> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse)
-> ((Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
    -> Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> (Maybe [RoutingRule] -> f (Maybe [RoutingRule]))
-> GetBucketWebsiteResponse
-> f GetBucketWebsiteResponse
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

-- | The response's http status code.
getBucketWebsiteResponse_httpStatus :: Lens.Lens' GetBucketWebsiteResponse Prelude.Int
getBucketWebsiteResponse_httpStatus :: (Int -> f Int)
-> GetBucketWebsiteResponse -> f GetBucketWebsiteResponse
getBucketWebsiteResponse_httpStatus = (GetBucketWebsiteResponse -> Int)
-> (GetBucketWebsiteResponse -> Int -> GetBucketWebsiteResponse)
-> Lens GetBucketWebsiteResponse GetBucketWebsiteResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketWebsiteResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketWebsiteResponse' :: GetBucketWebsiteResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketWebsiteResponse
s@GetBucketWebsiteResponse' {} Int
a -> GetBucketWebsiteResponse
s {$sel:httpStatus:GetBucketWebsiteResponse' :: Int
httpStatus = Int
a} :: GetBucketWebsiteResponse)

instance Prelude.NFData GetBucketWebsiteResponse