{-# 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 #-}

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

-- |
-- Module      : Amazonka.S3.Types.CreateBucketConfiguration
-- 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)
module Amazonka.S3.Types.CreateBucketConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | The configuration information for the bucket.
--
-- /See:/ 'newCreateBucketConfiguration' smart constructor.
data CreateBucketConfiguration = CreateBucketConfiguration'
  { -- | Specifies the Region where the bucket will be created. If you don\'t
    -- specify a Region, the bucket is created in the US East (N. Virginia)
    -- Region (us-east-1).
    CreateBucketConfiguration -> Maybe LocationConstraint
locationConstraint :: Prelude.Maybe LocationConstraint
  }
  deriving (CreateBucketConfiguration -> CreateBucketConfiguration -> Bool
(CreateBucketConfiguration -> CreateBucketConfiguration -> Bool)
-> (CreateBucketConfiguration -> CreateBucketConfiguration -> Bool)
-> Eq CreateBucketConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBucketConfiguration -> CreateBucketConfiguration -> Bool
$c/= :: CreateBucketConfiguration -> CreateBucketConfiguration -> Bool
== :: CreateBucketConfiguration -> CreateBucketConfiguration -> Bool
$c== :: CreateBucketConfiguration -> CreateBucketConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateBucketConfiguration]
ReadPrec CreateBucketConfiguration
Int -> ReadS CreateBucketConfiguration
ReadS [CreateBucketConfiguration]
(Int -> ReadS CreateBucketConfiguration)
-> ReadS [CreateBucketConfiguration]
-> ReadPrec CreateBucketConfiguration
-> ReadPrec [CreateBucketConfiguration]
-> Read CreateBucketConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBucketConfiguration]
$creadListPrec :: ReadPrec [CreateBucketConfiguration]
readPrec :: ReadPrec CreateBucketConfiguration
$creadPrec :: ReadPrec CreateBucketConfiguration
readList :: ReadS [CreateBucketConfiguration]
$creadList :: ReadS [CreateBucketConfiguration]
readsPrec :: Int -> ReadS CreateBucketConfiguration
$creadsPrec :: Int -> ReadS CreateBucketConfiguration
Prelude.Read, Int -> CreateBucketConfiguration -> ShowS
[CreateBucketConfiguration] -> ShowS
CreateBucketConfiguration -> String
(Int -> CreateBucketConfiguration -> ShowS)
-> (CreateBucketConfiguration -> String)
-> ([CreateBucketConfiguration] -> ShowS)
-> Show CreateBucketConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBucketConfiguration] -> ShowS
$cshowList :: [CreateBucketConfiguration] -> ShowS
show :: CreateBucketConfiguration -> String
$cshow :: CreateBucketConfiguration -> String
showsPrec :: Int -> CreateBucketConfiguration -> ShowS
$cshowsPrec :: Int -> CreateBucketConfiguration -> ShowS
Prelude.Show, (forall x.
 CreateBucketConfiguration -> Rep CreateBucketConfiguration x)
-> (forall x.
    Rep CreateBucketConfiguration x -> CreateBucketConfiguration)
-> Generic CreateBucketConfiguration
forall x.
Rep CreateBucketConfiguration x -> CreateBucketConfiguration
forall x.
CreateBucketConfiguration -> Rep CreateBucketConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBucketConfiguration x -> CreateBucketConfiguration
$cfrom :: forall x.
CreateBucketConfiguration -> Rep CreateBucketConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CreateBucketConfiguration' 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:
--
-- 'locationConstraint', 'createBucketConfiguration_locationConstraint' - Specifies the Region where the bucket will be created. If you don\'t
-- specify a Region, the bucket is created in the US East (N. Virginia)
-- Region (us-east-1).
newCreateBucketConfiguration ::
  CreateBucketConfiguration
newCreateBucketConfiguration :: CreateBucketConfiguration
newCreateBucketConfiguration =
  CreateBucketConfiguration' :: Maybe LocationConstraint -> CreateBucketConfiguration
CreateBucketConfiguration'
    { $sel:locationConstraint:CreateBucketConfiguration' :: Maybe LocationConstraint
locationConstraint =
        Maybe LocationConstraint
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the Region where the bucket will be created. If you don\'t
-- specify a Region, the bucket is created in the US East (N. Virginia)
-- Region (us-east-1).
createBucketConfiguration_locationConstraint :: Lens.Lens' CreateBucketConfiguration (Prelude.Maybe LocationConstraint)
createBucketConfiguration_locationConstraint :: (Maybe LocationConstraint -> f (Maybe LocationConstraint))
-> CreateBucketConfiguration -> f CreateBucketConfiguration
createBucketConfiguration_locationConstraint = (CreateBucketConfiguration -> Maybe LocationConstraint)
-> (CreateBucketConfiguration
    -> Maybe LocationConstraint -> CreateBucketConfiguration)
-> Lens
     CreateBucketConfiguration
     CreateBucketConfiguration
     (Maybe LocationConstraint)
     (Maybe LocationConstraint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBucketConfiguration' {Maybe LocationConstraint
locationConstraint :: Maybe LocationConstraint
$sel:locationConstraint:CreateBucketConfiguration' :: CreateBucketConfiguration -> Maybe LocationConstraint
locationConstraint} -> Maybe LocationConstraint
locationConstraint) (\s :: CreateBucketConfiguration
s@CreateBucketConfiguration' {} Maybe LocationConstraint
a -> CreateBucketConfiguration
s {$sel:locationConstraint:CreateBucketConfiguration' :: Maybe LocationConstraint
locationConstraint = Maybe LocationConstraint
a} :: CreateBucketConfiguration)

instance Prelude.Hashable CreateBucketConfiguration

instance Prelude.NFData CreateBucketConfiguration

instance Core.ToXML CreateBucketConfiguration where
  toXML :: CreateBucketConfiguration -> XML
toXML CreateBucketConfiguration' {Maybe LocationConstraint
locationConstraint :: Maybe LocationConstraint
$sel:locationConstraint:CreateBucketConfiguration' :: CreateBucketConfiguration -> Maybe LocationConstraint
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"LocationConstraint" Name -> Maybe LocationConstraint -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe LocationConstraint
locationConstraint]