{-# 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 #-}
module Amazonka.DMS.DeleteConnection
(
DeleteConnection (..),
newDeleteConnection,
deleteConnection_endpointArn,
deleteConnection_replicationInstanceArn,
DeleteConnectionResponse (..),
newDeleteConnectionResponse,
deleteConnectionResponse_connection,
deleteConnectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DMS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteConnection = DeleteConnection'
{
DeleteConnection -> Text
endpointArn :: Prelude.Text,
DeleteConnection -> Text
replicationInstanceArn :: Prelude.Text
}
deriving (DeleteConnection -> DeleteConnection -> Bool
(DeleteConnection -> DeleteConnection -> Bool)
-> (DeleteConnection -> DeleteConnection -> Bool)
-> Eq DeleteConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConnection -> DeleteConnection -> Bool
$c/= :: DeleteConnection -> DeleteConnection -> Bool
== :: DeleteConnection -> DeleteConnection -> Bool
$c== :: DeleteConnection -> DeleteConnection -> Bool
Prelude.Eq, ReadPrec [DeleteConnection]
ReadPrec DeleteConnection
Int -> ReadS DeleteConnection
ReadS [DeleteConnection]
(Int -> ReadS DeleteConnection)
-> ReadS [DeleteConnection]
-> ReadPrec DeleteConnection
-> ReadPrec [DeleteConnection]
-> Read DeleteConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConnection]
$creadListPrec :: ReadPrec [DeleteConnection]
readPrec :: ReadPrec DeleteConnection
$creadPrec :: ReadPrec DeleteConnection
readList :: ReadS [DeleteConnection]
$creadList :: ReadS [DeleteConnection]
readsPrec :: Int -> ReadS DeleteConnection
$creadsPrec :: Int -> ReadS DeleteConnection
Prelude.Read, Int -> DeleteConnection -> ShowS
[DeleteConnection] -> ShowS
DeleteConnection -> String
(Int -> DeleteConnection -> ShowS)
-> (DeleteConnection -> String)
-> ([DeleteConnection] -> ShowS)
-> Show DeleteConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConnection] -> ShowS
$cshowList :: [DeleteConnection] -> ShowS
show :: DeleteConnection -> String
$cshow :: DeleteConnection -> String
showsPrec :: Int -> DeleteConnection -> ShowS
$cshowsPrec :: Int -> DeleteConnection -> ShowS
Prelude.Show, (forall x. DeleteConnection -> Rep DeleteConnection x)
-> (forall x. Rep DeleteConnection x -> DeleteConnection)
-> Generic DeleteConnection
forall x. Rep DeleteConnection x -> DeleteConnection
forall x. DeleteConnection -> Rep DeleteConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConnection x -> DeleteConnection
$cfrom :: forall x. DeleteConnection -> Rep DeleteConnection x
Prelude.Generic)
newDeleteConnection ::
Prelude.Text ->
Prelude.Text ->
DeleteConnection
newDeleteConnection :: Text -> Text -> DeleteConnection
newDeleteConnection
Text
pEndpointArn_
Text
pReplicationInstanceArn_ =
DeleteConnection' :: Text -> Text -> DeleteConnection
DeleteConnection'
{ $sel:endpointArn:DeleteConnection' :: Text
endpointArn = Text
pEndpointArn_,
$sel:replicationInstanceArn:DeleteConnection' :: Text
replicationInstanceArn = Text
pReplicationInstanceArn_
}
deleteConnection_endpointArn :: Lens.Lens' DeleteConnection Prelude.Text
deleteConnection_endpointArn :: (Text -> f Text) -> DeleteConnection -> f DeleteConnection
deleteConnection_endpointArn = (DeleteConnection -> Text)
-> (DeleteConnection -> Text -> DeleteConnection)
-> Lens DeleteConnection DeleteConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnection' {Text
endpointArn :: Text
$sel:endpointArn:DeleteConnection' :: DeleteConnection -> Text
endpointArn} -> Text
endpointArn) (\s :: DeleteConnection
s@DeleteConnection' {} Text
a -> DeleteConnection
s {$sel:endpointArn:DeleteConnection' :: Text
endpointArn = Text
a} :: DeleteConnection)
deleteConnection_replicationInstanceArn :: Lens.Lens' DeleteConnection Prelude.Text
deleteConnection_replicationInstanceArn :: (Text -> f Text) -> DeleteConnection -> f DeleteConnection
deleteConnection_replicationInstanceArn = (DeleteConnection -> Text)
-> (DeleteConnection -> Text -> DeleteConnection)
-> Lens DeleteConnection DeleteConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnection' {Text
replicationInstanceArn :: Text
$sel:replicationInstanceArn:DeleteConnection' :: DeleteConnection -> Text
replicationInstanceArn} -> Text
replicationInstanceArn) (\s :: DeleteConnection
s@DeleteConnection' {} Text
a -> DeleteConnection
s {$sel:replicationInstanceArn:DeleteConnection' :: Text
replicationInstanceArn = Text
a} :: DeleteConnection)
instance Core.AWSRequest DeleteConnection where
type
AWSResponse DeleteConnection =
DeleteConnectionResponse
request :: DeleteConnection -> Request DeleteConnection
request = Service -> DeleteConnection -> Request DeleteConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteConnection))
-> Logger
-> Service
-> Proxy DeleteConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Connection -> Int -> DeleteConnectionResponse
DeleteConnectionResponse'
(Maybe Connection -> Int -> DeleteConnectionResponse)
-> Either String (Maybe Connection)
-> Either String (Int -> DeleteConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Connection)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Connection")
Either String (Int -> DeleteConnectionResponse)
-> Either String Int -> Either String DeleteConnectionResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteConnection
instance Prelude.NFData DeleteConnection
instance Core.ToHeaders DeleteConnection where
toHeaders :: DeleteConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteConnection -> 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
"AmazonDMSv20160101.DeleteConnection" ::
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 DeleteConnection where
toJSON :: DeleteConnection -> Value
toJSON DeleteConnection' {Text
replicationInstanceArn :: Text
endpointArn :: Text
$sel:replicationInstanceArn:DeleteConnection' :: DeleteConnection -> Text
$sel:endpointArn:DeleteConnection' :: DeleteConnection -> 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
"EndpointArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ReplicationInstanceArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replicationInstanceArn
)
]
)
instance Core.ToPath DeleteConnection where
toPath :: DeleteConnection -> ByteString
toPath = ByteString -> DeleteConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteConnection where
toQuery :: DeleteConnection -> QueryString
toQuery = QueryString -> DeleteConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteConnectionResponse = DeleteConnectionResponse'
{
DeleteConnectionResponse -> Maybe Connection
connection :: Prelude.Maybe Connection,
DeleteConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteConnectionResponse -> DeleteConnectionResponse -> Bool
(DeleteConnectionResponse -> DeleteConnectionResponse -> Bool)
-> (DeleteConnectionResponse -> DeleteConnectionResponse -> Bool)
-> Eq DeleteConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConnectionResponse -> DeleteConnectionResponse -> Bool
$c/= :: DeleteConnectionResponse -> DeleteConnectionResponse -> Bool
== :: DeleteConnectionResponse -> DeleteConnectionResponse -> Bool
$c== :: DeleteConnectionResponse -> DeleteConnectionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteConnectionResponse]
ReadPrec DeleteConnectionResponse
Int -> ReadS DeleteConnectionResponse
ReadS [DeleteConnectionResponse]
(Int -> ReadS DeleteConnectionResponse)
-> ReadS [DeleteConnectionResponse]
-> ReadPrec DeleteConnectionResponse
-> ReadPrec [DeleteConnectionResponse]
-> Read DeleteConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConnectionResponse]
$creadListPrec :: ReadPrec [DeleteConnectionResponse]
readPrec :: ReadPrec DeleteConnectionResponse
$creadPrec :: ReadPrec DeleteConnectionResponse
readList :: ReadS [DeleteConnectionResponse]
$creadList :: ReadS [DeleteConnectionResponse]
readsPrec :: Int -> ReadS DeleteConnectionResponse
$creadsPrec :: Int -> ReadS DeleteConnectionResponse
Prelude.Read, Int -> DeleteConnectionResponse -> ShowS
[DeleteConnectionResponse] -> ShowS
DeleteConnectionResponse -> String
(Int -> DeleteConnectionResponse -> ShowS)
-> (DeleteConnectionResponse -> String)
-> ([DeleteConnectionResponse] -> ShowS)
-> Show DeleteConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConnectionResponse] -> ShowS
$cshowList :: [DeleteConnectionResponse] -> ShowS
show :: DeleteConnectionResponse -> String
$cshow :: DeleteConnectionResponse -> String
showsPrec :: Int -> DeleteConnectionResponse -> ShowS
$cshowsPrec :: Int -> DeleteConnectionResponse -> ShowS
Prelude.Show, (forall x.
DeleteConnectionResponse -> Rep DeleteConnectionResponse x)
-> (forall x.
Rep DeleteConnectionResponse x -> DeleteConnectionResponse)
-> Generic DeleteConnectionResponse
forall x.
Rep DeleteConnectionResponse x -> DeleteConnectionResponse
forall x.
DeleteConnectionResponse -> Rep DeleteConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConnectionResponse x -> DeleteConnectionResponse
$cfrom :: forall x.
DeleteConnectionResponse -> Rep DeleteConnectionResponse x
Prelude.Generic)
newDeleteConnectionResponse ::
Prelude.Int ->
DeleteConnectionResponse
newDeleteConnectionResponse :: Int -> DeleteConnectionResponse
newDeleteConnectionResponse Int
pHttpStatus_ =
DeleteConnectionResponse' :: Maybe Connection -> Int -> DeleteConnectionResponse
DeleteConnectionResponse'
{ $sel:connection:DeleteConnectionResponse' :: Maybe Connection
connection =
Maybe Connection
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteConnectionResponse_connection :: Lens.Lens' DeleteConnectionResponse (Prelude.Maybe Connection)
deleteConnectionResponse_connection :: (Maybe Connection -> f (Maybe Connection))
-> DeleteConnectionResponse -> f DeleteConnectionResponse
deleteConnectionResponse_connection = (DeleteConnectionResponse -> Maybe Connection)
-> (DeleteConnectionResponse
-> Maybe Connection -> DeleteConnectionResponse)
-> Lens
DeleteConnectionResponse
DeleteConnectionResponse
(Maybe Connection)
(Maybe Connection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectionResponse' {Maybe Connection
connection :: Maybe Connection
$sel:connection:DeleteConnectionResponse' :: DeleteConnectionResponse -> Maybe Connection
connection} -> Maybe Connection
connection) (\s :: DeleteConnectionResponse
s@DeleteConnectionResponse' {} Maybe Connection
a -> DeleteConnectionResponse
s {$sel:connection:DeleteConnectionResponse' :: Maybe Connection
connection = Maybe Connection
a} :: DeleteConnectionResponse)
deleteConnectionResponse_httpStatus :: Lens.Lens' DeleteConnectionResponse Prelude.Int
deleteConnectionResponse_httpStatus :: (Int -> f Int)
-> DeleteConnectionResponse -> f DeleteConnectionResponse
deleteConnectionResponse_httpStatus = (DeleteConnectionResponse -> Int)
-> (DeleteConnectionResponse -> Int -> DeleteConnectionResponse)
-> Lens DeleteConnectionResponse DeleteConnectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteConnectionResponse' :: DeleteConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteConnectionResponse
s@DeleteConnectionResponse' {} Int
a -> DeleteConnectionResponse
s {$sel:httpStatus:DeleteConnectionResponse' :: Int
httpStatus = Int
a} :: DeleteConnectionResponse)
instance Prelude.NFData DeleteConnectionResponse