{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AppMesh.Types.HttpGatewayRoutePathRewrite
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.HttpGatewayRoutePathRewrite where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the path to rewrite.
--
-- /See:/ 'newHttpGatewayRoutePathRewrite' smart constructor.
data HttpGatewayRoutePathRewrite = HttpGatewayRoutePathRewrite'
  { -- | The exact path to rewrite.
    HttpGatewayRoutePathRewrite -> Maybe Text
exact :: Prelude.Maybe Prelude.Text
  }
  deriving (HttpGatewayRoutePathRewrite -> HttpGatewayRoutePathRewrite -> Bool
(HttpGatewayRoutePathRewrite
 -> HttpGatewayRoutePathRewrite -> Bool)
-> (HttpGatewayRoutePathRewrite
    -> HttpGatewayRoutePathRewrite -> Bool)
-> Eq HttpGatewayRoutePathRewrite
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpGatewayRoutePathRewrite -> HttpGatewayRoutePathRewrite -> Bool
$c/= :: HttpGatewayRoutePathRewrite -> HttpGatewayRoutePathRewrite -> Bool
== :: HttpGatewayRoutePathRewrite -> HttpGatewayRoutePathRewrite -> Bool
$c== :: HttpGatewayRoutePathRewrite -> HttpGatewayRoutePathRewrite -> Bool
Prelude.Eq, ReadPrec [HttpGatewayRoutePathRewrite]
ReadPrec HttpGatewayRoutePathRewrite
Int -> ReadS HttpGatewayRoutePathRewrite
ReadS [HttpGatewayRoutePathRewrite]
(Int -> ReadS HttpGatewayRoutePathRewrite)
-> ReadS [HttpGatewayRoutePathRewrite]
-> ReadPrec HttpGatewayRoutePathRewrite
-> ReadPrec [HttpGatewayRoutePathRewrite]
-> Read HttpGatewayRoutePathRewrite
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpGatewayRoutePathRewrite]
$creadListPrec :: ReadPrec [HttpGatewayRoutePathRewrite]
readPrec :: ReadPrec HttpGatewayRoutePathRewrite
$creadPrec :: ReadPrec HttpGatewayRoutePathRewrite
readList :: ReadS [HttpGatewayRoutePathRewrite]
$creadList :: ReadS [HttpGatewayRoutePathRewrite]
readsPrec :: Int -> ReadS HttpGatewayRoutePathRewrite
$creadsPrec :: Int -> ReadS HttpGatewayRoutePathRewrite
Prelude.Read, Int -> HttpGatewayRoutePathRewrite -> ShowS
[HttpGatewayRoutePathRewrite] -> ShowS
HttpGatewayRoutePathRewrite -> String
(Int -> HttpGatewayRoutePathRewrite -> ShowS)
-> (HttpGatewayRoutePathRewrite -> String)
-> ([HttpGatewayRoutePathRewrite] -> ShowS)
-> Show HttpGatewayRoutePathRewrite
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpGatewayRoutePathRewrite] -> ShowS
$cshowList :: [HttpGatewayRoutePathRewrite] -> ShowS
show :: HttpGatewayRoutePathRewrite -> String
$cshow :: HttpGatewayRoutePathRewrite -> String
showsPrec :: Int -> HttpGatewayRoutePathRewrite -> ShowS
$cshowsPrec :: Int -> HttpGatewayRoutePathRewrite -> ShowS
Prelude.Show, (forall x.
 HttpGatewayRoutePathRewrite -> Rep HttpGatewayRoutePathRewrite x)
-> (forall x.
    Rep HttpGatewayRoutePathRewrite x -> HttpGatewayRoutePathRewrite)
-> Generic HttpGatewayRoutePathRewrite
forall x.
Rep HttpGatewayRoutePathRewrite x -> HttpGatewayRoutePathRewrite
forall x.
HttpGatewayRoutePathRewrite -> Rep HttpGatewayRoutePathRewrite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HttpGatewayRoutePathRewrite x -> HttpGatewayRoutePathRewrite
$cfrom :: forall x.
HttpGatewayRoutePathRewrite -> Rep HttpGatewayRoutePathRewrite x
Prelude.Generic)

-- |
-- Create a value of 'HttpGatewayRoutePathRewrite' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'exact', 'httpGatewayRoutePathRewrite_exact' - The exact path to rewrite.
newHttpGatewayRoutePathRewrite ::
  HttpGatewayRoutePathRewrite
newHttpGatewayRoutePathRewrite :: HttpGatewayRoutePathRewrite
newHttpGatewayRoutePathRewrite =
  HttpGatewayRoutePathRewrite' :: Maybe Text -> HttpGatewayRoutePathRewrite
HttpGatewayRoutePathRewrite'
    { $sel:exact:HttpGatewayRoutePathRewrite' :: Maybe Text
exact =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The exact path to rewrite.
httpGatewayRoutePathRewrite_exact :: Lens.Lens' HttpGatewayRoutePathRewrite (Prelude.Maybe Prelude.Text)
httpGatewayRoutePathRewrite_exact :: (Maybe Text -> f (Maybe Text))
-> HttpGatewayRoutePathRewrite -> f HttpGatewayRoutePathRewrite
httpGatewayRoutePathRewrite_exact = (HttpGatewayRoutePathRewrite -> Maybe Text)
-> (HttpGatewayRoutePathRewrite
    -> Maybe Text -> HttpGatewayRoutePathRewrite)
-> Lens
     HttpGatewayRoutePathRewrite
     HttpGatewayRoutePathRewrite
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpGatewayRoutePathRewrite' {Maybe Text
exact :: Maybe Text
$sel:exact:HttpGatewayRoutePathRewrite' :: HttpGatewayRoutePathRewrite -> Maybe Text
exact} -> Maybe Text
exact) (\s :: HttpGatewayRoutePathRewrite
s@HttpGatewayRoutePathRewrite' {} Maybe Text
a -> HttpGatewayRoutePathRewrite
s {$sel:exact:HttpGatewayRoutePathRewrite' :: Maybe Text
exact = Maybe Text
a} :: HttpGatewayRoutePathRewrite)

instance Core.FromJSON HttpGatewayRoutePathRewrite where
  parseJSON :: Value -> Parser HttpGatewayRoutePathRewrite
parseJSON =
    String
-> (Object -> Parser HttpGatewayRoutePathRewrite)
-> Value
-> Parser HttpGatewayRoutePathRewrite
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HttpGatewayRoutePathRewrite"
      ( \Object
x ->
          Maybe Text -> HttpGatewayRoutePathRewrite
HttpGatewayRoutePathRewrite'
            (Maybe Text -> HttpGatewayRoutePathRewrite)
-> Parser (Maybe Text) -> Parser HttpGatewayRoutePathRewrite
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"exact")
      )

instance Prelude.Hashable HttpGatewayRoutePathRewrite

instance Prelude.NFData HttpGatewayRoutePathRewrite

instance Core.ToJSON HttpGatewayRoutePathRewrite where
  toJSON :: HttpGatewayRoutePathRewrite -> Value
toJSON HttpGatewayRoutePathRewrite' {Maybe Text
exact :: Maybe Text
$sel:exact:HttpGatewayRoutePathRewrite' :: HttpGatewayRoutePathRewrite -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"exact" 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
exact]
      )