{-# 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.PinpointSmsVoiceV2.DeleteDefaultSenderId
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an existing default sender ID on a configuration set.
--
-- A default sender ID is the identity that appears on recipients\' devices
-- when they receive SMS messages. Support for sender ID capabilities
-- varies by country or region.
module Amazonka.PinpointSmsVoiceV2.DeleteDefaultSenderId
  ( -- * Creating a Request
    DeleteDefaultSenderId (..),
    newDeleteDefaultSenderId,

    -- * Request Lenses
    deleteDefaultSenderId_configurationSetName,

    -- * Destructuring the Response
    DeleteDefaultSenderIdResponse (..),
    newDeleteDefaultSenderIdResponse,

    -- * Response Lenses
    deleteDefaultSenderIdResponse_configurationSetArn,
    deleteDefaultSenderIdResponse_configurationSetName,
    deleteDefaultSenderIdResponse_senderId,
    deleteDefaultSenderIdResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteDefaultSenderId' smart constructor.
data DeleteDefaultSenderId = DeleteDefaultSenderId'
  { -- | The name of the configuration set or the configuration set Amazon
    -- Resource Name (ARN) to delete the default sender ID from. The
    -- ConfigurationSetName and ConfigurationSetArn can be found using the
    -- DescribeConfigurationSets action.
    DeleteDefaultSenderId -> Text
configurationSetName :: Prelude.Text
  }
  deriving (DeleteDefaultSenderId -> DeleteDefaultSenderId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDefaultSenderId -> DeleteDefaultSenderId -> Bool
$c/= :: DeleteDefaultSenderId -> DeleteDefaultSenderId -> Bool
== :: DeleteDefaultSenderId -> DeleteDefaultSenderId -> Bool
$c== :: DeleteDefaultSenderId -> DeleteDefaultSenderId -> Bool
Prelude.Eq, ReadPrec [DeleteDefaultSenderId]
ReadPrec DeleteDefaultSenderId
Int -> ReadS DeleteDefaultSenderId
ReadS [DeleteDefaultSenderId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDefaultSenderId]
$creadListPrec :: ReadPrec [DeleteDefaultSenderId]
readPrec :: ReadPrec DeleteDefaultSenderId
$creadPrec :: ReadPrec DeleteDefaultSenderId
readList :: ReadS [DeleteDefaultSenderId]
$creadList :: ReadS [DeleteDefaultSenderId]
readsPrec :: Int -> ReadS DeleteDefaultSenderId
$creadsPrec :: Int -> ReadS DeleteDefaultSenderId
Prelude.Read, Int -> DeleteDefaultSenderId -> ShowS
[DeleteDefaultSenderId] -> ShowS
DeleteDefaultSenderId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDefaultSenderId] -> ShowS
$cshowList :: [DeleteDefaultSenderId] -> ShowS
show :: DeleteDefaultSenderId -> String
$cshow :: DeleteDefaultSenderId -> String
showsPrec :: Int -> DeleteDefaultSenderId -> ShowS
$cshowsPrec :: Int -> DeleteDefaultSenderId -> ShowS
Prelude.Show, forall x. Rep DeleteDefaultSenderId x -> DeleteDefaultSenderId
forall x. DeleteDefaultSenderId -> Rep DeleteDefaultSenderId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDefaultSenderId x -> DeleteDefaultSenderId
$cfrom :: forall x. DeleteDefaultSenderId -> Rep DeleteDefaultSenderId x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDefaultSenderId' 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', 'deleteDefaultSenderId_configurationSetName' - The name of the configuration set or the configuration set Amazon
-- Resource Name (ARN) to delete the default sender ID from. The
-- ConfigurationSetName and ConfigurationSetArn can be found using the
-- DescribeConfigurationSets action.
newDeleteDefaultSenderId ::
  -- | 'configurationSetName'
  Prelude.Text ->
  DeleteDefaultSenderId
newDeleteDefaultSenderId :: Text -> DeleteDefaultSenderId
newDeleteDefaultSenderId Text
pConfigurationSetName_ =
  DeleteDefaultSenderId'
    { $sel:configurationSetName:DeleteDefaultSenderId' :: Text
configurationSetName =
        Text
pConfigurationSetName_
    }

-- | The name of the configuration set or the configuration set Amazon
-- Resource Name (ARN) to delete the default sender ID from. The
-- ConfigurationSetName and ConfigurationSetArn can be found using the
-- DescribeConfigurationSets action.
deleteDefaultSenderId_configurationSetName :: Lens.Lens' DeleteDefaultSenderId Prelude.Text
deleteDefaultSenderId_configurationSetName :: Lens' DeleteDefaultSenderId Text
deleteDefaultSenderId_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDefaultSenderId' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteDefaultSenderId' :: DeleteDefaultSenderId -> Text
configurationSetName} -> Text
configurationSetName) (\s :: DeleteDefaultSenderId
s@DeleteDefaultSenderId' {} Text
a -> DeleteDefaultSenderId
s {$sel:configurationSetName:DeleteDefaultSenderId' :: Text
configurationSetName = Text
a} :: DeleteDefaultSenderId)

instance Core.AWSRequest DeleteDefaultSenderId where
  type
    AWSResponse DeleteDefaultSenderId =
      DeleteDefaultSenderIdResponse
  request :: (Service -> Service)
-> DeleteDefaultSenderId -> Request DeleteDefaultSenderId
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDefaultSenderId
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDefaultSenderId)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DeleteDefaultSenderIdResponse
DeleteDefaultSenderIdResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConfigurationSetArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConfigurationSetName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SenderId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteDefaultSenderId where
  hashWithSalt :: Int -> DeleteDefaultSenderId -> Int
hashWithSalt Int
_salt DeleteDefaultSenderId' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteDefaultSenderId' :: DeleteDefaultSenderId -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName

instance Prelude.NFData DeleteDefaultSenderId where
  rnf :: DeleteDefaultSenderId -> ()
rnf DeleteDefaultSenderId' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteDefaultSenderId' :: DeleteDefaultSenderId -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName

instance Data.ToHeaders DeleteDefaultSenderId where
  toHeaders :: DeleteDefaultSenderId -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"PinpointSMSVoiceV2.DeleteDefaultSenderId" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteDefaultSenderId where
  toJSON :: DeleteDefaultSenderId -> Value
toJSON DeleteDefaultSenderId' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteDefaultSenderId' :: DeleteDefaultSenderId -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ConfigurationSetName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
configurationSetName
              )
          ]
      )

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

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

-- | /See:/ 'newDeleteDefaultSenderIdResponse' smart constructor.
data DeleteDefaultSenderIdResponse = DeleteDefaultSenderIdResponse'
  { -- | The Amazon Resource Name (ARN) of the configuration set.
    DeleteDefaultSenderIdResponse -> Maybe Text
configurationSetArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the configuration set.
    DeleteDefaultSenderIdResponse -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
    -- | The current sender ID for the configuration set.
    DeleteDefaultSenderIdResponse -> Maybe Text
senderId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteDefaultSenderIdResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDefaultSenderIdResponse
-> DeleteDefaultSenderIdResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDefaultSenderIdResponse
-> DeleteDefaultSenderIdResponse -> Bool
$c/= :: DeleteDefaultSenderIdResponse
-> DeleteDefaultSenderIdResponse -> Bool
== :: DeleteDefaultSenderIdResponse
-> DeleteDefaultSenderIdResponse -> Bool
$c== :: DeleteDefaultSenderIdResponse
-> DeleteDefaultSenderIdResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDefaultSenderIdResponse]
ReadPrec DeleteDefaultSenderIdResponse
Int -> ReadS DeleteDefaultSenderIdResponse
ReadS [DeleteDefaultSenderIdResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDefaultSenderIdResponse]
$creadListPrec :: ReadPrec [DeleteDefaultSenderIdResponse]
readPrec :: ReadPrec DeleteDefaultSenderIdResponse
$creadPrec :: ReadPrec DeleteDefaultSenderIdResponse
readList :: ReadS [DeleteDefaultSenderIdResponse]
$creadList :: ReadS [DeleteDefaultSenderIdResponse]
readsPrec :: Int -> ReadS DeleteDefaultSenderIdResponse
$creadsPrec :: Int -> ReadS DeleteDefaultSenderIdResponse
Prelude.Read, Int -> DeleteDefaultSenderIdResponse -> ShowS
[DeleteDefaultSenderIdResponse] -> ShowS
DeleteDefaultSenderIdResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDefaultSenderIdResponse] -> ShowS
$cshowList :: [DeleteDefaultSenderIdResponse] -> ShowS
show :: DeleteDefaultSenderIdResponse -> String
$cshow :: DeleteDefaultSenderIdResponse -> String
showsPrec :: Int -> DeleteDefaultSenderIdResponse -> ShowS
$cshowsPrec :: Int -> DeleteDefaultSenderIdResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteDefaultSenderIdResponse x
-> DeleteDefaultSenderIdResponse
forall x.
DeleteDefaultSenderIdResponse
-> Rep DeleteDefaultSenderIdResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDefaultSenderIdResponse x
-> DeleteDefaultSenderIdResponse
$cfrom :: forall x.
DeleteDefaultSenderIdResponse
-> Rep DeleteDefaultSenderIdResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDefaultSenderIdResponse' 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:
--
-- 'configurationSetArn', 'deleteDefaultSenderIdResponse_configurationSetArn' - The Amazon Resource Name (ARN) of the configuration set.
--
-- 'configurationSetName', 'deleteDefaultSenderIdResponse_configurationSetName' - The name of the configuration set.
--
-- 'senderId', 'deleteDefaultSenderIdResponse_senderId' - The current sender ID for the configuration set.
--
-- 'httpStatus', 'deleteDefaultSenderIdResponse_httpStatus' - The response's http status code.
newDeleteDefaultSenderIdResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDefaultSenderIdResponse
newDeleteDefaultSenderIdResponse :: Int -> DeleteDefaultSenderIdResponse
newDeleteDefaultSenderIdResponse Int
pHttpStatus_ =
  DeleteDefaultSenderIdResponse'
    { $sel:configurationSetArn:DeleteDefaultSenderIdResponse' :: Maybe Text
configurationSetArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:configurationSetName:DeleteDefaultSenderIdResponse' :: Maybe Text
configurationSetName = forall a. Maybe a
Prelude.Nothing,
      $sel:senderId:DeleteDefaultSenderIdResponse' :: Maybe Text
senderId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteDefaultSenderIdResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the configuration set.
deleteDefaultSenderIdResponse_configurationSetArn :: Lens.Lens' DeleteDefaultSenderIdResponse (Prelude.Maybe Prelude.Text)
deleteDefaultSenderIdResponse_configurationSetArn :: Lens' DeleteDefaultSenderIdResponse (Maybe Text)
deleteDefaultSenderIdResponse_configurationSetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDefaultSenderIdResponse' {Maybe Text
configurationSetArn :: Maybe Text
$sel:configurationSetArn:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
configurationSetArn} -> Maybe Text
configurationSetArn) (\s :: DeleteDefaultSenderIdResponse
s@DeleteDefaultSenderIdResponse' {} Maybe Text
a -> DeleteDefaultSenderIdResponse
s {$sel:configurationSetArn:DeleteDefaultSenderIdResponse' :: Maybe Text
configurationSetArn = Maybe Text
a} :: DeleteDefaultSenderIdResponse)

-- | The name of the configuration set.
deleteDefaultSenderIdResponse_configurationSetName :: Lens.Lens' DeleteDefaultSenderIdResponse (Prelude.Maybe Prelude.Text)
deleteDefaultSenderIdResponse_configurationSetName :: Lens' DeleteDefaultSenderIdResponse (Maybe Text)
deleteDefaultSenderIdResponse_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDefaultSenderIdResponse' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: DeleteDefaultSenderIdResponse
s@DeleteDefaultSenderIdResponse' {} Maybe Text
a -> DeleteDefaultSenderIdResponse
s {$sel:configurationSetName:DeleteDefaultSenderIdResponse' :: Maybe Text
configurationSetName = Maybe Text
a} :: DeleteDefaultSenderIdResponse)

-- | The current sender ID for the configuration set.
deleteDefaultSenderIdResponse_senderId :: Lens.Lens' DeleteDefaultSenderIdResponse (Prelude.Maybe Prelude.Text)
deleteDefaultSenderIdResponse_senderId :: Lens' DeleteDefaultSenderIdResponse (Maybe Text)
deleteDefaultSenderIdResponse_senderId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDefaultSenderIdResponse' {Maybe Text
senderId :: Maybe Text
$sel:senderId:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
senderId} -> Maybe Text
senderId) (\s :: DeleteDefaultSenderIdResponse
s@DeleteDefaultSenderIdResponse' {} Maybe Text
a -> DeleteDefaultSenderIdResponse
s {$sel:senderId:DeleteDefaultSenderIdResponse' :: Maybe Text
senderId = Maybe Text
a} :: DeleteDefaultSenderIdResponse)

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

instance Prelude.NFData DeleteDefaultSenderIdResponse where
  rnf :: DeleteDefaultSenderIdResponse -> ()
rnf DeleteDefaultSenderIdResponse' {Int
Maybe Text
httpStatus :: Int
senderId :: Maybe Text
configurationSetName :: Maybe Text
configurationSetArn :: Maybe Text
$sel:httpStatus:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Int
$sel:senderId:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
$sel:configurationSetName:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
$sel:configurationSetArn:DeleteDefaultSenderIdResponse' :: DeleteDefaultSenderIdResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
senderId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus