{-# 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.NetworkManager.DeleteLink
(
DeleteLink (..),
newDeleteLink,
deleteLink_globalNetworkId,
deleteLink_linkId,
DeleteLinkResponse (..),
newDeleteLinkResponse,
deleteLinkResponse_link,
deleteLinkResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteLink = DeleteLink'
{
DeleteLink -> Text
globalNetworkId :: Prelude.Text,
DeleteLink -> Text
linkId :: Prelude.Text
}
deriving (DeleteLink -> DeleteLink -> Bool
(DeleteLink -> DeleteLink -> Bool)
-> (DeleteLink -> DeleteLink -> Bool) -> Eq DeleteLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLink -> DeleteLink -> Bool
$c/= :: DeleteLink -> DeleteLink -> Bool
== :: DeleteLink -> DeleteLink -> Bool
$c== :: DeleteLink -> DeleteLink -> Bool
Prelude.Eq, ReadPrec [DeleteLink]
ReadPrec DeleteLink
Int -> ReadS DeleteLink
ReadS [DeleteLink]
(Int -> ReadS DeleteLink)
-> ReadS [DeleteLink]
-> ReadPrec DeleteLink
-> ReadPrec [DeleteLink]
-> Read DeleteLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLink]
$creadListPrec :: ReadPrec [DeleteLink]
readPrec :: ReadPrec DeleteLink
$creadPrec :: ReadPrec DeleteLink
readList :: ReadS [DeleteLink]
$creadList :: ReadS [DeleteLink]
readsPrec :: Int -> ReadS DeleteLink
$creadsPrec :: Int -> ReadS DeleteLink
Prelude.Read, Int -> DeleteLink -> ShowS
[DeleteLink] -> ShowS
DeleteLink -> String
(Int -> DeleteLink -> ShowS)
-> (DeleteLink -> String)
-> ([DeleteLink] -> ShowS)
-> Show DeleteLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLink] -> ShowS
$cshowList :: [DeleteLink] -> ShowS
show :: DeleteLink -> String
$cshow :: DeleteLink -> String
showsPrec :: Int -> DeleteLink -> ShowS
$cshowsPrec :: Int -> DeleteLink -> ShowS
Prelude.Show, (forall x. DeleteLink -> Rep DeleteLink x)
-> (forall x. Rep DeleteLink x -> DeleteLink) -> Generic DeleteLink
forall x. Rep DeleteLink x -> DeleteLink
forall x. DeleteLink -> Rep DeleteLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLink x -> DeleteLink
$cfrom :: forall x. DeleteLink -> Rep DeleteLink x
Prelude.Generic)
newDeleteLink ::
Prelude.Text ->
Prelude.Text ->
DeleteLink
newDeleteLink :: Text -> Text -> DeleteLink
newDeleteLink Text
pGlobalNetworkId_ Text
pLinkId_ =
DeleteLink' :: Text -> Text -> DeleteLink
DeleteLink'
{ $sel:globalNetworkId:DeleteLink' :: Text
globalNetworkId = Text
pGlobalNetworkId_,
$sel:linkId:DeleteLink' :: Text
linkId = Text
pLinkId_
}
deleteLink_globalNetworkId :: Lens.Lens' DeleteLink Prelude.Text
deleteLink_globalNetworkId :: (Text -> f Text) -> DeleteLink -> f DeleteLink
deleteLink_globalNetworkId = (DeleteLink -> Text)
-> (DeleteLink -> Text -> DeleteLink)
-> Lens DeleteLink DeleteLink Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLink' {Text
globalNetworkId :: Text
$sel:globalNetworkId:DeleteLink' :: DeleteLink -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: DeleteLink
s@DeleteLink' {} Text
a -> DeleteLink
s {$sel:globalNetworkId:DeleteLink' :: Text
globalNetworkId = Text
a} :: DeleteLink)
deleteLink_linkId :: Lens.Lens' DeleteLink Prelude.Text
deleteLink_linkId :: (Text -> f Text) -> DeleteLink -> f DeleteLink
deleteLink_linkId = (DeleteLink -> Text)
-> (DeleteLink -> Text -> DeleteLink)
-> Lens DeleteLink DeleteLink Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLink' {Text
linkId :: Text
$sel:linkId:DeleteLink' :: DeleteLink -> Text
linkId} -> Text
linkId) (\s :: DeleteLink
s@DeleteLink' {} Text
a -> DeleteLink
s {$sel:linkId:DeleteLink' :: Text
linkId = Text
a} :: DeleteLink)
instance Core.AWSRequest DeleteLink where
type AWSResponse DeleteLink = DeleteLinkResponse
request :: DeleteLink -> Request DeleteLink
request = Service -> DeleteLink -> Request DeleteLink
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteLink
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLink)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteLink))
-> Logger
-> Service
-> Proxy DeleteLink
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLink)))
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 Link -> Int -> DeleteLinkResponse
DeleteLinkResponse'
(Maybe Link -> Int -> DeleteLinkResponse)
-> Either String (Maybe Link)
-> Either String (Int -> DeleteLinkResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Link)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Link")
Either String (Int -> DeleteLinkResponse)
-> Either String Int -> Either String DeleteLinkResponse
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 DeleteLink
instance Prelude.NFData DeleteLink
instance Core.ToHeaders DeleteLink where
toHeaders :: DeleteLink -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteLink -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath DeleteLink where
toPath :: DeleteLink -> ByteString
toPath DeleteLink' {Text
linkId :: Text
globalNetworkId :: Text
$sel:linkId:DeleteLink' :: DeleteLink -> Text
$sel:globalNetworkId:DeleteLink' :: DeleteLink -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/global-networks/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
ByteString
"/links/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
linkId
]
instance Core.ToQuery DeleteLink where
toQuery :: DeleteLink -> QueryString
toQuery = QueryString -> DeleteLink -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteLinkResponse = DeleteLinkResponse'
{
DeleteLinkResponse -> Maybe Link
link :: Prelude.Maybe Link,
DeleteLinkResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteLinkResponse -> DeleteLinkResponse -> Bool
(DeleteLinkResponse -> DeleteLinkResponse -> Bool)
-> (DeleteLinkResponse -> DeleteLinkResponse -> Bool)
-> Eq DeleteLinkResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLinkResponse -> DeleteLinkResponse -> Bool
$c/= :: DeleteLinkResponse -> DeleteLinkResponse -> Bool
== :: DeleteLinkResponse -> DeleteLinkResponse -> Bool
$c== :: DeleteLinkResponse -> DeleteLinkResponse -> Bool
Prelude.Eq, ReadPrec [DeleteLinkResponse]
ReadPrec DeleteLinkResponse
Int -> ReadS DeleteLinkResponse
ReadS [DeleteLinkResponse]
(Int -> ReadS DeleteLinkResponse)
-> ReadS [DeleteLinkResponse]
-> ReadPrec DeleteLinkResponse
-> ReadPrec [DeleteLinkResponse]
-> Read DeleteLinkResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLinkResponse]
$creadListPrec :: ReadPrec [DeleteLinkResponse]
readPrec :: ReadPrec DeleteLinkResponse
$creadPrec :: ReadPrec DeleteLinkResponse
readList :: ReadS [DeleteLinkResponse]
$creadList :: ReadS [DeleteLinkResponse]
readsPrec :: Int -> ReadS DeleteLinkResponse
$creadsPrec :: Int -> ReadS DeleteLinkResponse
Prelude.Read, Int -> DeleteLinkResponse -> ShowS
[DeleteLinkResponse] -> ShowS
DeleteLinkResponse -> String
(Int -> DeleteLinkResponse -> ShowS)
-> (DeleteLinkResponse -> String)
-> ([DeleteLinkResponse] -> ShowS)
-> Show DeleteLinkResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLinkResponse] -> ShowS
$cshowList :: [DeleteLinkResponse] -> ShowS
show :: DeleteLinkResponse -> String
$cshow :: DeleteLinkResponse -> String
showsPrec :: Int -> DeleteLinkResponse -> ShowS
$cshowsPrec :: Int -> DeleteLinkResponse -> ShowS
Prelude.Show, (forall x. DeleteLinkResponse -> Rep DeleteLinkResponse x)
-> (forall x. Rep DeleteLinkResponse x -> DeleteLinkResponse)
-> Generic DeleteLinkResponse
forall x. Rep DeleteLinkResponse x -> DeleteLinkResponse
forall x. DeleteLinkResponse -> Rep DeleteLinkResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLinkResponse x -> DeleteLinkResponse
$cfrom :: forall x. DeleteLinkResponse -> Rep DeleteLinkResponse x
Prelude.Generic)
newDeleteLinkResponse ::
Prelude.Int ->
DeleteLinkResponse
newDeleteLinkResponse :: Int -> DeleteLinkResponse
newDeleteLinkResponse Int
pHttpStatus_ =
DeleteLinkResponse' :: Maybe Link -> Int -> DeleteLinkResponse
DeleteLinkResponse'
{ $sel:link:DeleteLinkResponse' :: Maybe Link
link = Maybe Link
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteLinkResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteLinkResponse_link :: Lens.Lens' DeleteLinkResponse (Prelude.Maybe Link)
deleteLinkResponse_link :: (Maybe Link -> f (Maybe Link))
-> DeleteLinkResponse -> f DeleteLinkResponse
deleteLinkResponse_link = (DeleteLinkResponse -> Maybe Link)
-> (DeleteLinkResponse -> Maybe Link -> DeleteLinkResponse)
-> Lens
DeleteLinkResponse DeleteLinkResponse (Maybe Link) (Maybe Link)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLinkResponse' {Maybe Link
link :: Maybe Link
$sel:link:DeleteLinkResponse' :: DeleteLinkResponse -> Maybe Link
link} -> Maybe Link
link) (\s :: DeleteLinkResponse
s@DeleteLinkResponse' {} Maybe Link
a -> DeleteLinkResponse
s {$sel:link:DeleteLinkResponse' :: Maybe Link
link = Maybe Link
a} :: DeleteLinkResponse)
deleteLinkResponse_httpStatus :: Lens.Lens' DeleteLinkResponse Prelude.Int
deleteLinkResponse_httpStatus :: (Int -> f Int) -> DeleteLinkResponse -> f DeleteLinkResponse
deleteLinkResponse_httpStatus = (DeleteLinkResponse -> Int)
-> (DeleteLinkResponse -> Int -> DeleteLinkResponse)
-> Lens DeleteLinkResponse DeleteLinkResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLinkResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteLinkResponse' :: DeleteLinkResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteLinkResponse
s@DeleteLinkResponse' {} Int
a -> DeleteLinkResponse
s {$sel:httpStatus:DeleteLinkResponse' :: Int
httpStatus = Int
a} :: DeleteLinkResponse)
instance Prelude.NFData DeleteLinkResponse