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

    -- * Request Lenses
    deleteAdmChannel_applicationId,

    -- * Destructuring the Response
    DeleteAdmChannelResponse (..),
    newDeleteAdmChannelResponse,

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

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

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

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

instance Prelude.Hashable DeleteAdmChannel

instance Prelude.NFData DeleteAdmChannel

instance Core.ToHeaders DeleteAdmChannel where
  toHeaders :: DeleteAdmChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAdmChannel -> 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 DeleteAdmChannel where
  toPath :: DeleteAdmChannel -> ByteString
toPath DeleteAdmChannel' {Text
applicationId :: Text
$sel:applicationId:DeleteAdmChannel' :: DeleteAdmChannel -> 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/adm"
      ]

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

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

-- |
-- Create a value of 'DeleteAdmChannelResponse' 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', 'deleteAdmChannelResponse_httpStatus' - The response's http status code.
--
-- 'aDMChannelResponse', 'deleteAdmChannelResponse_aDMChannelResponse' - Undocumented member.
newDeleteAdmChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aDMChannelResponse'
  ADMChannelResponse ->
  DeleteAdmChannelResponse
newDeleteAdmChannelResponse :: Int -> ADMChannelResponse -> DeleteAdmChannelResponse
newDeleteAdmChannelResponse
  Int
pHttpStatus_
  ADMChannelResponse
pADMChannelResponse_ =
    DeleteAdmChannelResponse' :: Int -> ADMChannelResponse -> DeleteAdmChannelResponse
DeleteAdmChannelResponse'
      { $sel:httpStatus:DeleteAdmChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aDMChannelResponse:DeleteAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
pADMChannelResponse_
      }

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

-- | Undocumented member.
deleteAdmChannelResponse_aDMChannelResponse :: Lens.Lens' DeleteAdmChannelResponse ADMChannelResponse
deleteAdmChannelResponse_aDMChannelResponse :: (ADMChannelResponse -> f ADMChannelResponse)
-> DeleteAdmChannelResponse -> f DeleteAdmChannelResponse
deleteAdmChannelResponse_aDMChannelResponse = (DeleteAdmChannelResponse -> ADMChannelResponse)
-> (DeleteAdmChannelResponse
    -> ADMChannelResponse -> DeleteAdmChannelResponse)
-> Lens
     DeleteAdmChannelResponse
     DeleteAdmChannelResponse
     ADMChannelResponse
     ADMChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAdmChannelResponse' {ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
$sel:aDMChannelResponse:DeleteAdmChannelResponse' :: DeleteAdmChannelResponse -> ADMChannelResponse
aDMChannelResponse} -> ADMChannelResponse
aDMChannelResponse) (\s :: DeleteAdmChannelResponse
s@DeleteAdmChannelResponse' {} ADMChannelResponse
a -> DeleteAdmChannelResponse
s {$sel:aDMChannelResponse:DeleteAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
a} :: DeleteAdmChannelResponse)

instance Prelude.NFData DeleteAdmChannelResponse