{-# 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.UpdateConnection
(
UpdateConnection (..),
newUpdateConnection,
updateConnection_connectedLinkId,
updateConnection_linkId,
updateConnection_description,
updateConnection_globalNetworkId,
updateConnection_connectionId,
UpdateConnectionResponse (..),
newUpdateConnectionResponse,
updateConnectionResponse_connection,
updateConnectionResponse_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 UpdateConnection = UpdateConnection'
{
UpdateConnection -> Maybe Text
connectedLinkId :: Prelude.Maybe Prelude.Text,
UpdateConnection -> Maybe Text
linkId :: Prelude.Maybe Prelude.Text,
UpdateConnection -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateConnection -> Text
globalNetworkId :: Prelude.Text,
UpdateConnection -> Text
connectionId :: Prelude.Text
}
deriving (UpdateConnection -> UpdateConnection -> Bool
(UpdateConnection -> UpdateConnection -> Bool)
-> (UpdateConnection -> UpdateConnection -> Bool)
-> Eq UpdateConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnection -> UpdateConnection -> Bool
$c/= :: UpdateConnection -> UpdateConnection -> Bool
== :: UpdateConnection -> UpdateConnection -> Bool
$c== :: UpdateConnection -> UpdateConnection -> Bool
Prelude.Eq, ReadPrec [UpdateConnection]
ReadPrec UpdateConnection
Int -> ReadS UpdateConnection
ReadS [UpdateConnection]
(Int -> ReadS UpdateConnection)
-> ReadS [UpdateConnection]
-> ReadPrec UpdateConnection
-> ReadPrec [UpdateConnection]
-> Read UpdateConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnection]
$creadListPrec :: ReadPrec [UpdateConnection]
readPrec :: ReadPrec UpdateConnection
$creadPrec :: ReadPrec UpdateConnection
readList :: ReadS [UpdateConnection]
$creadList :: ReadS [UpdateConnection]
readsPrec :: Int -> ReadS UpdateConnection
$creadsPrec :: Int -> ReadS UpdateConnection
Prelude.Read, Int -> UpdateConnection -> ShowS
[UpdateConnection] -> ShowS
UpdateConnection -> String
(Int -> UpdateConnection -> ShowS)
-> (UpdateConnection -> String)
-> ([UpdateConnection] -> ShowS)
-> Show UpdateConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnection] -> ShowS
$cshowList :: [UpdateConnection] -> ShowS
show :: UpdateConnection -> String
$cshow :: UpdateConnection -> String
showsPrec :: Int -> UpdateConnection -> ShowS
$cshowsPrec :: Int -> UpdateConnection -> ShowS
Prelude.Show, (forall x. UpdateConnection -> Rep UpdateConnection x)
-> (forall x. Rep UpdateConnection x -> UpdateConnection)
-> Generic UpdateConnection
forall x. Rep UpdateConnection x -> UpdateConnection
forall x. UpdateConnection -> Rep UpdateConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConnection x -> UpdateConnection
$cfrom :: forall x. UpdateConnection -> Rep UpdateConnection x
Prelude.Generic)
newUpdateConnection ::
Prelude.Text ->
Prelude.Text ->
UpdateConnection
newUpdateConnection :: Text -> Text -> UpdateConnection
newUpdateConnection Text
pGlobalNetworkId_ Text
pConnectionId_ =
UpdateConnection' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> UpdateConnection
UpdateConnection'
{ $sel:connectedLinkId:UpdateConnection' :: Maybe Text
connectedLinkId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:linkId:UpdateConnection' :: Maybe Text
linkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateConnection' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:globalNetworkId:UpdateConnection' :: Text
globalNetworkId = Text
pGlobalNetworkId_,
$sel:connectionId:UpdateConnection' :: Text
connectionId = Text
pConnectionId_
}
updateConnection_connectedLinkId :: Lens.Lens' UpdateConnection (Prelude.Maybe Prelude.Text)
updateConnection_connectedLinkId :: (Maybe Text -> f (Maybe Text))
-> UpdateConnection -> f UpdateConnection
updateConnection_connectedLinkId = (UpdateConnection -> Maybe Text)
-> (UpdateConnection -> Maybe Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedLinkId:UpdateConnection' :: UpdateConnection -> Maybe Text
connectedLinkId} -> Maybe Text
connectedLinkId) (\s :: UpdateConnection
s@UpdateConnection' {} Maybe Text
a -> UpdateConnection
s {$sel:connectedLinkId:UpdateConnection' :: Maybe Text
connectedLinkId = Maybe Text
a} :: UpdateConnection)
updateConnection_linkId :: Lens.Lens' UpdateConnection (Prelude.Maybe Prelude.Text)
updateConnection_linkId :: (Maybe Text -> f (Maybe Text))
-> UpdateConnection -> f UpdateConnection
updateConnection_linkId = (UpdateConnection -> Maybe Text)
-> (UpdateConnection -> Maybe Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Maybe Text
linkId :: Maybe Text
$sel:linkId:UpdateConnection' :: UpdateConnection -> Maybe Text
linkId} -> Maybe Text
linkId) (\s :: UpdateConnection
s@UpdateConnection' {} Maybe Text
a -> UpdateConnection
s {$sel:linkId:UpdateConnection' :: Maybe Text
linkId = Maybe Text
a} :: UpdateConnection)
updateConnection_description :: Lens.Lens' UpdateConnection (Prelude.Maybe Prelude.Text)
updateConnection_description :: (Maybe Text -> f (Maybe Text))
-> UpdateConnection -> f UpdateConnection
updateConnection_description = (UpdateConnection -> Maybe Text)
-> (UpdateConnection -> Maybe Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Maybe Text
description :: Maybe Text
$sel:description:UpdateConnection' :: UpdateConnection -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateConnection
s@UpdateConnection' {} Maybe Text
a -> UpdateConnection
s {$sel:description:UpdateConnection' :: Maybe Text
description = Maybe Text
a} :: UpdateConnection)
updateConnection_globalNetworkId :: Lens.Lens' UpdateConnection Prelude.Text
updateConnection_globalNetworkId :: (Text -> f Text) -> UpdateConnection -> f UpdateConnection
updateConnection_globalNetworkId = (UpdateConnection -> Text)
-> (UpdateConnection -> Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Text
globalNetworkId :: Text
$sel:globalNetworkId:UpdateConnection' :: UpdateConnection -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: UpdateConnection
s@UpdateConnection' {} Text
a -> UpdateConnection
s {$sel:globalNetworkId:UpdateConnection' :: Text
globalNetworkId = Text
a} :: UpdateConnection)
updateConnection_connectionId :: Lens.Lens' UpdateConnection Prelude.Text
updateConnection_connectionId :: (Text -> f Text) -> UpdateConnection -> f UpdateConnection
updateConnection_connectionId = (UpdateConnection -> Text)
-> (UpdateConnection -> Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Text
connectionId :: Text
$sel:connectionId:UpdateConnection' :: UpdateConnection -> Text
connectionId} -> Text
connectionId) (\s :: UpdateConnection
s@UpdateConnection' {} Text
a -> UpdateConnection
s {$sel:connectionId:UpdateConnection' :: Text
connectionId = Text
a} :: UpdateConnection)
instance Core.AWSRequest UpdateConnection where
type
AWSResponse UpdateConnection =
UpdateConnectionResponse
request :: UpdateConnection -> Request UpdateConnection
request = Service -> UpdateConnection -> Request UpdateConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateConnection))
-> Logger
-> Service
-> Proxy UpdateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConnection)))
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 -> UpdateConnectionResponse
UpdateConnectionResponse'
(Maybe Connection -> Int -> UpdateConnectionResponse)
-> Either String (Maybe Connection)
-> Either String (Int -> UpdateConnectionResponse)
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 -> UpdateConnectionResponse)
-> Either String Int -> Either String UpdateConnectionResponse
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 UpdateConnection
instance Prelude.NFData UpdateConnection
instance Core.ToHeaders UpdateConnection where
toHeaders :: UpdateConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateConnection -> 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.ToJSON UpdateConnection where
toJSON :: UpdateConnection -> Value
toJSON UpdateConnection' {Maybe Text
Text
connectionId :: Text
globalNetworkId :: Text
description :: Maybe Text
linkId :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectionId:UpdateConnection' :: UpdateConnection -> Text
$sel:globalNetworkId:UpdateConnection' :: UpdateConnection -> Text
$sel:description:UpdateConnection' :: UpdateConnection -> Maybe Text
$sel:linkId:UpdateConnection' :: UpdateConnection -> Maybe Text
$sel:connectedLinkId:UpdateConnection' :: UpdateConnection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ConnectedLinkId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectedLinkId,
(Text
"LinkId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
linkId,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
]
)
instance Core.ToPath UpdateConnection where
toPath :: UpdateConnection -> ByteString
toPath UpdateConnection' {Maybe Text
Text
connectionId :: Text
globalNetworkId :: Text
description :: Maybe Text
linkId :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectionId:UpdateConnection' :: UpdateConnection -> Text
$sel:globalNetworkId:UpdateConnection' :: UpdateConnection -> Text
$sel:description:UpdateConnection' :: UpdateConnection -> Maybe Text
$sel:linkId:UpdateConnection' :: UpdateConnection -> Maybe Text
$sel:connectedLinkId:UpdateConnection' :: UpdateConnection -> Maybe 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
"/connections/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
connectionId
]
instance Core.ToQuery UpdateConnection where
toQuery :: UpdateConnection -> QueryString
toQuery = QueryString -> UpdateConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateConnectionResponse = UpdateConnectionResponse'
{
UpdateConnectionResponse -> Maybe Connection
connection :: Prelude.Maybe Connection,
UpdateConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateConnectionResponse -> UpdateConnectionResponse -> Bool
(UpdateConnectionResponse -> UpdateConnectionResponse -> Bool)
-> (UpdateConnectionResponse -> UpdateConnectionResponse -> Bool)
-> Eq UpdateConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnectionResponse -> UpdateConnectionResponse -> Bool
$c/= :: UpdateConnectionResponse -> UpdateConnectionResponse -> Bool
== :: UpdateConnectionResponse -> UpdateConnectionResponse -> Bool
$c== :: UpdateConnectionResponse -> UpdateConnectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateConnectionResponse]
ReadPrec UpdateConnectionResponse
Int -> ReadS UpdateConnectionResponse
ReadS [UpdateConnectionResponse]
(Int -> ReadS UpdateConnectionResponse)
-> ReadS [UpdateConnectionResponse]
-> ReadPrec UpdateConnectionResponse
-> ReadPrec [UpdateConnectionResponse]
-> Read UpdateConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnectionResponse]
$creadListPrec :: ReadPrec [UpdateConnectionResponse]
readPrec :: ReadPrec UpdateConnectionResponse
$creadPrec :: ReadPrec UpdateConnectionResponse
readList :: ReadS [UpdateConnectionResponse]
$creadList :: ReadS [UpdateConnectionResponse]
readsPrec :: Int -> ReadS UpdateConnectionResponse
$creadsPrec :: Int -> ReadS UpdateConnectionResponse
Prelude.Read, Int -> UpdateConnectionResponse -> ShowS
[UpdateConnectionResponse] -> ShowS
UpdateConnectionResponse -> String
(Int -> UpdateConnectionResponse -> ShowS)
-> (UpdateConnectionResponse -> String)
-> ([UpdateConnectionResponse] -> ShowS)
-> Show UpdateConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnectionResponse] -> ShowS
$cshowList :: [UpdateConnectionResponse] -> ShowS
show :: UpdateConnectionResponse -> String
$cshow :: UpdateConnectionResponse -> String
showsPrec :: Int -> UpdateConnectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateConnectionResponse -> ShowS
Prelude.Show, (forall x.
UpdateConnectionResponse -> Rep UpdateConnectionResponse x)
-> (forall x.
Rep UpdateConnectionResponse x -> UpdateConnectionResponse)
-> Generic UpdateConnectionResponse
forall x.
Rep UpdateConnectionResponse x -> UpdateConnectionResponse
forall x.
UpdateConnectionResponse -> Rep UpdateConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateConnectionResponse x -> UpdateConnectionResponse
$cfrom :: forall x.
UpdateConnectionResponse -> Rep UpdateConnectionResponse x
Prelude.Generic)
newUpdateConnectionResponse ::
Prelude.Int ->
UpdateConnectionResponse
newUpdateConnectionResponse :: Int -> UpdateConnectionResponse
newUpdateConnectionResponse Int
pHttpStatus_ =
UpdateConnectionResponse' :: Maybe Connection -> Int -> UpdateConnectionResponse
UpdateConnectionResponse'
{ $sel:connection:UpdateConnectionResponse' :: Maybe Connection
connection =
Maybe Connection
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateConnectionResponse_connection :: Lens.Lens' UpdateConnectionResponse (Prelude.Maybe Connection)
updateConnectionResponse_connection :: (Maybe Connection -> f (Maybe Connection))
-> UpdateConnectionResponse -> f UpdateConnectionResponse
updateConnectionResponse_connection = (UpdateConnectionResponse -> Maybe Connection)
-> (UpdateConnectionResponse
-> Maybe Connection -> UpdateConnectionResponse)
-> Lens
UpdateConnectionResponse
UpdateConnectionResponse
(Maybe Connection)
(Maybe Connection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionResponse' {Maybe Connection
connection :: Maybe Connection
$sel:connection:UpdateConnectionResponse' :: UpdateConnectionResponse -> Maybe Connection
connection} -> Maybe Connection
connection) (\s :: UpdateConnectionResponse
s@UpdateConnectionResponse' {} Maybe Connection
a -> UpdateConnectionResponse
s {$sel:connection:UpdateConnectionResponse' :: Maybe Connection
connection = Maybe Connection
a} :: UpdateConnectionResponse)
updateConnectionResponse_httpStatus :: Lens.Lens' UpdateConnectionResponse Prelude.Int
updateConnectionResponse_httpStatus :: (Int -> f Int)
-> UpdateConnectionResponse -> f UpdateConnectionResponse
updateConnectionResponse_httpStatus = (UpdateConnectionResponse -> Int)
-> (UpdateConnectionResponse -> Int -> UpdateConnectionResponse)
-> Lens UpdateConnectionResponse UpdateConnectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateConnectionResponse' :: UpdateConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateConnectionResponse
s@UpdateConnectionResponse' {} Int
a -> UpdateConnectionResponse
s {$sel:httpStatus:UpdateConnectionResponse' :: Int
httpStatus = Int
a} :: UpdateConnectionResponse)
instance Prelude.NFData UpdateConnectionResponse