{-# 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-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 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.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:/ '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
(DeactivateContactChannel -> DeactivateContactChannel -> Bool)
-> (DeactivateContactChannel -> DeactivateContactChannel -> Bool)
-> Eq DeactivateContactChannel
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]
(Int -> ReadS DeactivateContactChannel)
-> ReadS [DeactivateContactChannel]
-> ReadPrec DeactivateContactChannel
-> ReadPrec [DeactivateContactChannel]
-> Read 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
(Int -> DeactivateContactChannel -> ShowS)
-> (DeactivateContactChannel -> String)
-> ([DeactivateContactChannel] -> ShowS)
-> Show DeactivateContactChannel
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.
 DeactivateContactChannel -> Rep DeactivateContactChannel x)
-> (forall x.
    Rep DeactivateContactChannel x -> DeactivateContactChannel)
-> Generic DeactivateContactChannel
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' :: Text -> DeactivateContactChannel
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 :: (Text -> f Text)
-> DeactivateContactChannel -> f DeactivateContactChannel
deactivateContactChannel_contactChannelId = (DeactivateContactChannel -> Text)
-> (DeactivateContactChannel -> Text -> DeactivateContactChannel)
-> Lens DeactivateContactChannel DeactivateContactChannel Text Text
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 :: DeactivateContactChannel -> Request DeactivateContactChannel
request = Service
-> DeactivateContactChannel -> Request DeactivateContactChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeactivateContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateContactChannel)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeactivateContactChannel))
-> Logger
-> Service
-> Proxy DeactivateContactChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateContactChannel)))
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 -> DeactivateContactChannelResponse
DeactivateContactChannelResponse'
            (Int -> DeactivateContactChannelResponse)
-> Either String Int
-> Either String DeactivateContactChannelResponse
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 DeactivateContactChannel

instance Prelude.NFData DeactivateContactChannel

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

instance Core.ToQuery DeactivateContactChannel where
  toQuery :: DeactivateContactChannel -> QueryString
toQuery = QueryString -> DeactivateContactChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeactivateContactChannelResponse
 -> DeactivateContactChannelResponse -> Bool)
-> (DeactivateContactChannelResponse
    -> DeactivateContactChannelResponse -> Bool)
-> Eq DeactivateContactChannelResponse
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]
(Int -> ReadS DeactivateContactChannelResponse)
-> ReadS [DeactivateContactChannelResponse]
-> ReadPrec DeactivateContactChannelResponse
-> ReadPrec [DeactivateContactChannelResponse]
-> Read 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
(Int -> DeactivateContactChannelResponse -> ShowS)
-> (DeactivateContactChannelResponse -> String)
-> ([DeactivateContactChannelResponse] -> ShowS)
-> Show DeactivateContactChannelResponse
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.
 DeactivateContactChannelResponse
 -> Rep DeactivateContactChannelResponse x)
-> (forall x.
    Rep DeactivateContactChannelResponse x
    -> DeactivateContactChannelResponse)
-> Generic DeactivateContactChannelResponse
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' :: Int -> DeactivateContactChannelResponse
DeactivateContactChannelResponse'
    { $sel:httpStatus:DeactivateContactChannelResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deactivateContactChannelResponse_httpStatus :: Lens.Lens' DeactivateContactChannelResponse Prelude.Int
deactivateContactChannelResponse_httpStatus :: (Int -> f Int)
-> DeactivateContactChannelResponse
-> f DeactivateContactChannelResponse
deactivateContactChannelResponse_httpStatus = (DeactivateContactChannelResponse -> Int)
-> (DeactivateContactChannelResponse
    -> Int -> DeactivateContactChannelResponse)
-> Lens
     DeactivateContactChannelResponse
     DeactivateContactChannelResponse
     Int
     Int
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