{-# 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.PinpointSMSVoice.CreateConfigurationSet
-- 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)
--
-- Create a new configuration set. After you create the configuration set,
-- you can add one or more event destinations to it.
module Amazonka.PinpointSMSVoice.CreateConfigurationSet
  ( -- * Creating a Request
    CreateConfigurationSet (..),
    newCreateConfigurationSet,

    -- * Request Lenses
    createConfigurationSet_configurationSetName,

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

    -- * Response Lenses
    createConfigurationSetResponse_httpStatus,
  )
where

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

-- | A request to create a new configuration set.
--
-- /See:/ 'newCreateConfigurationSet' smart constructor.
data CreateConfigurationSet = CreateConfigurationSet'
  { -- | The name that you want to give the configuration set.
    CreateConfigurationSet -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text
  }
  deriving (CreateConfigurationSet -> CreateConfigurationSet -> Bool
(CreateConfigurationSet -> CreateConfigurationSet -> Bool)
-> (CreateConfigurationSet -> CreateConfigurationSet -> Bool)
-> Eq CreateConfigurationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
$c/= :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
== :: CreateConfigurationSet -> CreateConfigurationSet -> Bool
$c== :: 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
readListPrec :: ReadPrec [CreateConfigurationSet]
$creadListPrec :: ReadPrec [CreateConfigurationSet]
readPrec :: ReadPrec CreateConfigurationSet
$creadPrec :: ReadPrec CreateConfigurationSet
readList :: ReadS [CreateConfigurationSet]
$creadList :: ReadS [CreateConfigurationSet]
readsPrec :: Int -> ReadS CreateConfigurationSet
$creadsPrec :: Int -> ReadS 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
showList :: [CreateConfigurationSet] -> ShowS
$cshowList :: [CreateConfigurationSet] -> ShowS
show :: CreateConfigurationSet -> String
$cshow :: CreateConfigurationSet -> String
showsPrec :: Int -> CreateConfigurationSet -> ShowS
$cshowsPrec :: Int -> 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
$cto :: forall x. Rep CreateConfigurationSet x -> CreateConfigurationSet
$cfrom :: forall x. CreateConfigurationSet -> Rep CreateConfigurationSet x
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:
--
-- 'configurationSetName', 'createConfigurationSet_configurationSetName' - The name that you want to give the configuration set.
newCreateConfigurationSet ::
  CreateConfigurationSet
newCreateConfigurationSet :: CreateConfigurationSet
newCreateConfigurationSet =
  CreateConfigurationSet' :: Maybe Text -> CreateConfigurationSet
CreateConfigurationSet'
    { $sel:configurationSetName:CreateConfigurationSet' :: Maybe Text
configurationSetName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name that you want to give the configuration set.
createConfigurationSet_configurationSetName :: Lens.Lens' CreateConfigurationSet (Prelude.Maybe Prelude.Text)
createConfigurationSet_configurationSetName :: (Maybe Text -> f (Maybe Text))
-> CreateConfigurationSet -> f CreateConfigurationSet
createConfigurationSet_configurationSetName = (CreateConfigurationSet -> Maybe Text)
-> (CreateConfigurationSet -> Maybe Text -> CreateConfigurationSet)
-> Lens
     CreateConfigurationSet
     CreateConfigurationSet
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationSet' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:CreateConfigurationSet' :: CreateConfigurationSet -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: CreateConfigurationSet
s@CreateConfigurationSet' {} Maybe Text
a -> CreateConfigurationSet
s {$sel:configurationSetName:CreateConfigurationSet' :: Maybe Text
configurationSetName = Maybe Text
a} :: CreateConfigurationSet)

instance Core.AWSRequest CreateConfigurationSet where
  type
    AWSResponse CreateConfigurationSet =
      CreateConfigurationSetResponse
  request :: CreateConfigurationSet -> Request CreateConfigurationSet
request = Service -> CreateConfigurationSet -> Request CreateConfigurationSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateConfigurationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationSet)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CreateConfigurationSet))
-> Logger
-> Service
-> Proxy CreateConfigurationSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
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 (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

instance Prelude.NFData CreateConfigurationSet

instance Core.ToHeaders CreateConfigurationSet where
  toHeaders :: CreateConfigurationSet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateConfigurationSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateConfigurationSet where
  toJSON :: CreateConfigurationSet -> Value
toJSON CreateConfigurationSet' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:CreateConfigurationSet' :: CreateConfigurationSet -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ConfigurationSetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
configurationSetName
          ]
      )

instance Core.ToPath CreateConfigurationSet where
  toPath :: CreateConfigurationSet -> ByteString
toPath =
    ByteString -> CreateConfigurationSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/sms-voice/configuration-sets"

instance Core.ToQuery CreateConfigurationSet where
  toQuery :: CreateConfigurationSet -> QueryString
toQuery = QueryString -> CreateConfigurationSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | An empty object that indicates that the configuration set was
-- successfully created.
--
-- /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
/= :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
$c/= :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
== :: CreateConfigurationSetResponse
-> CreateConfigurationSetResponse -> Bool
$c== :: 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
readListPrec :: ReadPrec [CreateConfigurationSetResponse]
$creadListPrec :: ReadPrec [CreateConfigurationSetResponse]
readPrec :: ReadPrec CreateConfigurationSetResponse
$creadPrec :: ReadPrec CreateConfigurationSetResponse
readList :: ReadS [CreateConfigurationSetResponse]
$creadList :: ReadS [CreateConfigurationSetResponse]
readsPrec :: Int -> ReadS CreateConfigurationSetResponse
$creadsPrec :: Int -> ReadS 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
showList :: [CreateConfigurationSetResponse] -> ShowS
$cshowList :: [CreateConfigurationSetResponse] -> ShowS
show :: CreateConfigurationSetResponse -> String
$cshow :: CreateConfigurationSetResponse -> String
showsPrec :: Int -> CreateConfigurationSetResponse -> ShowS
$cshowsPrec :: Int -> 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
$cto :: forall x.
Rep CreateConfigurationSetResponse x
-> CreateConfigurationSetResponse
$cfrom :: forall x.
CreateConfigurationSetResponse
-> Rep CreateConfigurationSetResponse x
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' :: Int -> CreateConfigurationSetResponse
CreateConfigurationSetResponse'
    { $sel:httpStatus:CreateConfigurationSetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    CreateConfigurationSetResponse