{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $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 :: Lens' DeleteContactChannel Text
deleteContactChannel_contactChannelId = 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 :: (Service -> Service)
-> DeleteContactChannel -> Request DeleteContactChannel
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 DeleteContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContactChannel)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteContactChannelResponse
DeleteContactChannelResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteContactChannel where
  hashWithSalt :: Int -> DeleteContactChannel -> Int
hashWithSalt Int
_salt DeleteContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:DeleteContactChannel' :: DeleteContactChannel -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactChannelId

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

instance Data.ToHeaders DeleteContactChannel where
  toHeaders :: DeleteContactChannel -> 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
"SSMContacts.DeleteContactChannel" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

instance Data.ToQuery DeleteContactChannel where
  toQuery :: DeleteContactChannel -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeleteContactChannelResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteContactChannelResponse_httpStatus :: Lens.Lens' DeleteContactChannelResponse Prelude.Int
deleteContactChannelResponse_httpStatus :: Lens' DeleteContactChannelResponse Int
deleteContactChannelResponse_httpStatus = 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 where
  rnf :: DeleteContactChannelResponse -> ()
rnf DeleteContactChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteContactChannelResponse' :: DeleteContactChannelResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus