{-# 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.Location.CalculateRoute
(
CalculateRoute (..),
newCalculateRoute,
calculateRoute_distanceUnit,
calculateRoute_truckModeOptions,
calculateRoute_waypointPositions,
calculateRoute_includeLegGeometry,
calculateRoute_departNow,
calculateRoute_travelMode,
calculateRoute_carModeOptions,
calculateRoute_departureTime,
calculateRoute_calculatorName,
calculateRoute_departurePosition,
calculateRoute_destinationPosition,
CalculateRouteResponse (..),
newCalculateRouteResponse,
calculateRouteResponse_httpStatus,
calculateRouteResponse_legs,
calculateRouteResponse_summary,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CalculateRoute = CalculateRoute'
{
CalculateRoute -> Maybe DistanceUnit
distanceUnit :: Prelude.Maybe DistanceUnit,
CalculateRoute -> Maybe CalculateRouteTruckModeOptions
truckModeOptions :: Prelude.Maybe CalculateRouteTruckModeOptions,
CalculateRoute -> Maybe [Sensitive (NonEmpty Double)]
waypointPositions :: Prelude.Maybe [Core.Sensitive (Prelude.NonEmpty Prelude.Double)],
CalculateRoute -> Maybe Bool
includeLegGeometry :: Prelude.Maybe Prelude.Bool,
CalculateRoute -> Maybe Bool
departNow :: Prelude.Maybe Prelude.Bool,
CalculateRoute -> Maybe TravelMode
travelMode :: Prelude.Maybe TravelMode,
CalculateRoute -> Maybe CalculateRouteCarModeOptions
carModeOptions :: Prelude.Maybe CalculateRouteCarModeOptions,
CalculateRoute -> Maybe POSIX
departureTime :: Prelude.Maybe Core.POSIX,
CalculateRoute -> Text
calculatorName :: Prelude.Text,
CalculateRoute -> Sensitive (NonEmpty Double)
departurePosition :: Core.Sensitive (Prelude.NonEmpty Prelude.Double),
CalculateRoute -> Sensitive (NonEmpty Double)
destinationPosition :: Core.Sensitive (Prelude.NonEmpty Prelude.Double)
}
deriving (CalculateRoute -> CalculateRoute -> Bool
(CalculateRoute -> CalculateRoute -> Bool)
-> (CalculateRoute -> CalculateRoute -> Bool) -> Eq CalculateRoute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalculateRoute -> CalculateRoute -> Bool
$c/= :: CalculateRoute -> CalculateRoute -> Bool
== :: CalculateRoute -> CalculateRoute -> Bool
$c== :: CalculateRoute -> CalculateRoute -> Bool
Prelude.Eq, Int -> CalculateRoute -> ShowS
[CalculateRoute] -> ShowS
CalculateRoute -> String
(Int -> CalculateRoute -> ShowS)
-> (CalculateRoute -> String)
-> ([CalculateRoute] -> ShowS)
-> Show CalculateRoute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CalculateRoute] -> ShowS
$cshowList :: [CalculateRoute] -> ShowS
show :: CalculateRoute -> String
$cshow :: CalculateRoute -> String
showsPrec :: Int -> CalculateRoute -> ShowS
$cshowsPrec :: Int -> CalculateRoute -> ShowS
Prelude.Show, (forall x. CalculateRoute -> Rep CalculateRoute x)
-> (forall x. Rep CalculateRoute x -> CalculateRoute)
-> Generic CalculateRoute
forall x. Rep CalculateRoute x -> CalculateRoute
forall x. CalculateRoute -> Rep CalculateRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CalculateRoute x -> CalculateRoute
$cfrom :: forall x. CalculateRoute -> Rep CalculateRoute x
Prelude.Generic)
newCalculateRoute ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Double ->
Prelude.NonEmpty Prelude.Double ->
CalculateRoute
newCalculateRoute :: Text -> NonEmpty Double -> NonEmpty Double -> CalculateRoute
newCalculateRoute
Text
pCalculatorName_
NonEmpty Double
pDeparturePosition_
NonEmpty Double
pDestinationPosition_ =
CalculateRoute' :: Maybe DistanceUnit
-> Maybe CalculateRouteTruckModeOptions
-> Maybe [Sensitive (NonEmpty Double)]
-> Maybe Bool
-> Maybe Bool
-> Maybe TravelMode
-> Maybe CalculateRouteCarModeOptions
-> Maybe POSIX
-> Text
-> Sensitive (NonEmpty Double)
-> Sensitive (NonEmpty Double)
-> CalculateRoute
CalculateRoute'
{ $sel:distanceUnit:CalculateRoute' :: Maybe DistanceUnit
distanceUnit = Maybe DistanceUnit
forall a. Maybe a
Prelude.Nothing,
$sel:truckModeOptions:CalculateRoute' :: Maybe CalculateRouteTruckModeOptions
truckModeOptions = Maybe CalculateRouteTruckModeOptions
forall a. Maybe a
Prelude.Nothing,
$sel:waypointPositions:CalculateRoute' :: Maybe [Sensitive (NonEmpty Double)]
waypointPositions = Maybe [Sensitive (NonEmpty Double)]
forall a. Maybe a
Prelude.Nothing,
$sel:includeLegGeometry:CalculateRoute' :: Maybe Bool
includeLegGeometry = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:departNow:CalculateRoute' :: Maybe Bool
departNow = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:travelMode:CalculateRoute' :: Maybe TravelMode
travelMode = Maybe TravelMode
forall a. Maybe a
Prelude.Nothing,
$sel:carModeOptions:CalculateRoute' :: Maybe CalculateRouteCarModeOptions
carModeOptions = Maybe CalculateRouteCarModeOptions
forall a. Maybe a
Prelude.Nothing,
$sel:departureTime:CalculateRoute' :: Maybe POSIX
departureTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:calculatorName:CalculateRoute' :: Text
calculatorName = Text
pCalculatorName_,
$sel:departurePosition:CalculateRoute' :: Sensitive (NonEmpty Double)
departurePosition =
Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
(Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pDeparturePosition_,
$sel:destinationPosition:CalculateRoute' :: Sensitive (NonEmpty Double)
destinationPosition =
Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
(Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
(Sensitive (NonEmpty Double))
(Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pDestinationPosition_
}
calculateRoute_distanceUnit :: Lens.Lens' CalculateRoute (Prelude.Maybe DistanceUnit)
calculateRoute_distanceUnit :: (Maybe DistanceUnit -> f (Maybe DistanceUnit))
-> CalculateRoute -> f CalculateRoute
calculateRoute_distanceUnit = (CalculateRoute -> Maybe DistanceUnit)
-> (CalculateRoute -> Maybe DistanceUnit -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Maybe DistanceUnit)
(Maybe DistanceUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe DistanceUnit
distanceUnit :: Maybe DistanceUnit
$sel:distanceUnit:CalculateRoute' :: CalculateRoute -> Maybe DistanceUnit
distanceUnit} -> Maybe DistanceUnit
distanceUnit) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe DistanceUnit
a -> CalculateRoute
s {$sel:distanceUnit:CalculateRoute' :: Maybe DistanceUnit
distanceUnit = Maybe DistanceUnit
a} :: CalculateRoute)
calculateRoute_truckModeOptions :: Lens.Lens' CalculateRoute (Prelude.Maybe CalculateRouteTruckModeOptions)
calculateRoute_truckModeOptions :: (Maybe CalculateRouteTruckModeOptions
-> f (Maybe CalculateRouteTruckModeOptions))
-> CalculateRoute -> f CalculateRoute
calculateRoute_truckModeOptions = (CalculateRoute -> Maybe CalculateRouteTruckModeOptions)
-> (CalculateRoute
-> Maybe CalculateRouteTruckModeOptions -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Maybe CalculateRouteTruckModeOptions)
(Maybe CalculateRouteTruckModeOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe CalculateRouteTruckModeOptions
truckModeOptions :: Maybe CalculateRouteTruckModeOptions
$sel:truckModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteTruckModeOptions
truckModeOptions} -> Maybe CalculateRouteTruckModeOptions
truckModeOptions) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe CalculateRouteTruckModeOptions
a -> CalculateRoute
s {$sel:truckModeOptions:CalculateRoute' :: Maybe CalculateRouteTruckModeOptions
truckModeOptions = Maybe CalculateRouteTruckModeOptions
a} :: CalculateRoute)
calculateRoute_waypointPositions :: Lens.Lens' CalculateRoute (Prelude.Maybe [Prelude.NonEmpty Prelude.Double])
calculateRoute_waypointPositions :: (Maybe [NonEmpty Double] -> f (Maybe [NonEmpty Double]))
-> CalculateRoute -> f CalculateRoute
calculateRoute_waypointPositions = (CalculateRoute -> Maybe [Sensitive (NonEmpty Double)])
-> (CalculateRoute
-> Maybe [Sensitive (NonEmpty Double)] -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Maybe [Sensitive (NonEmpty Double)])
(Maybe [Sensitive (NonEmpty Double)])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe [Sensitive (NonEmpty Double)]
waypointPositions :: Maybe [Sensitive (NonEmpty Double)]
$sel:waypointPositions:CalculateRoute' :: CalculateRoute -> Maybe [Sensitive (NonEmpty Double)]
waypointPositions} -> Maybe [Sensitive (NonEmpty Double)]
waypointPositions) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe [Sensitive (NonEmpty Double)]
a -> CalculateRoute
s {$sel:waypointPositions:CalculateRoute' :: Maybe [Sensitive (NonEmpty Double)]
waypointPositions = Maybe [Sensitive (NonEmpty Double)]
a} :: CalculateRoute) ((Maybe [Sensitive (NonEmpty Double)]
-> f (Maybe [Sensitive (NonEmpty Double)]))
-> CalculateRoute -> f CalculateRoute)
-> ((Maybe [NonEmpty Double] -> f (Maybe [NonEmpty Double]))
-> Maybe [Sensitive (NonEmpty Double)]
-> f (Maybe [Sensitive (NonEmpty Double)]))
-> (Maybe [NonEmpty Double] -> f (Maybe [NonEmpty Double]))
-> CalculateRoute
-> f CalculateRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[Sensitive (NonEmpty Double)]
[Sensitive (NonEmpty Double)]
[NonEmpty Double]
[NonEmpty Double]
-> Iso
(Maybe [Sensitive (NonEmpty Double)])
(Maybe [Sensitive (NonEmpty Double)])
(Maybe [NonEmpty Double])
(Maybe [NonEmpty Double])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[Sensitive (NonEmpty Double)]
[Sensitive (NonEmpty Double)]
[NonEmpty Double]
[NonEmpty Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
calculateRoute_includeLegGeometry :: Lens.Lens' CalculateRoute (Prelude.Maybe Prelude.Bool)
calculateRoute_includeLegGeometry :: (Maybe Bool -> f (Maybe Bool))
-> CalculateRoute -> f CalculateRoute
calculateRoute_includeLegGeometry = (CalculateRoute -> Maybe Bool)
-> (CalculateRoute -> Maybe Bool -> CalculateRoute)
-> Lens CalculateRoute CalculateRoute (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe Bool
includeLegGeometry :: Maybe Bool
$sel:includeLegGeometry:CalculateRoute' :: CalculateRoute -> Maybe Bool
includeLegGeometry} -> Maybe Bool
includeLegGeometry) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe Bool
a -> CalculateRoute
s {$sel:includeLegGeometry:CalculateRoute' :: Maybe Bool
includeLegGeometry = Maybe Bool
a} :: CalculateRoute)
calculateRoute_departNow :: Lens.Lens' CalculateRoute (Prelude.Maybe Prelude.Bool)
calculateRoute_departNow :: (Maybe Bool -> f (Maybe Bool))
-> CalculateRoute -> f CalculateRoute
calculateRoute_departNow = (CalculateRoute -> Maybe Bool)
-> (CalculateRoute -> Maybe Bool -> CalculateRoute)
-> Lens CalculateRoute CalculateRoute (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe Bool
departNow :: Maybe Bool
$sel:departNow:CalculateRoute' :: CalculateRoute -> Maybe Bool
departNow} -> Maybe Bool
departNow) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe Bool
a -> CalculateRoute
s {$sel:departNow:CalculateRoute' :: Maybe Bool
departNow = Maybe Bool
a} :: CalculateRoute)
calculateRoute_travelMode :: Lens.Lens' CalculateRoute (Prelude.Maybe TravelMode)
calculateRoute_travelMode :: (Maybe TravelMode -> f (Maybe TravelMode))
-> CalculateRoute -> f CalculateRoute
calculateRoute_travelMode = (CalculateRoute -> Maybe TravelMode)
-> (CalculateRoute -> Maybe TravelMode -> CalculateRoute)
-> Lens
CalculateRoute CalculateRoute (Maybe TravelMode) (Maybe TravelMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe TravelMode
travelMode :: Maybe TravelMode
$sel:travelMode:CalculateRoute' :: CalculateRoute -> Maybe TravelMode
travelMode} -> Maybe TravelMode
travelMode) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe TravelMode
a -> CalculateRoute
s {$sel:travelMode:CalculateRoute' :: Maybe TravelMode
travelMode = Maybe TravelMode
a} :: CalculateRoute)
calculateRoute_carModeOptions :: Lens.Lens' CalculateRoute (Prelude.Maybe CalculateRouteCarModeOptions)
calculateRoute_carModeOptions :: (Maybe CalculateRouteCarModeOptions
-> f (Maybe CalculateRouteCarModeOptions))
-> CalculateRoute -> f CalculateRoute
calculateRoute_carModeOptions = (CalculateRoute -> Maybe CalculateRouteCarModeOptions)
-> (CalculateRoute
-> Maybe CalculateRouteCarModeOptions -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Maybe CalculateRouteCarModeOptions)
(Maybe CalculateRouteCarModeOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe CalculateRouteCarModeOptions
carModeOptions :: Maybe CalculateRouteCarModeOptions
$sel:carModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteCarModeOptions
carModeOptions} -> Maybe CalculateRouteCarModeOptions
carModeOptions) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe CalculateRouteCarModeOptions
a -> CalculateRoute
s {$sel:carModeOptions:CalculateRoute' :: Maybe CalculateRouteCarModeOptions
carModeOptions = Maybe CalculateRouteCarModeOptions
a} :: CalculateRoute)
calculateRoute_departureTime :: Lens.Lens' CalculateRoute (Prelude.Maybe Prelude.UTCTime)
calculateRoute_departureTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CalculateRoute -> f CalculateRoute
calculateRoute_departureTime = (CalculateRoute -> Maybe POSIX)
-> (CalculateRoute -> Maybe POSIX -> CalculateRoute)
-> Lens CalculateRoute CalculateRoute (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Maybe POSIX
departureTime :: Maybe POSIX
$sel:departureTime:CalculateRoute' :: CalculateRoute -> Maybe POSIX
departureTime} -> Maybe POSIX
departureTime) (\s :: CalculateRoute
s@CalculateRoute' {} Maybe POSIX
a -> CalculateRoute
s {$sel:departureTime:CalculateRoute' :: Maybe POSIX
departureTime = Maybe POSIX
a} :: CalculateRoute) ((Maybe POSIX -> f (Maybe POSIX))
-> CalculateRoute -> f CalculateRoute)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CalculateRoute
-> f CalculateRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
calculateRoute_calculatorName :: Lens.Lens' CalculateRoute Prelude.Text
calculateRoute_calculatorName :: (Text -> f Text) -> CalculateRoute -> f CalculateRoute
calculateRoute_calculatorName = (CalculateRoute -> Text)
-> (CalculateRoute -> Text -> CalculateRoute)
-> Lens CalculateRoute CalculateRoute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Text
calculatorName :: Text
$sel:calculatorName:CalculateRoute' :: CalculateRoute -> Text
calculatorName} -> Text
calculatorName) (\s :: CalculateRoute
s@CalculateRoute' {} Text
a -> CalculateRoute
s {$sel:calculatorName:CalculateRoute' :: Text
calculatorName = Text
a} :: CalculateRoute)
calculateRoute_departurePosition :: Lens.Lens' CalculateRoute (Prelude.NonEmpty Prelude.Double)
calculateRoute_departurePosition :: (NonEmpty Double -> f (NonEmpty Double))
-> CalculateRoute -> f CalculateRoute
calculateRoute_departurePosition = (CalculateRoute -> Sensitive (NonEmpty Double))
-> (CalculateRoute
-> Sensitive (NonEmpty Double) -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Sensitive (NonEmpty Double))
(Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Sensitive (NonEmpty Double)
departurePosition :: Sensitive (NonEmpty Double)
$sel:departurePosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
departurePosition} -> Sensitive (NonEmpty Double)
departurePosition) (\s :: CalculateRoute
s@CalculateRoute' {} Sensitive (NonEmpty Double)
a -> CalculateRoute
s {$sel:departurePosition:CalculateRoute' :: Sensitive (NonEmpty Double)
departurePosition = Sensitive (NonEmpty Double)
a} :: CalculateRoute) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> CalculateRoute -> f CalculateRoute)
-> ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> CalculateRoute
-> f CalculateRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
calculateRoute_destinationPosition :: Lens.Lens' CalculateRoute (Prelude.NonEmpty Prelude.Double)
calculateRoute_destinationPosition :: (NonEmpty Double -> f (NonEmpty Double))
-> CalculateRoute -> f CalculateRoute
calculateRoute_destinationPosition = (CalculateRoute -> Sensitive (NonEmpty Double))
-> (CalculateRoute
-> Sensitive (NonEmpty Double) -> CalculateRoute)
-> Lens
CalculateRoute
CalculateRoute
(Sensitive (NonEmpty Double))
(Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRoute' {Sensitive (NonEmpty Double)
destinationPosition :: Sensitive (NonEmpty Double)
$sel:destinationPosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
destinationPosition} -> Sensitive (NonEmpty Double)
destinationPosition) (\s :: CalculateRoute
s@CalculateRoute' {} Sensitive (NonEmpty Double)
a -> CalculateRoute
s {$sel:destinationPosition:CalculateRoute' :: Sensitive (NonEmpty Double)
destinationPosition = Sensitive (NonEmpty Double)
a} :: CalculateRoute) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> CalculateRoute -> f CalculateRoute)
-> ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> CalculateRoute
-> f CalculateRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CalculateRoute where
type
AWSResponse CalculateRoute =
CalculateRouteResponse
request :: CalculateRoute -> Request CalculateRoute
request = Service -> CalculateRoute -> Request CalculateRoute
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CalculateRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CalculateRoute)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CalculateRoute))
-> Logger
-> Service
-> Proxy CalculateRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CalculateRoute)))
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 -> [Leg] -> CalculateRouteSummary -> CalculateRouteResponse
CalculateRouteResponse'
(Int -> [Leg] -> CalculateRouteSummary -> CalculateRouteResponse)
-> Either String Int
-> Either
String ([Leg] -> CalculateRouteSummary -> CalculateRouteResponse)
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 ([Leg] -> CalculateRouteSummary -> CalculateRouteResponse)
-> Either String [Leg]
-> Either String (CalculateRouteSummary -> CalculateRouteResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Leg])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Legs" Either String (Maybe [Leg]) -> [Leg] -> Either String [Leg]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Leg]
forall a. Monoid a => a
Prelude.mempty)
Either String (CalculateRouteSummary -> CalculateRouteResponse)
-> Either String CalculateRouteSummary
-> Either String CalculateRouteResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String CalculateRouteSummary
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Summary")
)
instance Prelude.Hashable CalculateRoute
instance Prelude.NFData CalculateRoute
instance Core.ToHeaders CalculateRoute where
toHeaders :: CalculateRoute -> ResponseHeaders
toHeaders =
ResponseHeaders -> CalculateRoute -> 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 CalculateRoute where
toJSON :: CalculateRoute -> Value
toJSON CalculateRoute' {Maybe Bool
Maybe [Sensitive (NonEmpty Double)]
Maybe POSIX
Maybe CalculateRouteCarModeOptions
Maybe DistanceUnit
Maybe TravelMode
Maybe CalculateRouteTruckModeOptions
Text
Sensitive (NonEmpty Double)
destinationPosition :: Sensitive (NonEmpty Double)
departurePosition :: Sensitive (NonEmpty Double)
calculatorName :: Text
departureTime :: Maybe POSIX
carModeOptions :: Maybe CalculateRouteCarModeOptions
travelMode :: Maybe TravelMode
departNow :: Maybe Bool
includeLegGeometry :: Maybe Bool
waypointPositions :: Maybe [Sensitive (NonEmpty Double)]
truckModeOptions :: Maybe CalculateRouteTruckModeOptions
distanceUnit :: Maybe DistanceUnit
$sel:destinationPosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
$sel:departurePosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
$sel:calculatorName:CalculateRoute' :: CalculateRoute -> Text
$sel:departureTime:CalculateRoute' :: CalculateRoute -> Maybe POSIX
$sel:carModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteCarModeOptions
$sel:travelMode:CalculateRoute' :: CalculateRoute -> Maybe TravelMode
$sel:departNow:CalculateRoute' :: CalculateRoute -> Maybe Bool
$sel:includeLegGeometry:CalculateRoute' :: CalculateRoute -> Maybe Bool
$sel:waypointPositions:CalculateRoute' :: CalculateRoute -> Maybe [Sensitive (NonEmpty Double)]
$sel:truckModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteTruckModeOptions
$sel:distanceUnit:CalculateRoute' :: CalculateRoute -> Maybe DistanceUnit
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DistanceUnit" Text -> DistanceUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DistanceUnit -> Pair) -> Maybe DistanceUnit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DistanceUnit
distanceUnit,
(Text
"TruckModeOptions" Text -> CalculateRouteTruckModeOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CalculateRouteTruckModeOptions -> Pair)
-> Maybe CalculateRouteTruckModeOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CalculateRouteTruckModeOptions
truckModeOptions,
(Text
"WaypointPositions" Text -> [Sensitive (NonEmpty Double)] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Sensitive (NonEmpty Double)] -> Pair)
-> Maybe [Sensitive (NonEmpty Double)] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Sensitive (NonEmpty Double)]
waypointPositions,
(Text
"IncludeLegGeometry" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeLegGeometry,
(Text
"DepartNow" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
departNow,
(Text
"TravelMode" Text -> TravelMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TravelMode -> Pair) -> Maybe TravelMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TravelMode
travelMode,
(Text
"CarModeOptions" Text -> CalculateRouteCarModeOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CalculateRouteCarModeOptions -> Pair)
-> Maybe CalculateRouteCarModeOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CalculateRouteCarModeOptions
carModeOptions,
(Text
"DepartureTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
departureTime,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DeparturePosition" Text -> Sensitive (NonEmpty Double) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (NonEmpty Double)
departurePosition),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DestinationPosition" Text -> Sensitive (NonEmpty Double) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (NonEmpty Double)
destinationPosition)
]
)
instance Core.ToPath CalculateRoute where
toPath :: CalculateRoute -> ByteString
toPath CalculateRoute' {Maybe Bool
Maybe [Sensitive (NonEmpty Double)]
Maybe POSIX
Maybe CalculateRouteCarModeOptions
Maybe DistanceUnit
Maybe TravelMode
Maybe CalculateRouteTruckModeOptions
Text
Sensitive (NonEmpty Double)
destinationPosition :: Sensitive (NonEmpty Double)
departurePosition :: Sensitive (NonEmpty Double)
calculatorName :: Text
departureTime :: Maybe POSIX
carModeOptions :: Maybe CalculateRouteCarModeOptions
travelMode :: Maybe TravelMode
departNow :: Maybe Bool
includeLegGeometry :: Maybe Bool
waypointPositions :: Maybe [Sensitive (NonEmpty Double)]
truckModeOptions :: Maybe CalculateRouteTruckModeOptions
distanceUnit :: Maybe DistanceUnit
$sel:destinationPosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
$sel:departurePosition:CalculateRoute' :: CalculateRoute -> Sensitive (NonEmpty Double)
$sel:calculatorName:CalculateRoute' :: CalculateRoute -> Text
$sel:departureTime:CalculateRoute' :: CalculateRoute -> Maybe POSIX
$sel:carModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteCarModeOptions
$sel:travelMode:CalculateRoute' :: CalculateRoute -> Maybe TravelMode
$sel:departNow:CalculateRoute' :: CalculateRoute -> Maybe Bool
$sel:includeLegGeometry:CalculateRoute' :: CalculateRoute -> Maybe Bool
$sel:waypointPositions:CalculateRoute' :: CalculateRoute -> Maybe [Sensitive (NonEmpty Double)]
$sel:truckModeOptions:CalculateRoute' :: CalculateRoute -> Maybe CalculateRouteTruckModeOptions
$sel:distanceUnit:CalculateRoute' :: CalculateRoute -> Maybe DistanceUnit
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/routes/v0/calculators/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
calculatorName,
ByteString
"/calculate/route"
]
instance Core.ToQuery CalculateRoute where
toQuery :: CalculateRoute -> QueryString
toQuery = QueryString -> CalculateRoute -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CalculateRouteResponse = CalculateRouteResponse'
{
CalculateRouteResponse -> Int
httpStatus :: Prelude.Int,
CalculateRouteResponse -> [Leg]
legs :: [Leg],
CalculateRouteResponse -> CalculateRouteSummary
summary :: CalculateRouteSummary
}
deriving (CalculateRouteResponse -> CalculateRouteResponse -> Bool
(CalculateRouteResponse -> CalculateRouteResponse -> Bool)
-> (CalculateRouteResponse -> CalculateRouteResponse -> Bool)
-> Eq CalculateRouteResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalculateRouteResponse -> CalculateRouteResponse -> Bool
$c/= :: CalculateRouteResponse -> CalculateRouteResponse -> Bool
== :: CalculateRouteResponse -> CalculateRouteResponse -> Bool
$c== :: CalculateRouteResponse -> CalculateRouteResponse -> Bool
Prelude.Eq, Int -> CalculateRouteResponse -> ShowS
[CalculateRouteResponse] -> ShowS
CalculateRouteResponse -> String
(Int -> CalculateRouteResponse -> ShowS)
-> (CalculateRouteResponse -> String)
-> ([CalculateRouteResponse] -> ShowS)
-> Show CalculateRouteResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CalculateRouteResponse] -> ShowS
$cshowList :: [CalculateRouteResponse] -> ShowS
show :: CalculateRouteResponse -> String
$cshow :: CalculateRouteResponse -> String
showsPrec :: Int -> CalculateRouteResponse -> ShowS
$cshowsPrec :: Int -> CalculateRouteResponse -> ShowS
Prelude.Show, (forall x. CalculateRouteResponse -> Rep CalculateRouteResponse x)
-> (forall x.
Rep CalculateRouteResponse x -> CalculateRouteResponse)
-> Generic CalculateRouteResponse
forall x. Rep CalculateRouteResponse x -> CalculateRouteResponse
forall x. CalculateRouteResponse -> Rep CalculateRouteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CalculateRouteResponse x -> CalculateRouteResponse
$cfrom :: forall x. CalculateRouteResponse -> Rep CalculateRouteResponse x
Prelude.Generic)
newCalculateRouteResponse ::
Prelude.Int ->
CalculateRouteSummary ->
CalculateRouteResponse
newCalculateRouteResponse :: Int -> CalculateRouteSummary -> CalculateRouteResponse
newCalculateRouteResponse Int
pHttpStatus_ CalculateRouteSummary
pSummary_ =
CalculateRouteResponse' :: Int -> [Leg] -> CalculateRouteSummary -> CalculateRouteResponse
CalculateRouteResponse'
{ $sel:httpStatus:CalculateRouteResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:legs:CalculateRouteResponse' :: [Leg]
legs = [Leg]
forall a. Monoid a => a
Prelude.mempty,
$sel:summary:CalculateRouteResponse' :: CalculateRouteSummary
summary = CalculateRouteSummary
pSummary_
}
calculateRouteResponse_httpStatus :: Lens.Lens' CalculateRouteResponse Prelude.Int
calculateRouteResponse_httpStatus :: (Int -> f Int)
-> CalculateRouteResponse -> f CalculateRouteResponse
calculateRouteResponse_httpStatus = (CalculateRouteResponse -> Int)
-> (CalculateRouteResponse -> Int -> CalculateRouteResponse)
-> Lens CalculateRouteResponse CalculateRouteResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteResponse' {Int
httpStatus :: Int
$sel:httpStatus:CalculateRouteResponse' :: CalculateRouteResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CalculateRouteResponse
s@CalculateRouteResponse' {} Int
a -> CalculateRouteResponse
s {$sel:httpStatus:CalculateRouteResponse' :: Int
httpStatus = Int
a} :: CalculateRouteResponse)
calculateRouteResponse_legs :: Lens.Lens' CalculateRouteResponse [Leg]
calculateRouteResponse_legs :: ([Leg] -> f [Leg])
-> CalculateRouteResponse -> f CalculateRouteResponse
calculateRouteResponse_legs = (CalculateRouteResponse -> [Leg])
-> (CalculateRouteResponse -> [Leg] -> CalculateRouteResponse)
-> Lens CalculateRouteResponse CalculateRouteResponse [Leg] [Leg]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteResponse' {[Leg]
legs :: [Leg]
$sel:legs:CalculateRouteResponse' :: CalculateRouteResponse -> [Leg]
legs} -> [Leg]
legs) (\s :: CalculateRouteResponse
s@CalculateRouteResponse' {} [Leg]
a -> CalculateRouteResponse
s {$sel:legs:CalculateRouteResponse' :: [Leg]
legs = [Leg]
a} :: CalculateRouteResponse) (([Leg] -> f [Leg])
-> CalculateRouteResponse -> f CalculateRouteResponse)
-> (([Leg] -> f [Leg]) -> [Leg] -> f [Leg])
-> ([Leg] -> f [Leg])
-> CalculateRouteResponse
-> f CalculateRouteResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Leg] -> f [Leg]) -> [Leg] -> f [Leg]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
calculateRouteResponse_summary :: Lens.Lens' CalculateRouteResponse CalculateRouteSummary
calculateRouteResponse_summary :: (CalculateRouteSummary -> f CalculateRouteSummary)
-> CalculateRouteResponse -> f CalculateRouteResponse
calculateRouteResponse_summary = (CalculateRouteResponse -> CalculateRouteSummary)
-> (CalculateRouteResponse
-> CalculateRouteSummary -> CalculateRouteResponse)
-> Lens
CalculateRouteResponse
CalculateRouteResponse
CalculateRouteSummary
CalculateRouteSummary
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteResponse' {CalculateRouteSummary
summary :: CalculateRouteSummary
$sel:summary:CalculateRouteResponse' :: CalculateRouteResponse -> CalculateRouteSummary
summary} -> CalculateRouteSummary
summary) (\s :: CalculateRouteResponse
s@CalculateRouteResponse' {} CalculateRouteSummary
a -> CalculateRouteResponse
s {$sel:summary:CalculateRouteResponse' :: CalculateRouteSummary
summary = CalculateRouteSummary
a} :: CalculateRouteResponse)
instance Prelude.NFData CalculateRouteResponse