{-# 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.DeactivateContactChannel
-- 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 Incident Manager engagements to a contact channel,
-- you can deactivate the channel.
module Amazonka.SSMContacts.DeactivateContactChannel
  ( -- * Creating a Request
    DeactivateContactChannel (..),
    newDeactivateContactChannel,

    -- * Request Lenses
    deactivateContactChannel_contactChannelId,

    -- * Destructuring the Response
    DeactivateContactChannelResponse (..),
    newDeactivateContactChannelResponse,

    -- * Response Lenses
    deactivateContactChannelResponse_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:/ 'newDeactivateContactChannel' smart constructor.
data DeactivateContactChannel = DeactivateContactChannel'
  { -- | The Amazon Resource Name (ARN) of the contact channel you\'re
    -- deactivating.
    DeactivateContactChannel -> Text
contactChannelId :: Prelude.Text
  }
  deriving (DeactivateContactChannel -> DeactivateContactChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeactivateContactChannel -> DeactivateContactChannel -> Bool
$c/= :: DeactivateContactChannel -> DeactivateContactChannel -> Bool
== :: DeactivateContactChannel -> DeactivateContactChannel -> Bool
$c== :: DeactivateContactChannel -> DeactivateContactChannel -> Bool
Prelude.Eq, ReadPrec [DeactivateContactChannel]
ReadPrec DeactivateContactChannel
Int -> ReadS DeactivateContactChannel
ReadS [DeactivateContactChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeactivateContactChannel]
$creadListPrec :: ReadPrec [DeactivateContactChannel]
readPrec :: ReadPrec DeactivateContactChannel
$creadPrec :: ReadPrec DeactivateContactChannel
readList :: ReadS [DeactivateContactChannel]
$creadList :: ReadS [DeactivateContactChannel]
readsPrec :: Int -> ReadS DeactivateContactChannel
$creadsPrec :: Int -> ReadS DeactivateContactChannel
Prelude.Read, Int -> DeactivateContactChannel -> ShowS
[DeactivateContactChannel] -> ShowS
DeactivateContactChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeactivateContactChannel] -> ShowS
$cshowList :: [DeactivateContactChannel] -> ShowS
show :: DeactivateContactChannel -> String
$cshow :: DeactivateContactChannel -> String
showsPrec :: Int -> DeactivateContactChannel -> ShowS
$cshowsPrec :: Int -> DeactivateContactChannel -> ShowS
Prelude.Show, forall x.
Rep DeactivateContactChannel x -> DeactivateContactChannel
forall x.
DeactivateContactChannel -> Rep DeactivateContactChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeactivateContactChannel x -> DeactivateContactChannel
$cfrom :: forall x.
DeactivateContactChannel -> Rep DeactivateContactChannel x
Prelude.Generic)

-- |
-- Create a value of 'DeactivateContactChannel' 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', 'deactivateContactChannel_contactChannelId' - The Amazon Resource Name (ARN) of the contact channel you\'re
-- deactivating.
newDeactivateContactChannel ::
  -- | 'contactChannelId'
  Prelude.Text ->
  DeactivateContactChannel
newDeactivateContactChannel :: Text -> DeactivateContactChannel
newDeactivateContactChannel Text
pContactChannelId_ =
  DeactivateContactChannel'
    { $sel:contactChannelId:DeactivateContactChannel' :: Text
contactChannelId =
        Text
pContactChannelId_
    }

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

instance Core.AWSRequest DeactivateContactChannel where
  type
    AWSResponse DeactivateContactChannel =
      DeactivateContactChannelResponse
  request :: (Service -> Service)
-> DeactivateContactChannel -> Request DeactivateContactChannel
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 DeactivateContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateContactChannel)))
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 -> DeactivateContactChannelResponse
DeactivateContactChannelResponse'
            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 DeactivateContactChannel where
  hashWithSalt :: Int -> DeactivateContactChannel -> Int
hashWithSalt Int
_salt DeactivateContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:DeactivateContactChannel' :: DeactivateContactChannel -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactChannelId

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

instance Data.ToHeaders DeactivateContactChannel where
  toHeaders :: DeactivateContactChannel -> 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.DeactivateContactChannel" ::
                          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 DeactivateContactChannel where
  toJSON :: DeactivateContactChannel -> Value
toJSON DeactivateContactChannel' {Text
contactChannelId :: Text
$sel:contactChannelId:DeactivateContactChannel' :: DeactivateContactChannel -> 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 DeactivateContactChannel where
  toPath :: DeactivateContactChannel -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance
  Prelude.NFData
    DeactivateContactChannelResponse
  where
  rnf :: DeactivateContactChannelResponse -> ()
rnf DeactivateContactChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeactivateContactChannelResponse' :: DeactivateContactChannelResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus