{-# 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.SSMContacts.DeleteContactChannel
-- 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)
--
-- To no longer receive engagements on a contact channel, you can delete
-- the channel from a contact. Deleting the contact channel removes it from
-- the contact\'s engagement plan. If you delete the only contact channel
-- for a contact, you won\'t be able to engage that contact during an
-- incident.
module Amazonka.SSMContacts.DeleteContactChannel
  ( -- * Creating a Request
    DeleteContactChannel (..),
    newDeleteContactChannel,

    -- * Request Lenses
    deleteContactChannel_contactChannelId,

    -- * Destructuring the Response
    DeleteContactChannelResponse (..),
    newDeleteContactChannelResponse,

    -- * Response Lenses
    deleteContactChannelResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteContactChannel' smart constructor.
data DeleteContactChannel = DeleteContactChannel'
  { -- | The Amazon Resource Name (ARN) of the contact channel.
    DeleteContactChannel -> Text
contactChannelId :: Prelude.Text
  }
  deriving (DeleteContactChannel -> DeleteContactChannel -> Bool
(DeleteContactChannel -> DeleteContactChannel -> Bool)
-> (DeleteContactChannel -> DeleteContactChannel -> Bool)
-> Eq DeleteContactChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteContactChannel -> DeleteContactChannel -> Bool
$c/= :: DeleteContactChannel -> DeleteContactChannel -> Bool
== :: DeleteContactChannel -> DeleteContactChannel -> Bool
$c== :: DeleteContactChannel -> DeleteContactChannel -> Bool
Prelude.Eq, ReadPrec [DeleteContactChannel]
ReadPrec DeleteContactChannel
Int -> ReadS DeleteContactChannel
ReadS [DeleteContactChannel]
(Int -> ReadS DeleteContactChannel)
-> ReadS [DeleteContactChannel]
-> ReadPrec DeleteContactChannel
-> ReadPrec [DeleteContactChannel]
-> Read DeleteContactChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteContactChannel]
$creadListPrec :: ReadPrec [DeleteContactChannel]
readPrec :: ReadPrec DeleteContactChannel
$creadPrec :: ReadPrec DeleteContactChannel
readList :: ReadS [DeleteContactChannel]
$creadList :: ReadS [DeleteContactChannel]
readsPrec :: Int -> ReadS DeleteContactChannel
$creadsPrec :: Int -> ReadS DeleteContactChannel
Prelude.Read, Int -> DeleteContactChannel -> ShowS
[DeleteContactChannel] -> ShowS
DeleteContactChannel -> String
(Int -> DeleteContactChannel -> ShowS)
-> (DeleteContactChannel -> String)
-> ([DeleteContactChannel] -> ShowS)
-> Show DeleteContactChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteContactChannel] -> ShowS
$cshowList :: [DeleteContactChannel] -> ShowS
show :: DeleteContactChannel -> String
$cshow :: DeleteContactChannel -> String
showsPrec :: Int -> DeleteContactChannel -> ShowS
$cshowsPrec :: Int -> DeleteContactChannel -> ShowS
Prelude.Show, (forall x. DeleteContactChannel -> Rep DeleteContactChannel x)
-> (forall x. Rep DeleteContactChannel x -> DeleteContactChannel)
-> Generic DeleteContactChannel
forall x. Rep DeleteContactChannel x -> DeleteContactChannel
forall x. DeleteContactChannel -> Rep DeleteContactChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteContactChannel x -> DeleteContactChannel
$cfrom :: forall x. DeleteContactChannel -> Rep DeleteContactChannel x
Prelude.Generic)

-- |
-- Create a value of 'DeleteContactChannel' 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:
--
-- 'contactChannelId', 'deleteContactChannel_contactChannelId' - The Amazon Resource Name (ARN) of the contact channel.
newDeleteContactChannel ::
  -- | 'contactChannelId'
  Prelude.Text ->
  DeleteContactChannel
newDeleteContactChannel :: Text -> DeleteContactChannel
newDeleteContactChannel Text
pContactChannelId_ =
  DeleteContactChannel' :: Text -> DeleteContactChannel
DeleteContactChannel'
    { $sel:contactChannelId:DeleteContactChannel' :: Text
contactChannelId =
        Text
pContactChannelId_
    }

-- | The Amazon Resource Name (ARN) of the contact channel.
deleteContactChannel_contactChannelId :: Lens.Lens' DeleteContactChannel Prelude.Text
deleteContactChannel_contactChannelId :: (Text -> f Text) -> DeleteContactChannel -> f DeleteContactChannel
deleteContactChannel_contactChannelId = (DeleteContactChannel -> Text)
-> (DeleteContactChannel -> Text -> DeleteContactChannel)
-> Lens DeleteContactChannel DeleteContactChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:DeleteContactChannel' :: DeleteContactChannel -> Text
contactChannelId} -> Text
contactChannelId) (\s :: DeleteContactChannel
s@DeleteContactChannel' {} Text
a -> DeleteContactChannel
s {$sel:contactChannelId:DeleteContactChannel' :: Text
contactChannelId = Text
a} :: DeleteContactChannel)

instance Core.AWSRequest DeleteContactChannel where
  type
    AWSResponse DeleteContactChannel =
      DeleteContactChannelResponse
  request :: DeleteContactChannel -> Request DeleteContactChannel
request = Service -> DeleteContactChannel -> Request DeleteContactChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactChannel)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteContactChannel))
-> Logger
-> Service
-> Proxy DeleteContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactChannel)))
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 -> DeleteContactChannelResponse
DeleteContactChannelResponse'
            (Int -> DeleteContactChannelResponse)
-> Either String Int -> Either String DeleteContactChannelResponse
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 DeleteContactChannel

instance Prelude.NFData DeleteContactChannel

instance Core.ToHeaders DeleteContactChannel where
  toHeaders :: DeleteContactChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteContactChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SSMContacts.DeleteContactChannel" ::
                          Prelude.ByteString
                      ),
            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 DeleteContactChannel where
  toJSON :: DeleteContactChannel -> Value
toJSON DeleteContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:DeleteContactChannel' :: DeleteContactChannel -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ContactChannelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactChannelId)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteContactChannelResponse