{-# 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.SES.CreateConfigurationSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a configuration set.
--
-- Configuration sets enable you to publish email sending events. For
-- information about using configuration sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/monitor-sending-activity.html Amazon SES Developer Guide>.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.CreateConfigurationSet
  ( -- * Creating a Request
    CreateConfigurationSet (..),
    newCreateConfigurationSet,

    -- * Request Lenses
    createConfigurationSet_configurationSet,

    -- * Destructuring the Response
    CreateConfigurationSetResponse (..),
    newCreateConfigurationSetResponse,

    -- * Response Lenses
    createConfigurationSetResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SES.Types

-- | Represents a request to create a configuration set. Configuration sets
-- enable you to publish email sending events. For information about using
-- configuration sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/monitor-sending-activity.html Amazon SES Developer Guide>.
--
-- /See:/ 'newCreateConfigurationSet' smart constructor.
data CreateConfigurationSet = CreateConfigurationSet'
  { -- | A data structure that contains the name of the configuration set.
    CreateConfigurationSet -> ConfigurationSet
configurationSet :: ConfigurationSet
  }
  deriving (CreateConfigurationSet -> CreateConfigurationSet -> Bool
(CreateConfigurationSet -> CreateConfigurationSet -> Bool)
-> (CreateConfigurationSet -> CreateConfigurationSet -> Bool)
-> Eq CreateConfigurationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
== :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
$c/= :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
/= :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
Prelude.Eq, ReadPrec [CreateConfigurationSet]
ReadPrec CreateConfigurationSet
Int -> ReadS CreateConfigurationSet
ReadS [CreateConfigurationSet]
(Int -> ReadS CreateConfigurationSet)
-> ReadS [CreateConfigurationSet]
-> ReadPrec CreateConfigurationSet
-> ReadPrec [CreateConfigurationSet]
-> Read CreateConfigurationSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS CreateConfigurationSet
readsPrec :: Int -> ReadS CreateConfigurationSet
$creadList :: ReadS [CreateConfigurationSet]
readList :: ReadS [CreateConfigurationSet]
$creadPrec :: ReadPrec CreateConfigurationSet
readPrec :: ReadPrec CreateConfigurationSet
$creadListPrec :: ReadPrec [CreateConfigurationSet]
readListPrec :: ReadPrec [CreateConfigurationSet]
Prelude.Read, Int -> CreateConfigurationSet -> ShowS
[CreateConfigurationSet] -> ShowS
CreateConfigurationSet -> String
(Int -> CreateConfigurationSet -> ShowS)
-> (CreateConfigurationSet -> String)
-> ([CreateConfigurationSet] -> ShowS)
-> Show CreateConfigurationSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateConfigurationSet -> ShowS
showsPrec :: Int -> CreateConfigurationSet -> ShowS
$cshow :: CreateConfigurationSet -> String
show :: CreateConfigurationSet -> String
$cshowList :: [CreateConfigurationSet] -> ShowS
showList :: [CreateConfigurationSet] -> ShowS
Prelude.Show, (forall x. CreateConfigurationSet -> Rep CreateConfigurationSet x)
-> (forall x.
    Rep CreateConfigurationSet x -> CreateConfigurationSet)
-> Generic CreateConfigurationSet
forall x. Rep CreateConfigurationSet x -> CreateConfigurationSet
forall x. CreateConfigurationSet -> Rep CreateConfigurationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CreateConfigurationSet -> Rep CreateConfigurationSet x
from :: forall x. CreateConfigurationSet -> Rep CreateConfigurationSet x
$cto :: forall x. Rep CreateConfigurationSet x -> CreateConfigurationSet
to :: forall x. Rep CreateConfigurationSet x -> CreateConfigurationSet
Prelude.Generic)

-- |
-- Create a value of 'CreateConfigurationSet' 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:
--
-- 'configurationSet', 'createConfigurationSet_configurationSet' - A data structure that contains the name of the configuration set.
newCreateConfigurationSet ::
  -- | 'configurationSet'
  ConfigurationSet ->
  CreateConfigurationSet
newCreateConfigurationSet :: ConfigurationSet -> CreateConfigurationSet
newCreateConfigurationSet ConfigurationSet
pConfigurationSet_ =
  CreateConfigurationSet'
    { $sel:configurationSet:CreateConfigurationSet' :: ConfigurationSet
configurationSet =
        ConfigurationSet
pConfigurationSet_
    }

-- | A data structure that contains the name of the configuration set.
createConfigurationSet_configurationSet :: Lens.Lens' CreateConfigurationSet ConfigurationSet
createConfigurationSet_configurationSet :: Lens' CreateConfigurationSet ConfigurationSet
createConfigurationSet_configurationSet = (CreateConfigurationSet -> ConfigurationSet)
-> (CreateConfigurationSet
    -> ConfigurationSet -> CreateConfigurationSet)
-> Lens' CreateConfigurationSet ConfigurationSet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationSet' {ConfigurationSet
$sel:configurationSet:CreateConfigurationSet' :: CreateConfigurationSet -> ConfigurationSet
configurationSet :: ConfigurationSet
configurationSet} -> ConfigurationSet
configurationSet) (\s :: CreateConfigurationSet
s@CreateConfigurationSet' {} ConfigurationSet
a -> CreateConfigurationSet
s {configurationSet = a} :: CreateConfigurationSet)

instance Core.AWSRequest CreateConfigurationSet where
  type
    AWSResponse CreateConfigurationSet =
      CreateConfigurationSetResponse
  request :: (Service -> Service)
-> CreateConfigurationSet -> Request CreateConfigurationSet
request Service -> Service
overrides =
    Service -> CreateConfigurationSet -> Request CreateConfigurationSet
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateConfigurationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationSet)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateConfigurationSet))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateConfigurationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationSet)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateConfigurationSetResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> CreateConfigurationSetResponse
CreateConfigurationSetResponse'
            (Int -> CreateConfigurationSetResponse)
-> Either String Int
-> Either String CreateConfigurationSetResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall a. a -> Either String a
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 CreateConfigurationSet where
  hashWithSalt :: Int -> CreateConfigurationSet -> Int
hashWithSalt Int
_salt CreateConfigurationSet' {ConfigurationSet
$sel:configurationSet:CreateConfigurationSet' :: CreateConfigurationSet -> ConfigurationSet
configurationSet :: ConfigurationSet
..} =
    Int
_salt Int -> ConfigurationSet -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConfigurationSet
configurationSet

instance Prelude.NFData CreateConfigurationSet where
  rnf :: CreateConfigurationSet -> ()
rnf CreateConfigurationSet' {ConfigurationSet
$sel:configurationSet:CreateConfigurationSet' :: CreateConfigurationSet -> ConfigurationSet
configurationSet :: ConfigurationSet
..} =
    ConfigurationSet -> ()
forall a. NFData a => a -> ()
Prelude.rnf ConfigurationSet
configurationSet

instance Data.ToHeaders CreateConfigurationSet where
  toHeaders :: CreateConfigurationSet -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateConfigurationSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath CreateConfigurationSet where
  toPath :: CreateConfigurationSet -> ByteString
toPath = ByteString -> CreateConfigurationSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateConfigurationSet where
  toQuery :: CreateConfigurationSet -> QueryString
toQuery CreateConfigurationSet' {ConfigurationSet
$sel:configurationSet:CreateConfigurationSet' :: CreateConfigurationSet -> ConfigurationSet
configurationSet :: ConfigurationSet
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateConfigurationSet" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"ConfigurationSet" ByteString -> ConfigurationSet -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ConfigurationSet
configurationSet
      ]

-- | An empty element returned on a successful request.
--
-- /See:/ 'newCreateConfigurationSetResponse' smart constructor.
data CreateConfigurationSetResponse = CreateConfigurationSetResponse'
  { -- | The response's http status code.
    CreateConfigurationSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
(CreateConfigurationSetResponse
 -> CreateConfigurationSetResponse -> Bool)
-> (CreateConfigurationSetResponse
    -> CreateConfigurationSetResponse -> Bool)
-> Eq CreateConfigurationSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
== :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
$c/= :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
/= :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateConfigurationSetResponse]
ReadPrec CreateConfigurationSetResponse
Int -> ReadS CreateConfigurationSetResponse
ReadS [CreateConfigurationSetResponse]
(Int -> ReadS CreateConfigurationSetResponse)
-> ReadS [CreateConfigurationSetResponse]
-> ReadPrec CreateConfigurationSetResponse
-> ReadPrec [CreateConfigurationSetResponse]
-> Read CreateConfigurationSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS CreateConfigurationSetResponse
readsPrec :: Int -> ReadS CreateConfigurationSetResponse
$creadList :: ReadS [CreateConfigurationSetResponse]
readList :: ReadS [CreateConfigurationSetResponse]
$creadPrec :: ReadPrec CreateConfigurationSetResponse
readPrec :: ReadPrec CreateConfigurationSetResponse
$creadListPrec :: ReadPrec [CreateConfigurationSetResponse]
readListPrec :: ReadPrec [CreateConfigurationSetResponse]
Prelude.Read, Int -> CreateConfigurationSetResponse -> ShowS
[CreateConfigurationSetResponse] -> ShowS
CreateConfigurationSetResponse -> String
(Int -> CreateConfigurationSetResponse -> ShowS)
-> (CreateConfigurationSetResponse -> String)
-> ([CreateConfigurationSetResponse] -> ShowS)
-> Show CreateConfigurationSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateConfigurationSetResponse -> ShowS
showsPrec :: Int -> CreateConfigurationSetResponse -> ShowS
$cshow :: CreateConfigurationSetResponse -> String
show :: CreateConfigurationSetResponse -> String
$cshowList :: [CreateConfigurationSetResponse] -> ShowS
showList :: [CreateConfigurationSetResponse] -> ShowS
Prelude.Show, (forall x.
 CreateConfigurationSetResponse
 -> Rep CreateConfigurationSetResponse x)
-> (forall x.
    Rep CreateConfigurationSetResponse x
    -> CreateConfigurationSetResponse)
-> Generic CreateConfigurationSetResponse
forall x.
Rep CreateConfigurationSetResponse x
-> CreateConfigurationSetResponse
forall x.
CreateConfigurationSetResponse
-> Rep CreateConfigurationSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
CreateConfigurationSetResponse
-> Rep CreateConfigurationSetResponse x
from :: forall x.
CreateConfigurationSetResponse
-> Rep CreateConfigurationSetResponse x
$cto :: forall x.
Rep CreateConfigurationSetResponse x
-> CreateConfigurationSetResponse
to :: forall x.
Rep CreateConfigurationSetResponse x
-> CreateConfigurationSetResponse
Prelude.Generic)

-- |
-- Create a value of 'CreateConfigurationSetResponse' 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:
--
-- 'httpStatus', 'createConfigurationSetResponse_httpStatus' - The response's http status code.
newCreateConfigurationSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateConfigurationSetResponse
newCreateConfigurationSetResponse :: Int -> CreateConfigurationSetResponse
newCreateConfigurationSetResponse Int
pHttpStatus_ =
  CreateConfigurationSetResponse'
    { $sel:httpStatus:CreateConfigurationSetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    CreateConfigurationSetResponse
  where
  rnf :: CreateConfigurationSetResponse -> ()
rnf CreateConfigurationSetResponse' {Int
$sel:httpStatus:CreateConfigurationSetResponse' :: CreateConfigurationSetResponse -> Int
httpStatus :: Int
..} =
    Int -> ()
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus