{-# 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.DirectConnect.DeleteInterconnect
(
DeleteInterconnect (..),
newDeleteInterconnect,
deleteInterconnect_interconnectId,
DeleteInterconnectResponse (..),
newDeleteInterconnectResponse,
deleteInterconnectResponse_interconnectState,
deleteInterconnectResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.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 DeleteInterconnect = DeleteInterconnect'
{
DeleteInterconnect -> Text
interconnectId :: Prelude.Text
}
deriving (DeleteInterconnect -> DeleteInterconnect -> Bool
(DeleteInterconnect -> DeleteInterconnect -> Bool)
-> (DeleteInterconnect -> DeleteInterconnect -> Bool)
-> Eq DeleteInterconnect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInterconnect -> DeleteInterconnect -> Bool
$c/= :: DeleteInterconnect -> DeleteInterconnect -> Bool
== :: DeleteInterconnect -> DeleteInterconnect -> Bool
$c== :: DeleteInterconnect -> DeleteInterconnect -> Bool
Prelude.Eq, ReadPrec [DeleteInterconnect]
ReadPrec DeleteInterconnect
Int -> ReadS DeleteInterconnect
ReadS [DeleteInterconnect]
(Int -> ReadS DeleteInterconnect)
-> ReadS [DeleteInterconnect]
-> ReadPrec DeleteInterconnect
-> ReadPrec [DeleteInterconnect]
-> Read DeleteInterconnect
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInterconnect]
$creadListPrec :: ReadPrec [DeleteInterconnect]
readPrec :: ReadPrec DeleteInterconnect
$creadPrec :: ReadPrec DeleteInterconnect
readList :: ReadS [DeleteInterconnect]
$creadList :: ReadS [DeleteInterconnect]
readsPrec :: Int -> ReadS DeleteInterconnect
$creadsPrec :: Int -> ReadS DeleteInterconnect
Prelude.Read, Int -> DeleteInterconnect -> ShowS
[DeleteInterconnect] -> ShowS
DeleteInterconnect -> String
(Int -> DeleteInterconnect -> ShowS)
-> (DeleteInterconnect -> String)
-> ([DeleteInterconnect] -> ShowS)
-> Show DeleteInterconnect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInterconnect] -> ShowS
$cshowList :: [DeleteInterconnect] -> ShowS
show :: DeleteInterconnect -> String
$cshow :: DeleteInterconnect -> String
showsPrec :: Int -> DeleteInterconnect -> ShowS
$cshowsPrec :: Int -> DeleteInterconnect -> ShowS
Prelude.Show, (forall x. DeleteInterconnect -> Rep DeleteInterconnect x)
-> (forall x. Rep DeleteInterconnect x -> DeleteInterconnect)
-> Generic DeleteInterconnect
forall x. Rep DeleteInterconnect x -> DeleteInterconnect
forall x. DeleteInterconnect -> Rep DeleteInterconnect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteInterconnect x -> DeleteInterconnect
$cfrom :: forall x. DeleteInterconnect -> Rep DeleteInterconnect x
Prelude.Generic)
newDeleteInterconnect ::
Prelude.Text ->
DeleteInterconnect
newDeleteInterconnect :: Text -> DeleteInterconnect
newDeleteInterconnect Text
pInterconnectId_ =
DeleteInterconnect' :: Text -> DeleteInterconnect
DeleteInterconnect'
{ $sel:interconnectId:DeleteInterconnect' :: Text
interconnectId =
Text
pInterconnectId_
}
deleteInterconnect_interconnectId :: Lens.Lens' DeleteInterconnect Prelude.Text
deleteInterconnect_interconnectId :: (Text -> f Text) -> DeleteInterconnect -> f DeleteInterconnect
deleteInterconnect_interconnectId = (DeleteInterconnect -> Text)
-> (DeleteInterconnect -> Text -> DeleteInterconnect)
-> Lens DeleteInterconnect DeleteInterconnect Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInterconnect' {Text
interconnectId :: Text
$sel:interconnectId:DeleteInterconnect' :: DeleteInterconnect -> Text
interconnectId} -> Text
interconnectId) (\s :: DeleteInterconnect
s@DeleteInterconnect' {} Text
a -> DeleteInterconnect
s {$sel:interconnectId:DeleteInterconnect' :: Text
interconnectId = Text
a} :: DeleteInterconnect)
instance Core.AWSRequest DeleteInterconnect where
type
AWSResponse DeleteInterconnect =
DeleteInterconnectResponse
request :: DeleteInterconnect -> Request DeleteInterconnect
request = Service -> DeleteInterconnect -> Request DeleteInterconnect
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteInterconnect
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteInterconnect)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteInterconnect))
-> Logger
-> Service
-> Proxy DeleteInterconnect
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteInterconnect)))
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 InterconnectState -> Int -> DeleteInterconnectResponse
DeleteInterconnectResponse'
(Maybe InterconnectState -> Int -> DeleteInterconnectResponse)
-> Either String (Maybe InterconnectState)
-> Either String (Int -> DeleteInterconnectResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InterconnectState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"interconnectState")
Either String (Int -> DeleteInterconnectResponse)
-> Either String Int -> Either String DeleteInterconnectResponse
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 DeleteInterconnect
instance Prelude.NFData DeleteInterconnect
instance Core.ToHeaders DeleteInterconnect where
toHeaders :: DeleteInterconnect -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteInterconnect -> 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
"OvertureService.DeleteInterconnect" ::
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 DeleteInterconnect where
toJSON :: DeleteInterconnect -> Value
toJSON DeleteInterconnect' {Text
interconnectId :: Text
$sel:interconnectId:DeleteInterconnect' :: DeleteInterconnect -> 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
"interconnectId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
interconnectId)
]
)
instance Core.ToPath DeleteInterconnect where
toPath :: DeleteInterconnect -> ByteString
toPath = ByteString -> DeleteInterconnect -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteInterconnect where
toQuery :: DeleteInterconnect -> QueryString
toQuery = QueryString -> DeleteInterconnect -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteInterconnectResponse = DeleteInterconnectResponse'
{
DeleteInterconnectResponse -> Maybe InterconnectState
interconnectState :: Prelude.Maybe InterconnectState,
DeleteInterconnectResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool
(DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool)
-> (DeleteInterconnectResponse
-> DeleteInterconnectResponse -> Bool)
-> Eq DeleteInterconnectResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool
$c/= :: DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool
== :: DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool
$c== :: DeleteInterconnectResponse -> DeleteInterconnectResponse -> Bool
Prelude.Eq, ReadPrec [DeleteInterconnectResponse]
ReadPrec DeleteInterconnectResponse
Int -> ReadS DeleteInterconnectResponse
ReadS [DeleteInterconnectResponse]
(Int -> ReadS DeleteInterconnectResponse)
-> ReadS [DeleteInterconnectResponse]
-> ReadPrec DeleteInterconnectResponse
-> ReadPrec [DeleteInterconnectResponse]
-> Read DeleteInterconnectResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteInterconnectResponse]
$creadListPrec :: ReadPrec [DeleteInterconnectResponse]
readPrec :: ReadPrec DeleteInterconnectResponse
$creadPrec :: ReadPrec DeleteInterconnectResponse
readList :: ReadS [DeleteInterconnectResponse]
$creadList :: ReadS [DeleteInterconnectResponse]
readsPrec :: Int -> ReadS DeleteInterconnectResponse
$creadsPrec :: Int -> ReadS DeleteInterconnectResponse
Prelude.Read, Int -> DeleteInterconnectResponse -> ShowS
[DeleteInterconnectResponse] -> ShowS
DeleteInterconnectResponse -> String
(Int -> DeleteInterconnectResponse -> ShowS)
-> (DeleteInterconnectResponse -> String)
-> ([DeleteInterconnectResponse] -> ShowS)
-> Show DeleteInterconnectResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteInterconnectResponse] -> ShowS
$cshowList :: [DeleteInterconnectResponse] -> ShowS
show :: DeleteInterconnectResponse -> String
$cshow :: DeleteInterconnectResponse -> String
showsPrec :: Int -> DeleteInterconnectResponse -> ShowS
$cshowsPrec :: Int -> DeleteInterconnectResponse -> ShowS
Prelude.Show, (forall x.
DeleteInterconnectResponse -> Rep DeleteInterconnectResponse x)
-> (forall x.
Rep DeleteInterconnectResponse x -> DeleteInterconnectResponse)
-> Generic DeleteInterconnectResponse
forall x.
Rep DeleteInterconnectResponse x -> DeleteInterconnectResponse
forall x.
DeleteInterconnectResponse -> Rep DeleteInterconnectResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteInterconnectResponse x -> DeleteInterconnectResponse
$cfrom :: forall x.
DeleteInterconnectResponse -> Rep DeleteInterconnectResponse x
Prelude.Generic)
newDeleteInterconnectResponse ::
Prelude.Int ->
DeleteInterconnectResponse
newDeleteInterconnectResponse :: Int -> DeleteInterconnectResponse
newDeleteInterconnectResponse Int
pHttpStatus_ =
DeleteInterconnectResponse' :: Maybe InterconnectState -> Int -> DeleteInterconnectResponse
DeleteInterconnectResponse'
{ $sel:interconnectState:DeleteInterconnectResponse' :: Maybe InterconnectState
interconnectState =
Maybe InterconnectState
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteInterconnectResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteInterconnectResponse_interconnectState :: Lens.Lens' DeleteInterconnectResponse (Prelude.Maybe InterconnectState)
deleteInterconnectResponse_interconnectState :: (Maybe InterconnectState -> f (Maybe InterconnectState))
-> DeleteInterconnectResponse -> f DeleteInterconnectResponse
deleteInterconnectResponse_interconnectState = (DeleteInterconnectResponse -> Maybe InterconnectState)
-> (DeleteInterconnectResponse
-> Maybe InterconnectState -> DeleteInterconnectResponse)
-> Lens
DeleteInterconnectResponse
DeleteInterconnectResponse
(Maybe InterconnectState)
(Maybe InterconnectState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInterconnectResponse' {Maybe InterconnectState
interconnectState :: Maybe InterconnectState
$sel:interconnectState:DeleteInterconnectResponse' :: DeleteInterconnectResponse -> Maybe InterconnectState
interconnectState} -> Maybe InterconnectState
interconnectState) (\s :: DeleteInterconnectResponse
s@DeleteInterconnectResponse' {} Maybe InterconnectState
a -> DeleteInterconnectResponse
s {$sel:interconnectState:DeleteInterconnectResponse' :: Maybe InterconnectState
interconnectState = Maybe InterconnectState
a} :: DeleteInterconnectResponse)
deleteInterconnectResponse_httpStatus :: Lens.Lens' DeleteInterconnectResponse Prelude.Int
deleteInterconnectResponse_httpStatus :: (Int -> f Int)
-> DeleteInterconnectResponse -> f DeleteInterconnectResponse
deleteInterconnectResponse_httpStatus = (DeleteInterconnectResponse -> Int)
-> (DeleteInterconnectResponse
-> Int -> DeleteInterconnectResponse)
-> Lens
DeleteInterconnectResponse DeleteInterconnectResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteInterconnectResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteInterconnectResponse' :: DeleteInterconnectResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteInterconnectResponse
s@DeleteInterconnectResponse' {} Int
a -> DeleteInterconnectResponse
s {$sel:httpStatus:DeleteInterconnectResponse' :: Int
httpStatus = Int
a} :: DeleteInterconnectResponse)
instance Prelude.NFData DeleteInterconnectResponse