{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AppMesh.Types.HttpGatewayRouteRewrite where
import Amazonka.AppMesh.Types.GatewayRouteHostnameRewrite
import Amazonka.AppMesh.Types.HttpGatewayRoutePathRewrite
import Amazonka.AppMesh.Types.HttpGatewayRoutePrefixRewrite
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HttpGatewayRouteRewrite = HttpGatewayRouteRewrite'
{
HttpGatewayRouteRewrite -> Maybe GatewayRouteHostnameRewrite
hostname :: Prelude.Maybe GatewayRouteHostnameRewrite,
HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePathRewrite
path :: Prelude.Maybe HttpGatewayRoutePathRewrite,
HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePrefixRewrite
prefix :: Prelude.Maybe HttpGatewayRoutePrefixRewrite
}
deriving (HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool
(HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool)
-> (HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool)
-> Eq HttpGatewayRouteRewrite
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool
$c/= :: HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool
== :: HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool
$c== :: HttpGatewayRouteRewrite -> HttpGatewayRouteRewrite -> Bool
Prelude.Eq, ReadPrec [HttpGatewayRouteRewrite]
ReadPrec HttpGatewayRouteRewrite
Int -> ReadS HttpGatewayRouteRewrite
ReadS [HttpGatewayRouteRewrite]
(Int -> ReadS HttpGatewayRouteRewrite)
-> ReadS [HttpGatewayRouteRewrite]
-> ReadPrec HttpGatewayRouteRewrite
-> ReadPrec [HttpGatewayRouteRewrite]
-> Read HttpGatewayRouteRewrite
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpGatewayRouteRewrite]
$creadListPrec :: ReadPrec [HttpGatewayRouteRewrite]
readPrec :: ReadPrec HttpGatewayRouteRewrite
$creadPrec :: ReadPrec HttpGatewayRouteRewrite
readList :: ReadS [HttpGatewayRouteRewrite]
$creadList :: ReadS [HttpGatewayRouteRewrite]
readsPrec :: Int -> ReadS HttpGatewayRouteRewrite
$creadsPrec :: Int -> ReadS HttpGatewayRouteRewrite
Prelude.Read, Int -> HttpGatewayRouteRewrite -> ShowS
[HttpGatewayRouteRewrite] -> ShowS
HttpGatewayRouteRewrite -> String
(Int -> HttpGatewayRouteRewrite -> ShowS)
-> (HttpGatewayRouteRewrite -> String)
-> ([HttpGatewayRouteRewrite] -> ShowS)
-> Show HttpGatewayRouteRewrite
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpGatewayRouteRewrite] -> ShowS
$cshowList :: [HttpGatewayRouteRewrite] -> ShowS
show :: HttpGatewayRouteRewrite -> String
$cshow :: HttpGatewayRouteRewrite -> String
showsPrec :: Int -> HttpGatewayRouteRewrite -> ShowS
$cshowsPrec :: Int -> HttpGatewayRouteRewrite -> ShowS
Prelude.Show, (forall x.
HttpGatewayRouteRewrite -> Rep HttpGatewayRouteRewrite x)
-> (forall x.
Rep HttpGatewayRouteRewrite x -> HttpGatewayRouteRewrite)
-> Generic HttpGatewayRouteRewrite
forall x. Rep HttpGatewayRouteRewrite x -> HttpGatewayRouteRewrite
forall x. HttpGatewayRouteRewrite -> Rep HttpGatewayRouteRewrite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpGatewayRouteRewrite x -> HttpGatewayRouteRewrite
$cfrom :: forall x. HttpGatewayRouteRewrite -> Rep HttpGatewayRouteRewrite x
Prelude.Generic)
newHttpGatewayRouteRewrite ::
HttpGatewayRouteRewrite
newHttpGatewayRouteRewrite :: HttpGatewayRouteRewrite
newHttpGatewayRouteRewrite =
HttpGatewayRouteRewrite' :: Maybe GatewayRouteHostnameRewrite
-> Maybe HttpGatewayRoutePathRewrite
-> Maybe HttpGatewayRoutePrefixRewrite
-> HttpGatewayRouteRewrite
HttpGatewayRouteRewrite'
{ $sel:hostname:HttpGatewayRouteRewrite' :: Maybe GatewayRouteHostnameRewrite
hostname =
Maybe GatewayRouteHostnameRewrite
forall a. Maybe a
Prelude.Nothing,
$sel:path:HttpGatewayRouteRewrite' :: Maybe HttpGatewayRoutePathRewrite
path = Maybe HttpGatewayRoutePathRewrite
forall a. Maybe a
Prelude.Nothing,
$sel:prefix:HttpGatewayRouteRewrite' :: Maybe HttpGatewayRoutePrefixRewrite
prefix = Maybe HttpGatewayRoutePrefixRewrite
forall a. Maybe a
Prelude.Nothing
}
httpGatewayRouteRewrite_hostname :: Lens.Lens' HttpGatewayRouteRewrite (Prelude.Maybe GatewayRouteHostnameRewrite)
httpGatewayRouteRewrite_hostname :: (Maybe GatewayRouteHostnameRewrite
-> f (Maybe GatewayRouteHostnameRewrite))
-> HttpGatewayRouteRewrite -> f HttpGatewayRouteRewrite
httpGatewayRouteRewrite_hostname = (HttpGatewayRouteRewrite -> Maybe GatewayRouteHostnameRewrite)
-> (HttpGatewayRouteRewrite
-> Maybe GatewayRouteHostnameRewrite -> HttpGatewayRouteRewrite)
-> Lens
HttpGatewayRouteRewrite
HttpGatewayRouteRewrite
(Maybe GatewayRouteHostnameRewrite)
(Maybe GatewayRouteHostnameRewrite)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpGatewayRouteRewrite' {Maybe GatewayRouteHostnameRewrite
hostname :: Maybe GatewayRouteHostnameRewrite
$sel:hostname:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe GatewayRouteHostnameRewrite
hostname} -> Maybe GatewayRouteHostnameRewrite
hostname) (\s :: HttpGatewayRouteRewrite
s@HttpGatewayRouteRewrite' {} Maybe GatewayRouteHostnameRewrite
a -> HttpGatewayRouteRewrite
s {$sel:hostname:HttpGatewayRouteRewrite' :: Maybe GatewayRouteHostnameRewrite
hostname = Maybe GatewayRouteHostnameRewrite
a} :: HttpGatewayRouteRewrite)
httpGatewayRouteRewrite_path :: Lens.Lens' HttpGatewayRouteRewrite (Prelude.Maybe HttpGatewayRoutePathRewrite)
httpGatewayRouteRewrite_path :: (Maybe HttpGatewayRoutePathRewrite
-> f (Maybe HttpGatewayRoutePathRewrite))
-> HttpGatewayRouteRewrite -> f HttpGatewayRouteRewrite
httpGatewayRouteRewrite_path = (HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePathRewrite)
-> (HttpGatewayRouteRewrite
-> Maybe HttpGatewayRoutePathRewrite -> HttpGatewayRouteRewrite)
-> Lens
HttpGatewayRouteRewrite
HttpGatewayRouteRewrite
(Maybe HttpGatewayRoutePathRewrite)
(Maybe HttpGatewayRoutePathRewrite)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpGatewayRouteRewrite' {Maybe HttpGatewayRoutePathRewrite
path :: Maybe HttpGatewayRoutePathRewrite
$sel:path:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePathRewrite
path} -> Maybe HttpGatewayRoutePathRewrite
path) (\s :: HttpGatewayRouteRewrite
s@HttpGatewayRouteRewrite' {} Maybe HttpGatewayRoutePathRewrite
a -> HttpGatewayRouteRewrite
s {$sel:path:HttpGatewayRouteRewrite' :: Maybe HttpGatewayRoutePathRewrite
path = Maybe HttpGatewayRoutePathRewrite
a} :: HttpGatewayRouteRewrite)
httpGatewayRouteRewrite_prefix :: Lens.Lens' HttpGatewayRouteRewrite (Prelude.Maybe HttpGatewayRoutePrefixRewrite)
httpGatewayRouteRewrite_prefix :: (Maybe HttpGatewayRoutePrefixRewrite
-> f (Maybe HttpGatewayRoutePrefixRewrite))
-> HttpGatewayRouteRewrite -> f HttpGatewayRouteRewrite
httpGatewayRouteRewrite_prefix = (HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePrefixRewrite)
-> (HttpGatewayRouteRewrite
-> Maybe HttpGatewayRoutePrefixRewrite -> HttpGatewayRouteRewrite)
-> Lens
HttpGatewayRouteRewrite
HttpGatewayRouteRewrite
(Maybe HttpGatewayRoutePrefixRewrite)
(Maybe HttpGatewayRoutePrefixRewrite)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpGatewayRouteRewrite' {Maybe HttpGatewayRoutePrefixRewrite
prefix :: Maybe HttpGatewayRoutePrefixRewrite
$sel:prefix:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePrefixRewrite
prefix} -> Maybe HttpGatewayRoutePrefixRewrite
prefix) (\s :: HttpGatewayRouteRewrite
s@HttpGatewayRouteRewrite' {} Maybe HttpGatewayRoutePrefixRewrite
a -> HttpGatewayRouteRewrite
s {$sel:prefix:HttpGatewayRouteRewrite' :: Maybe HttpGatewayRoutePrefixRewrite
prefix = Maybe HttpGatewayRoutePrefixRewrite
a} :: HttpGatewayRouteRewrite)
instance Core.FromJSON HttpGatewayRouteRewrite where
parseJSON :: Value -> Parser HttpGatewayRouteRewrite
parseJSON =
String
-> (Object -> Parser HttpGatewayRouteRewrite)
-> Value
-> Parser HttpGatewayRouteRewrite
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HttpGatewayRouteRewrite"
( \Object
x ->
Maybe GatewayRouteHostnameRewrite
-> Maybe HttpGatewayRoutePathRewrite
-> Maybe HttpGatewayRoutePrefixRewrite
-> HttpGatewayRouteRewrite
HttpGatewayRouteRewrite'
(Maybe GatewayRouteHostnameRewrite
-> Maybe HttpGatewayRoutePathRewrite
-> Maybe HttpGatewayRoutePrefixRewrite
-> HttpGatewayRouteRewrite)
-> Parser (Maybe GatewayRouteHostnameRewrite)
-> Parser
(Maybe HttpGatewayRoutePathRewrite
-> Maybe HttpGatewayRoutePrefixRewrite -> HttpGatewayRouteRewrite)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GatewayRouteHostnameRewrite)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hostname")
Parser
(Maybe HttpGatewayRoutePathRewrite
-> Maybe HttpGatewayRoutePrefixRewrite -> HttpGatewayRouteRewrite)
-> Parser (Maybe HttpGatewayRoutePathRewrite)
-> Parser
(Maybe HttpGatewayRoutePrefixRewrite -> HttpGatewayRouteRewrite)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HttpGatewayRoutePathRewrite)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"path")
Parser
(Maybe HttpGatewayRoutePrefixRewrite -> HttpGatewayRouteRewrite)
-> Parser (Maybe HttpGatewayRoutePrefixRewrite)
-> Parser HttpGatewayRouteRewrite
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HttpGatewayRoutePrefixRewrite)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"prefix")
)
instance Prelude.Hashable HttpGatewayRouteRewrite
instance Prelude.NFData HttpGatewayRouteRewrite
instance Core.ToJSON HttpGatewayRouteRewrite where
toJSON :: HttpGatewayRouteRewrite -> Value
toJSON HttpGatewayRouteRewrite' {Maybe GatewayRouteHostnameRewrite
Maybe HttpGatewayRoutePathRewrite
Maybe HttpGatewayRoutePrefixRewrite
prefix :: Maybe HttpGatewayRoutePrefixRewrite
path :: Maybe HttpGatewayRoutePathRewrite
hostname :: Maybe GatewayRouteHostnameRewrite
$sel:prefix:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePrefixRewrite
$sel:path:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe HttpGatewayRoutePathRewrite
$sel:hostname:HttpGatewayRouteRewrite' :: HttpGatewayRouteRewrite -> Maybe GatewayRouteHostnameRewrite
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"hostname" Text -> GatewayRouteHostnameRewrite -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (GatewayRouteHostnameRewrite -> Pair)
-> Maybe GatewayRouteHostnameRewrite -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GatewayRouteHostnameRewrite
hostname,
(Text
"path" Text -> HttpGatewayRoutePathRewrite -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HttpGatewayRoutePathRewrite -> Pair)
-> Maybe HttpGatewayRoutePathRewrite -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HttpGatewayRoutePathRewrite
path,
(Text
"prefix" Text -> HttpGatewayRoutePrefixRewrite -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HttpGatewayRoutePrefixRewrite -> Pair)
-> Maybe HttpGatewayRoutePrefixRewrite -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HttpGatewayRoutePrefixRewrite
prefix
]
)