{-# 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.Pinpoint.DeleteEmailChannel
-- 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)
--
-- Disables the email channel for an application and deletes any existing
-- settings for the channel.
module Amazonka.Pinpoint.DeleteEmailChannel
  ( -- * Creating a Request
    DeleteEmailChannel (..),
    newDeleteEmailChannel,

    -- * Request Lenses
    deleteEmailChannel_applicationId,

    -- * Destructuring the Response
    DeleteEmailChannelResponse (..),
    newDeleteEmailChannelResponse,

    -- * Response Lenses
    deleteEmailChannelResponse_httpStatus,
    deleteEmailChannelResponse_emailChannelResponse,
  )
where

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

-- | /See:/ 'newDeleteEmailChannel' smart constructor.
data DeleteEmailChannel = DeleteEmailChannel'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    DeleteEmailChannel -> Text
applicationId :: Prelude.Text
  }
  deriving (DeleteEmailChannel -> DeleteEmailChannel -> Bool
(DeleteEmailChannel -> DeleteEmailChannel -> Bool)
-> (DeleteEmailChannel -> DeleteEmailChannel -> Bool)
-> Eq DeleteEmailChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEmailChannel -> DeleteEmailChannel -> Bool
$c/= :: DeleteEmailChannel -> DeleteEmailChannel -> Bool
== :: DeleteEmailChannel -> DeleteEmailChannel -> Bool
$c== :: DeleteEmailChannel -> DeleteEmailChannel -> Bool
Prelude.Eq, ReadPrec [DeleteEmailChannel]
ReadPrec DeleteEmailChannel
Int -> ReadS DeleteEmailChannel
ReadS [DeleteEmailChannel]
(Int -> ReadS DeleteEmailChannel)
-> ReadS [DeleteEmailChannel]
-> ReadPrec DeleteEmailChannel
-> ReadPrec [DeleteEmailChannel]
-> Read DeleteEmailChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEmailChannel]
$creadListPrec :: ReadPrec [DeleteEmailChannel]
readPrec :: ReadPrec DeleteEmailChannel
$creadPrec :: ReadPrec DeleteEmailChannel
readList :: ReadS [DeleteEmailChannel]
$creadList :: ReadS [DeleteEmailChannel]
readsPrec :: Int -> ReadS DeleteEmailChannel
$creadsPrec :: Int -> ReadS DeleteEmailChannel
Prelude.Read, Int -> DeleteEmailChannel -> ShowS
[DeleteEmailChannel] -> ShowS
DeleteEmailChannel -> String
(Int -> DeleteEmailChannel -> ShowS)
-> (DeleteEmailChannel -> String)
-> ([DeleteEmailChannel] -> ShowS)
-> Show DeleteEmailChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEmailChannel] -> ShowS
$cshowList :: [DeleteEmailChannel] -> ShowS
show :: DeleteEmailChannel -> String
$cshow :: DeleteEmailChannel -> String
showsPrec :: Int -> DeleteEmailChannel -> ShowS
$cshowsPrec :: Int -> DeleteEmailChannel -> ShowS
Prelude.Show, (forall x. DeleteEmailChannel -> Rep DeleteEmailChannel x)
-> (forall x. Rep DeleteEmailChannel x -> DeleteEmailChannel)
-> Generic DeleteEmailChannel
forall x. Rep DeleteEmailChannel x -> DeleteEmailChannel
forall x. DeleteEmailChannel -> Rep DeleteEmailChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEmailChannel x -> DeleteEmailChannel
$cfrom :: forall x. DeleteEmailChannel -> Rep DeleteEmailChannel x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEmailChannel' 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:
--
-- 'applicationId', 'deleteEmailChannel_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
newDeleteEmailChannel ::
  -- | 'applicationId'
  Prelude.Text ->
  DeleteEmailChannel
newDeleteEmailChannel :: Text -> DeleteEmailChannel
newDeleteEmailChannel Text
pApplicationId_ =
  DeleteEmailChannel' :: Text -> DeleteEmailChannel
DeleteEmailChannel'
    { $sel:applicationId:DeleteEmailChannel' :: Text
applicationId =
        Text
pApplicationId_
    }

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
deleteEmailChannel_applicationId :: Lens.Lens' DeleteEmailChannel Prelude.Text
deleteEmailChannel_applicationId :: (Text -> f Text) -> DeleteEmailChannel -> f DeleteEmailChannel
deleteEmailChannel_applicationId = (DeleteEmailChannel -> Text)
-> (DeleteEmailChannel -> Text -> DeleteEmailChannel)
-> Lens DeleteEmailChannel DeleteEmailChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailChannel' {Text
applicationId :: Text
$sel:applicationId:DeleteEmailChannel' :: DeleteEmailChannel -> Text
applicationId} -> Text
applicationId) (\s :: DeleteEmailChannel
s@DeleteEmailChannel' {} Text
a -> DeleteEmailChannel
s {$sel:applicationId:DeleteEmailChannel' :: Text
applicationId = Text
a} :: DeleteEmailChannel)

instance Core.AWSRequest DeleteEmailChannel where
  type
    AWSResponse DeleteEmailChannel =
      DeleteEmailChannelResponse
  request :: DeleteEmailChannel -> Request DeleteEmailChannel
request = Service -> DeleteEmailChannel -> Request DeleteEmailChannel
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEmailChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEmailChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteEmailChannel))
-> Logger
-> Service
-> Proxy DeleteEmailChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEmailChannel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> EmailChannelResponse -> DeleteEmailChannelResponse
DeleteEmailChannelResponse'
            (Int -> EmailChannelResponse -> DeleteEmailChannelResponse)
-> Either String Int
-> Either
     String (EmailChannelResponse -> DeleteEmailChannelResponse)
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))
            Either String (EmailChannelResponse -> DeleteEmailChannelResponse)
-> Either String EmailChannelResponse
-> Either String DeleteEmailChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String EmailChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteEmailChannel

instance Prelude.NFData DeleteEmailChannel

instance Core.ToHeaders DeleteEmailChannel where
  toHeaders :: DeleteEmailChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEmailChannel -> 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.ToPath DeleteEmailChannel where
  toPath :: DeleteEmailChannel -> ByteString
toPath DeleteEmailChannel' {Text
applicationId :: Text
$sel:applicationId:DeleteEmailChannel' :: DeleteEmailChannel -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/channels/email"
      ]

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

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

-- |
-- Create a value of 'DeleteEmailChannelResponse' 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', 'deleteEmailChannelResponse_httpStatus' - The response's http status code.
--
-- 'emailChannelResponse', 'deleteEmailChannelResponse_emailChannelResponse' - Undocumented member.
newDeleteEmailChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'emailChannelResponse'
  EmailChannelResponse ->
  DeleteEmailChannelResponse
newDeleteEmailChannelResponse :: Int -> EmailChannelResponse -> DeleteEmailChannelResponse
newDeleteEmailChannelResponse
  Int
pHttpStatus_
  EmailChannelResponse
pEmailChannelResponse_ =
    DeleteEmailChannelResponse' :: Int -> EmailChannelResponse -> DeleteEmailChannelResponse
DeleteEmailChannelResponse'
      { $sel:httpStatus:DeleteEmailChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:emailChannelResponse:DeleteEmailChannelResponse' :: EmailChannelResponse
emailChannelResponse = EmailChannelResponse
pEmailChannelResponse_
      }

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

-- | Undocumented member.
deleteEmailChannelResponse_emailChannelResponse :: Lens.Lens' DeleteEmailChannelResponse EmailChannelResponse
deleteEmailChannelResponse_emailChannelResponse :: (EmailChannelResponse -> f EmailChannelResponse)
-> DeleteEmailChannelResponse -> f DeleteEmailChannelResponse
deleteEmailChannelResponse_emailChannelResponse = (DeleteEmailChannelResponse -> EmailChannelResponse)
-> (DeleteEmailChannelResponse
    -> EmailChannelResponse -> DeleteEmailChannelResponse)
-> Lens
     DeleteEmailChannelResponse
     DeleteEmailChannelResponse
     EmailChannelResponse
     EmailChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailChannelResponse' {EmailChannelResponse
emailChannelResponse :: EmailChannelResponse
$sel:emailChannelResponse:DeleteEmailChannelResponse' :: DeleteEmailChannelResponse -> EmailChannelResponse
emailChannelResponse} -> EmailChannelResponse
emailChannelResponse) (\s :: DeleteEmailChannelResponse
s@DeleteEmailChannelResponse' {} EmailChannelResponse
a -> DeleteEmailChannelResponse
s {$sel:emailChannelResponse:DeleteEmailChannelResponse' :: EmailChannelResponse
emailChannelResponse = EmailChannelResponse
a} :: DeleteEmailChannelResponse)

instance Prelude.NFData DeleteEmailChannelResponse