{-# 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.SMS.DisassociateConnector
-- 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)
--
-- Disassociates the specified connector from AWS SMS.
--
-- After you disassociate a connector, it is no longer available to support
-- replication jobs.
module Amazonka.SMS.DisassociateConnector
  ( -- * Creating a Request
    DisassociateConnector (..),
    newDisassociateConnector,

    -- * Request Lenses
    disassociateConnector_connectorId,

    -- * Destructuring the Response
    DisassociateConnectorResponse (..),
    newDisassociateConnectorResponse,

    -- * Response Lenses
    disassociateConnectorResponse_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.SMS.Types

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

-- |
-- Create a value of 'DisassociateConnector' 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:
--
-- 'connectorId', 'disassociateConnector_connectorId' - The ID of the connector.
newDisassociateConnector ::
  -- | 'connectorId'
  Prelude.Text ->
  DisassociateConnector
newDisassociateConnector :: Text -> DisassociateConnector
newDisassociateConnector Text
pConnectorId_ =
  DisassociateConnector' :: Text -> DisassociateConnector
DisassociateConnector' {$sel:connectorId:DisassociateConnector' :: Text
connectorId = Text
pConnectorId_}

-- | The ID of the connector.
disassociateConnector_connectorId :: Lens.Lens' DisassociateConnector Prelude.Text
disassociateConnector_connectorId :: (Text -> f Text)
-> DisassociateConnector -> f DisassociateConnector
disassociateConnector_connectorId = (DisassociateConnector -> Text)
-> (DisassociateConnector -> Text -> DisassociateConnector)
-> Lens DisassociateConnector DisassociateConnector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateConnector' {Text
connectorId :: Text
$sel:connectorId:DisassociateConnector' :: DisassociateConnector -> Text
connectorId} -> Text
connectorId) (\s :: DisassociateConnector
s@DisassociateConnector' {} Text
a -> DisassociateConnector
s {$sel:connectorId:DisassociateConnector' :: Text
connectorId = Text
a} :: DisassociateConnector)

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

instance Prelude.NFData DisassociateConnector

instance Core.ToHeaders DisassociateConnector where
  toHeaders :: DisassociateConnector -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateConnector -> 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
"AWSServerMigrationService_V2016_10_24.DisassociateConnector" ::
                          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 DisassociateConnector where
  toJSON :: DisassociateConnector -> Value
toJSON DisassociateConnector' {Text
connectorId :: Text
$sel:connectorId:DisassociateConnector' :: DisassociateConnector -> 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
"connectorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectorId)]
      )

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

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

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

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

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

instance Prelude.NFData DisassociateConnectorResponse