{-# 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.FMS.Types.Route where
import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.DestinationType
import Amazonka.FMS.Types.TargetType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Route = Route'
{
Route -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
Route -> Maybe TargetType
targetType :: Prelude.Maybe TargetType,
Route -> Maybe DestinationType
destinationType :: Prelude.Maybe DestinationType,
Route -> Maybe Text
target :: Prelude.Maybe Prelude.Text
}
deriving (Route -> Route -> Bool
(Route -> Route -> Bool) -> (Route -> Route -> Bool) -> Eq Route
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Route -> Route -> Bool
$c/= :: Route -> Route -> Bool
== :: Route -> Route -> Bool
$c== :: Route -> Route -> Bool
Prelude.Eq, ReadPrec [Route]
ReadPrec Route
Int -> ReadS Route
ReadS [Route]
(Int -> ReadS Route)
-> ReadS [Route]
-> ReadPrec Route
-> ReadPrec [Route]
-> Read Route
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Route]
$creadListPrec :: ReadPrec [Route]
readPrec :: ReadPrec Route
$creadPrec :: ReadPrec Route
readList :: ReadS [Route]
$creadList :: ReadS [Route]
readsPrec :: Int -> ReadS Route
$creadsPrec :: Int -> ReadS Route
Prelude.Read, Int -> Route -> ShowS
[Route] -> ShowS
Route -> String
(Int -> Route -> ShowS)
-> (Route -> String) -> ([Route] -> ShowS) -> Show Route
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Route] -> ShowS
$cshowList :: [Route] -> ShowS
show :: Route -> String
$cshow :: Route -> String
showsPrec :: Int -> Route -> ShowS
$cshowsPrec :: Int -> Route -> ShowS
Prelude.Show, (forall x. Route -> Rep Route x)
-> (forall x. Rep Route x -> Route) -> Generic Route
forall x. Rep Route x -> Route
forall x. Route -> Rep Route x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Route x -> Route
$cfrom :: forall x. Route -> Rep Route x
Prelude.Generic)
newRoute ::
Route
newRoute :: Route
newRoute =
Route' :: Maybe Text
-> Maybe TargetType -> Maybe DestinationType -> Maybe Text -> Route
Route'
{ $sel:destination:Route' :: Maybe Text
destination = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetType:Route' :: Maybe TargetType
targetType = Maybe TargetType
forall a. Maybe a
Prelude.Nothing,
$sel:destinationType:Route' :: Maybe DestinationType
destinationType = Maybe DestinationType
forall a. Maybe a
Prelude.Nothing,
$sel:target:Route' :: Maybe Text
target = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
route_destination :: Lens.Lens' Route (Prelude.Maybe Prelude.Text)
route_destination :: (Maybe Text -> f (Maybe Text)) -> Route -> f Route
route_destination = (Route -> Maybe Text)
-> (Route -> Maybe Text -> Route)
-> Lens Route Route (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe Text
destination :: Maybe Text
$sel:destination:Route' :: Route -> Maybe Text
destination} -> Maybe Text
destination) (\s :: Route
s@Route' {} Maybe Text
a -> Route
s {$sel:destination:Route' :: Maybe Text
destination = Maybe Text
a} :: Route)
route_targetType :: Lens.Lens' Route (Prelude.Maybe TargetType)
route_targetType :: (Maybe TargetType -> f (Maybe TargetType)) -> Route -> f Route
route_targetType = (Route -> Maybe TargetType)
-> (Route -> Maybe TargetType -> Route)
-> Lens Route Route (Maybe TargetType) (Maybe TargetType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe TargetType
targetType :: Maybe TargetType
$sel:targetType:Route' :: Route -> Maybe TargetType
targetType} -> Maybe TargetType
targetType) (\s :: Route
s@Route' {} Maybe TargetType
a -> Route
s {$sel:targetType:Route' :: Maybe TargetType
targetType = Maybe TargetType
a} :: Route)
route_destinationType :: Lens.Lens' Route (Prelude.Maybe DestinationType)
route_destinationType :: (Maybe DestinationType -> f (Maybe DestinationType))
-> Route -> f Route
route_destinationType = (Route -> Maybe DestinationType)
-> (Route -> Maybe DestinationType -> Route)
-> Lens Route Route (Maybe DestinationType) (Maybe DestinationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe DestinationType
destinationType :: Maybe DestinationType
$sel:destinationType:Route' :: Route -> Maybe DestinationType
destinationType} -> Maybe DestinationType
destinationType) (\s :: Route
s@Route' {} Maybe DestinationType
a -> Route
s {$sel:destinationType:Route' :: Maybe DestinationType
destinationType = Maybe DestinationType
a} :: Route)
route_target :: Lens.Lens' Route (Prelude.Maybe Prelude.Text)
route_target :: (Maybe Text -> f (Maybe Text)) -> Route -> f Route
route_target = (Route -> Maybe Text)
-> (Route -> Maybe Text -> Route)
-> Lens Route Route (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe Text
target :: Maybe Text
$sel:target:Route' :: Route -> Maybe Text
target} -> Maybe Text
target) (\s :: Route
s@Route' {} Maybe Text
a -> Route
s {$sel:target:Route' :: Maybe Text
target = Maybe Text
a} :: Route)
instance Core.FromJSON Route where
parseJSON :: Value -> Parser Route
parseJSON =
String -> (Object -> Parser Route) -> Value -> Parser Route
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Route"
( \Object
x ->
Maybe Text
-> Maybe TargetType -> Maybe DestinationType -> Maybe Text -> Route
Route'
(Maybe Text
-> Maybe TargetType
-> Maybe DestinationType
-> Maybe Text
-> Route)
-> Parser (Maybe Text)
-> Parser
(Maybe TargetType -> Maybe DestinationType -> Maybe Text -> Route)
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
"Destination")
Parser
(Maybe TargetType -> Maybe DestinationType -> Maybe Text -> Route)
-> Parser (Maybe TargetType)
-> Parser (Maybe DestinationType -> Maybe Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TargetType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetType")
Parser (Maybe DestinationType -> Maybe Text -> Route)
-> Parser (Maybe DestinationType) -> Parser (Maybe Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DestinationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationType")
Parser (Maybe Text -> Route) -> Parser (Maybe Text) -> Parser Route
forall (f :: * -> *) a b. Applicative f => 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
"Target")
)
instance Prelude.Hashable Route
instance Prelude.NFData Route