{-# 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.AppMesh.UpdateRoute
(
UpdateRoute (..),
newUpdateRoute,
updateRoute_clientToken,
updateRoute_meshOwner,
updateRoute_meshName,
updateRoute_routeName,
updateRoute_spec,
updateRoute_virtualRouterName,
UpdateRouteResponse (..),
newUpdateRouteResponse,
updateRouteResponse_httpStatus,
updateRouteResponse_route,
)
where
import Amazonka.AppMesh.Types
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
data UpdateRoute = UpdateRoute'
{
UpdateRoute -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
UpdateRoute -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
UpdateRoute -> Text
meshName :: Prelude.Text,
UpdateRoute -> Text
routeName :: Prelude.Text,
UpdateRoute -> RouteSpec
spec :: RouteSpec,
UpdateRoute -> Text
virtualRouterName :: Prelude.Text
}
deriving (UpdateRoute -> UpdateRoute -> Bool
(UpdateRoute -> UpdateRoute -> Bool)
-> (UpdateRoute -> UpdateRoute -> Bool) -> Eq UpdateRoute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoute -> UpdateRoute -> Bool
$c/= :: UpdateRoute -> UpdateRoute -> Bool
== :: UpdateRoute -> UpdateRoute -> Bool
$c== :: UpdateRoute -> UpdateRoute -> Bool
Prelude.Eq, ReadPrec [UpdateRoute]
ReadPrec UpdateRoute
Int -> ReadS UpdateRoute
ReadS [UpdateRoute]
(Int -> ReadS UpdateRoute)
-> ReadS [UpdateRoute]
-> ReadPrec UpdateRoute
-> ReadPrec [UpdateRoute]
-> Read UpdateRoute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoute]
$creadListPrec :: ReadPrec [UpdateRoute]
readPrec :: ReadPrec UpdateRoute
$creadPrec :: ReadPrec UpdateRoute
readList :: ReadS [UpdateRoute]
$creadList :: ReadS [UpdateRoute]
readsPrec :: Int -> ReadS UpdateRoute
$creadsPrec :: Int -> ReadS UpdateRoute
Prelude.Read, Int -> UpdateRoute -> ShowS
[UpdateRoute] -> ShowS
UpdateRoute -> String
(Int -> UpdateRoute -> ShowS)
-> (UpdateRoute -> String)
-> ([UpdateRoute] -> ShowS)
-> Show UpdateRoute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoute] -> ShowS
$cshowList :: [UpdateRoute] -> ShowS
show :: UpdateRoute -> String
$cshow :: UpdateRoute -> String
showsPrec :: Int -> UpdateRoute -> ShowS
$cshowsPrec :: Int -> UpdateRoute -> ShowS
Prelude.Show, (forall x. UpdateRoute -> Rep UpdateRoute x)
-> (forall x. Rep UpdateRoute x -> UpdateRoute)
-> Generic UpdateRoute
forall x. Rep UpdateRoute x -> UpdateRoute
forall x. UpdateRoute -> Rep UpdateRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoute x -> UpdateRoute
$cfrom :: forall x. UpdateRoute -> Rep UpdateRoute x
Prelude.Generic)
newUpdateRoute ::
Prelude.Text ->
Prelude.Text ->
RouteSpec ->
Prelude.Text ->
UpdateRoute
newUpdateRoute :: Text -> Text -> RouteSpec -> Text -> UpdateRoute
newUpdateRoute
Text
pMeshName_
Text
pRouteName_
RouteSpec
pSpec_
Text
pVirtualRouterName_ =
UpdateRoute' :: Maybe Text
-> Maybe Text -> Text -> Text -> RouteSpec -> Text -> UpdateRoute
UpdateRoute'
{ $sel:clientToken:UpdateRoute' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:meshOwner:UpdateRoute' :: Maybe Text
meshOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:meshName:UpdateRoute' :: Text
meshName = Text
pMeshName_,
$sel:routeName:UpdateRoute' :: Text
routeName = Text
pRouteName_,
$sel:spec:UpdateRoute' :: RouteSpec
spec = RouteSpec
pSpec_,
$sel:virtualRouterName:UpdateRoute' :: Text
virtualRouterName = Text
pVirtualRouterName_
}
updateRoute_clientToken :: Lens.Lens' UpdateRoute (Prelude.Maybe Prelude.Text)
updateRoute_clientToken :: (Maybe Text -> f (Maybe Text)) -> UpdateRoute -> f UpdateRoute
updateRoute_clientToken = (UpdateRoute -> Maybe Text)
-> (UpdateRoute -> Maybe Text -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateRoute' :: UpdateRoute -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateRoute
s@UpdateRoute' {} Maybe Text
a -> UpdateRoute
s {$sel:clientToken:UpdateRoute' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateRoute)
updateRoute_meshOwner :: Lens.Lens' UpdateRoute (Prelude.Maybe Prelude.Text)
updateRoute_meshOwner :: (Maybe Text -> f (Maybe Text)) -> UpdateRoute -> f UpdateRoute
updateRoute_meshOwner = (UpdateRoute -> Maybe Text)
-> (UpdateRoute -> Maybe Text -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {Maybe Text
meshOwner :: Maybe Text
$sel:meshOwner:UpdateRoute' :: UpdateRoute -> Maybe Text
meshOwner} -> Maybe Text
meshOwner) (\s :: UpdateRoute
s@UpdateRoute' {} Maybe Text
a -> UpdateRoute
s {$sel:meshOwner:UpdateRoute' :: Maybe Text
meshOwner = Maybe Text
a} :: UpdateRoute)
updateRoute_meshName :: Lens.Lens' UpdateRoute Prelude.Text
updateRoute_meshName :: (Text -> f Text) -> UpdateRoute -> f UpdateRoute
updateRoute_meshName = (UpdateRoute -> Text)
-> (UpdateRoute -> Text -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {Text
meshName :: Text
$sel:meshName:UpdateRoute' :: UpdateRoute -> Text
meshName} -> Text
meshName) (\s :: UpdateRoute
s@UpdateRoute' {} Text
a -> UpdateRoute
s {$sel:meshName:UpdateRoute' :: Text
meshName = Text
a} :: UpdateRoute)
updateRoute_routeName :: Lens.Lens' UpdateRoute Prelude.Text
updateRoute_routeName :: (Text -> f Text) -> UpdateRoute -> f UpdateRoute
updateRoute_routeName = (UpdateRoute -> Text)
-> (UpdateRoute -> Text -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {Text
routeName :: Text
$sel:routeName:UpdateRoute' :: UpdateRoute -> Text
routeName} -> Text
routeName) (\s :: UpdateRoute
s@UpdateRoute' {} Text
a -> UpdateRoute
s {$sel:routeName:UpdateRoute' :: Text
routeName = Text
a} :: UpdateRoute)
updateRoute_spec :: Lens.Lens' UpdateRoute RouteSpec
updateRoute_spec :: (RouteSpec -> f RouteSpec) -> UpdateRoute -> f UpdateRoute
updateRoute_spec = (UpdateRoute -> RouteSpec)
-> (UpdateRoute -> RouteSpec -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute RouteSpec RouteSpec
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {RouteSpec
spec :: RouteSpec
$sel:spec:UpdateRoute' :: UpdateRoute -> RouteSpec
spec} -> RouteSpec
spec) (\s :: UpdateRoute
s@UpdateRoute' {} RouteSpec
a -> UpdateRoute
s {$sel:spec:UpdateRoute' :: RouteSpec
spec = RouteSpec
a} :: UpdateRoute)
updateRoute_virtualRouterName :: Lens.Lens' UpdateRoute Prelude.Text
updateRoute_virtualRouterName :: (Text -> f Text) -> UpdateRoute -> f UpdateRoute
updateRoute_virtualRouterName = (UpdateRoute -> Text)
-> (UpdateRoute -> Text -> UpdateRoute)
-> Lens UpdateRoute UpdateRoute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoute' {Text
virtualRouterName :: Text
$sel:virtualRouterName:UpdateRoute' :: UpdateRoute -> Text
virtualRouterName} -> Text
virtualRouterName) (\s :: UpdateRoute
s@UpdateRoute' {} Text
a -> UpdateRoute
s {$sel:virtualRouterName:UpdateRoute' :: Text
virtualRouterName = Text
a} :: UpdateRoute)
instance Core.AWSRequest UpdateRoute where
type AWSResponse UpdateRoute = UpdateRouteResponse
request :: UpdateRoute -> Request UpdateRoute
request = Service -> UpdateRoute -> Request UpdateRoute
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoute)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateRoute))
-> Logger
-> Service
-> Proxy UpdateRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateRoute)))
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 ->
Int -> RouteData -> UpdateRouteResponse
UpdateRouteResponse'
(Int -> RouteData -> UpdateRouteResponse)
-> Either String Int
-> Either String (RouteData -> UpdateRouteResponse)
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))
Either String (RouteData -> UpdateRouteResponse)
-> Either String RouteData -> Either String UpdateRouteResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String RouteData
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable UpdateRoute
instance Prelude.NFData UpdateRoute
instance Core.ToHeaders UpdateRoute where
toHeaders :: UpdateRoute -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateRoute -> 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 UpdateRoute where
toJSON :: UpdateRoute -> Value
toJSON UpdateRoute' {Maybe Text
Text
RouteSpec
virtualRouterName :: Text
spec :: RouteSpec
routeName :: Text
meshName :: Text
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualRouterName:UpdateRoute' :: UpdateRoute -> Text
$sel:spec:UpdateRoute' :: UpdateRoute -> RouteSpec
$sel:routeName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshOwner:UpdateRoute' :: UpdateRoute -> Maybe Text
$sel:clientToken:UpdateRoute' :: UpdateRoute -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" 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
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"spec" Text -> RouteSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RouteSpec
spec)
]
)
instance Core.ToPath UpdateRoute where
toPath :: UpdateRoute -> ByteString
toPath UpdateRoute' {Maybe Text
Text
RouteSpec
virtualRouterName :: Text
spec :: RouteSpec
routeName :: Text
meshName :: Text
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualRouterName:UpdateRoute' :: UpdateRoute -> Text
$sel:spec:UpdateRoute' :: UpdateRoute -> RouteSpec
$sel:routeName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshOwner:UpdateRoute' :: UpdateRoute -> Maybe Text
$sel:clientToken:UpdateRoute' :: UpdateRoute -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v20190125/meshes/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
meshName,
ByteString
"/virtualRouter/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualRouterName,
ByteString
"/routes/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
routeName
]
instance Core.ToQuery UpdateRoute where
toQuery :: UpdateRoute -> QueryString
toQuery UpdateRoute' {Maybe Text
Text
RouteSpec
virtualRouterName :: Text
spec :: RouteSpec
routeName :: Text
meshName :: Text
meshOwner :: Maybe Text
clientToken :: Maybe Text
$sel:virtualRouterName:UpdateRoute' :: UpdateRoute -> Text
$sel:spec:UpdateRoute' :: UpdateRoute -> RouteSpec
$sel:routeName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshName:UpdateRoute' :: UpdateRoute -> Text
$sel:meshOwner:UpdateRoute' :: UpdateRoute -> Maybe Text
$sel:clientToken:UpdateRoute' :: UpdateRoute -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"meshOwner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
meshOwner]
data UpdateRouteResponse = UpdateRouteResponse'
{
UpdateRouteResponse -> Int
httpStatus :: Prelude.Int,
UpdateRouteResponse -> RouteData
route :: RouteData
}
deriving (UpdateRouteResponse -> UpdateRouteResponse -> Bool
(UpdateRouteResponse -> UpdateRouteResponse -> Bool)
-> (UpdateRouteResponse -> UpdateRouteResponse -> Bool)
-> Eq UpdateRouteResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRouteResponse -> UpdateRouteResponse -> Bool
$c/= :: UpdateRouteResponse -> UpdateRouteResponse -> Bool
== :: UpdateRouteResponse -> UpdateRouteResponse -> Bool
$c== :: UpdateRouteResponse -> UpdateRouteResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRouteResponse]
ReadPrec UpdateRouteResponse
Int -> ReadS UpdateRouteResponse
ReadS [UpdateRouteResponse]
(Int -> ReadS UpdateRouteResponse)
-> ReadS [UpdateRouteResponse]
-> ReadPrec UpdateRouteResponse
-> ReadPrec [UpdateRouteResponse]
-> Read UpdateRouteResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRouteResponse]
$creadListPrec :: ReadPrec [UpdateRouteResponse]
readPrec :: ReadPrec UpdateRouteResponse
$creadPrec :: ReadPrec UpdateRouteResponse
readList :: ReadS [UpdateRouteResponse]
$creadList :: ReadS [UpdateRouteResponse]
readsPrec :: Int -> ReadS UpdateRouteResponse
$creadsPrec :: Int -> ReadS UpdateRouteResponse
Prelude.Read, Int -> UpdateRouteResponse -> ShowS
[UpdateRouteResponse] -> ShowS
UpdateRouteResponse -> String
(Int -> UpdateRouteResponse -> ShowS)
-> (UpdateRouteResponse -> String)
-> ([UpdateRouteResponse] -> ShowS)
-> Show UpdateRouteResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRouteResponse] -> ShowS
$cshowList :: [UpdateRouteResponse] -> ShowS
show :: UpdateRouteResponse -> String
$cshow :: UpdateRouteResponse -> String
showsPrec :: Int -> UpdateRouteResponse -> ShowS
$cshowsPrec :: Int -> UpdateRouteResponse -> ShowS
Prelude.Show, (forall x. UpdateRouteResponse -> Rep UpdateRouteResponse x)
-> (forall x. Rep UpdateRouteResponse x -> UpdateRouteResponse)
-> Generic UpdateRouteResponse
forall x. Rep UpdateRouteResponse x -> UpdateRouteResponse
forall x. UpdateRouteResponse -> Rep UpdateRouteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRouteResponse x -> UpdateRouteResponse
$cfrom :: forall x. UpdateRouteResponse -> Rep UpdateRouteResponse x
Prelude.Generic)
newUpdateRouteResponse ::
Prelude.Int ->
RouteData ->
UpdateRouteResponse
newUpdateRouteResponse :: Int -> RouteData -> UpdateRouteResponse
newUpdateRouteResponse Int
pHttpStatus_ RouteData
pRoute_ =
UpdateRouteResponse' :: Int -> RouteData -> UpdateRouteResponse
UpdateRouteResponse'
{ $sel:httpStatus:UpdateRouteResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:route:UpdateRouteResponse' :: RouteData
route = RouteData
pRoute_
}
updateRouteResponse_httpStatus :: Lens.Lens' UpdateRouteResponse Prelude.Int
updateRouteResponse_httpStatus :: (Int -> f Int) -> UpdateRouteResponse -> f UpdateRouteResponse
updateRouteResponse_httpStatus = (UpdateRouteResponse -> Int)
-> (UpdateRouteResponse -> Int -> UpdateRouteResponse)
-> Lens UpdateRouteResponse UpdateRouteResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRouteResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRouteResponse' :: UpdateRouteResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRouteResponse
s@UpdateRouteResponse' {} Int
a -> UpdateRouteResponse
s {$sel:httpStatus:UpdateRouteResponse' :: Int
httpStatus = Int
a} :: UpdateRouteResponse)
updateRouteResponse_route :: Lens.Lens' UpdateRouteResponse RouteData
updateRouteResponse_route :: (RouteData -> f RouteData)
-> UpdateRouteResponse -> f UpdateRouteResponse
updateRouteResponse_route = (UpdateRouteResponse -> RouteData)
-> (UpdateRouteResponse -> RouteData -> UpdateRouteResponse)
-> Lens UpdateRouteResponse UpdateRouteResponse RouteData RouteData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRouteResponse' {RouteData
route :: RouteData
$sel:route:UpdateRouteResponse' :: UpdateRouteResponse -> RouteData
route} -> RouteData
route) (\s :: UpdateRouteResponse
s@UpdateRouteResponse' {} RouteData
a -> UpdateRouteResponse
s {$sel:route:UpdateRouteResponse' :: RouteData
route = RouteData
a} :: UpdateRouteResponse)
instance Prelude.NFData UpdateRouteResponse