{-# 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.IoTFleetWise.GetVehicleStatus
(
GetVehicleStatus (..),
newGetVehicleStatus,
getVehicleStatus_maxResults,
getVehicleStatus_nextToken,
getVehicleStatus_vehicleName,
GetVehicleStatusResponse (..),
newGetVehicleStatusResponse,
getVehicleStatusResponse_campaigns,
getVehicleStatusResponse_nextToken,
getVehicleStatusResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTFleetWise.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetVehicleStatus = GetVehicleStatus'
{
GetVehicleStatus -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetVehicleStatus -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetVehicleStatus -> Text
vehicleName :: Prelude.Text
}
deriving (GetVehicleStatus -> GetVehicleStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVehicleStatus -> GetVehicleStatus -> Bool
$c/= :: GetVehicleStatus -> GetVehicleStatus -> Bool
== :: GetVehicleStatus -> GetVehicleStatus -> Bool
$c== :: GetVehicleStatus -> GetVehicleStatus -> Bool
Prelude.Eq, ReadPrec [GetVehicleStatus]
ReadPrec GetVehicleStatus
Int -> ReadS GetVehicleStatus
ReadS [GetVehicleStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVehicleStatus]
$creadListPrec :: ReadPrec [GetVehicleStatus]
readPrec :: ReadPrec GetVehicleStatus
$creadPrec :: ReadPrec GetVehicleStatus
readList :: ReadS [GetVehicleStatus]
$creadList :: ReadS [GetVehicleStatus]
readsPrec :: Int -> ReadS GetVehicleStatus
$creadsPrec :: Int -> ReadS GetVehicleStatus
Prelude.Read, Int -> GetVehicleStatus -> ShowS
[GetVehicleStatus] -> ShowS
GetVehicleStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVehicleStatus] -> ShowS
$cshowList :: [GetVehicleStatus] -> ShowS
show :: GetVehicleStatus -> String
$cshow :: GetVehicleStatus -> String
showsPrec :: Int -> GetVehicleStatus -> ShowS
$cshowsPrec :: Int -> GetVehicleStatus -> ShowS
Prelude.Show, forall x. Rep GetVehicleStatus x -> GetVehicleStatus
forall x. GetVehicleStatus -> Rep GetVehicleStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVehicleStatus x -> GetVehicleStatus
$cfrom :: forall x. GetVehicleStatus -> Rep GetVehicleStatus x
Prelude.Generic)
newGetVehicleStatus ::
Prelude.Text ->
GetVehicleStatus
newGetVehicleStatus :: Text -> GetVehicleStatus
newGetVehicleStatus Text
pVehicleName_ =
GetVehicleStatus'
{ $sel:maxResults:GetVehicleStatus' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetVehicleStatus' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:vehicleName:GetVehicleStatus' :: Text
vehicleName = Text
pVehicleName_
}
getVehicleStatus_maxResults :: Lens.Lens' GetVehicleStatus (Prelude.Maybe Prelude.Natural)
getVehicleStatus_maxResults :: Lens' GetVehicleStatus (Maybe Natural)
getVehicleStatus_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatus' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetVehicleStatus' :: GetVehicleStatus -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetVehicleStatus
s@GetVehicleStatus' {} Maybe Natural
a -> GetVehicleStatus
s {$sel:maxResults:GetVehicleStatus' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetVehicleStatus)
getVehicleStatus_nextToken :: Lens.Lens' GetVehicleStatus (Prelude.Maybe Prelude.Text)
getVehicleStatus_nextToken :: Lens' GetVehicleStatus (Maybe Text)
getVehicleStatus_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatus' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetVehicleStatus' :: GetVehicleStatus -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetVehicleStatus
s@GetVehicleStatus' {} Maybe Text
a -> GetVehicleStatus
s {$sel:nextToken:GetVehicleStatus' :: Maybe Text
nextToken = Maybe Text
a} :: GetVehicleStatus)
getVehicleStatus_vehicleName :: Lens.Lens' GetVehicleStatus Prelude.Text
getVehicleStatus_vehicleName :: Lens' GetVehicleStatus Text
getVehicleStatus_vehicleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatus' {Text
vehicleName :: Text
$sel:vehicleName:GetVehicleStatus' :: GetVehicleStatus -> Text
vehicleName} -> Text
vehicleName) (\s :: GetVehicleStatus
s@GetVehicleStatus' {} Text
a -> GetVehicleStatus
s {$sel:vehicleName:GetVehicleStatus' :: Text
vehicleName = Text
a} :: GetVehicleStatus)
instance Core.AWSPager GetVehicleStatus where
page :: GetVehicleStatus
-> AWSResponse GetVehicleStatus -> Maybe GetVehicleStatus
page GetVehicleStatus
rq AWSResponse GetVehicleStatus
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetVehicleStatus
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetVehicleStatusResponse (Maybe Text)
getVehicleStatusResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetVehicleStatus
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetVehicleStatusResponse (Maybe [VehicleStatus])
getVehicleStatusResponse_campaigns
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetVehicleStatus
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetVehicleStatus (Maybe Text)
getVehicleStatus_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetVehicleStatus
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetVehicleStatusResponse (Maybe Text)
getVehicleStatusResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetVehicleStatus where
type
AWSResponse GetVehicleStatus =
GetVehicleStatusResponse
request :: (Service -> Service)
-> GetVehicleStatus -> Request GetVehicleStatus
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetVehicleStatus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVehicleStatus)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [VehicleStatus]
-> Maybe Text -> Int -> GetVehicleStatusResponse
GetVehicleStatusResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"campaigns" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetVehicleStatus where
hashWithSalt :: Int -> GetVehicleStatus -> Int
hashWithSalt Int
_salt GetVehicleStatus' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:GetVehicleStatus' :: GetVehicleStatus -> Text
$sel:nextToken:GetVehicleStatus' :: GetVehicleStatus -> Maybe Text
$sel:maxResults:GetVehicleStatus' :: GetVehicleStatus -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vehicleName
instance Prelude.NFData GetVehicleStatus where
rnf :: GetVehicleStatus -> ()
rnf GetVehicleStatus' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:GetVehicleStatus' :: GetVehicleStatus -> Text
$sel:nextToken:GetVehicleStatus' :: GetVehicleStatus -> Maybe Text
$sel:maxResults:GetVehicleStatus' :: GetVehicleStatus -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vehicleName
instance Data.ToHeaders GetVehicleStatus where
toHeaders :: GetVehicleStatus -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"IoTAutobahnControlPlane.GetVehicleStatus" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetVehicleStatus where
toJSON :: GetVehicleStatus -> Value
toJSON GetVehicleStatus' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:GetVehicleStatus' :: GetVehicleStatus -> Text
$sel:nextToken:GetVehicleStatus' :: GetVehicleStatus -> Maybe Text
$sel:maxResults:GetVehicleStatus' :: GetVehicleStatus -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
forall a. a -> Maybe a
Prelude.Just (Key
"vehicleName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
vehicleName)
]
)
instance Data.ToPath GetVehicleStatus where
toPath :: GetVehicleStatus -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetVehicleStatus where
toQuery :: GetVehicleStatus -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetVehicleStatusResponse = GetVehicleStatusResponse'
{
GetVehicleStatusResponse -> Maybe [VehicleStatus]
campaigns :: Prelude.Maybe [VehicleStatus],
GetVehicleStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetVehicleStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetVehicleStatusResponse -> GetVehicleStatusResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVehicleStatusResponse -> GetVehicleStatusResponse -> Bool
$c/= :: GetVehicleStatusResponse -> GetVehicleStatusResponse -> Bool
== :: GetVehicleStatusResponse -> GetVehicleStatusResponse -> Bool
$c== :: GetVehicleStatusResponse -> GetVehicleStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetVehicleStatusResponse]
ReadPrec GetVehicleStatusResponse
Int -> ReadS GetVehicleStatusResponse
ReadS [GetVehicleStatusResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVehicleStatusResponse]
$creadListPrec :: ReadPrec [GetVehicleStatusResponse]
readPrec :: ReadPrec GetVehicleStatusResponse
$creadPrec :: ReadPrec GetVehicleStatusResponse
readList :: ReadS [GetVehicleStatusResponse]
$creadList :: ReadS [GetVehicleStatusResponse]
readsPrec :: Int -> ReadS GetVehicleStatusResponse
$creadsPrec :: Int -> ReadS GetVehicleStatusResponse
Prelude.Read, Int -> GetVehicleStatusResponse -> ShowS
[GetVehicleStatusResponse] -> ShowS
GetVehicleStatusResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVehicleStatusResponse] -> ShowS
$cshowList :: [GetVehicleStatusResponse] -> ShowS
show :: GetVehicleStatusResponse -> String
$cshow :: GetVehicleStatusResponse -> String
showsPrec :: Int -> GetVehicleStatusResponse -> ShowS
$cshowsPrec :: Int -> GetVehicleStatusResponse -> ShowS
Prelude.Show, forall x.
Rep GetVehicleStatusResponse x -> GetVehicleStatusResponse
forall x.
GetVehicleStatusResponse -> Rep GetVehicleStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetVehicleStatusResponse x -> GetVehicleStatusResponse
$cfrom :: forall x.
GetVehicleStatusResponse -> Rep GetVehicleStatusResponse x
Prelude.Generic)
newGetVehicleStatusResponse ::
Prelude.Int ->
GetVehicleStatusResponse
newGetVehicleStatusResponse :: Int -> GetVehicleStatusResponse
newGetVehicleStatusResponse Int
pHttpStatus_ =
GetVehicleStatusResponse'
{ $sel:campaigns:GetVehicleStatusResponse' :: Maybe [VehicleStatus]
campaigns =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetVehicleStatusResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetVehicleStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getVehicleStatusResponse_campaigns :: Lens.Lens' GetVehicleStatusResponse (Prelude.Maybe [VehicleStatus])
getVehicleStatusResponse_campaigns :: Lens' GetVehicleStatusResponse (Maybe [VehicleStatus])
getVehicleStatusResponse_campaigns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatusResponse' {Maybe [VehicleStatus]
campaigns :: Maybe [VehicleStatus]
$sel:campaigns:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Maybe [VehicleStatus]
campaigns} -> Maybe [VehicleStatus]
campaigns) (\s :: GetVehicleStatusResponse
s@GetVehicleStatusResponse' {} Maybe [VehicleStatus]
a -> GetVehicleStatusResponse
s {$sel:campaigns:GetVehicleStatusResponse' :: Maybe [VehicleStatus]
campaigns = Maybe [VehicleStatus]
a} :: GetVehicleStatusResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getVehicleStatusResponse_nextToken :: Lens.Lens' GetVehicleStatusResponse (Prelude.Maybe Prelude.Text)
getVehicleStatusResponse_nextToken :: Lens' GetVehicleStatusResponse (Maybe Text)
getVehicleStatusResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatusResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetVehicleStatusResponse
s@GetVehicleStatusResponse' {} Maybe Text
a -> GetVehicleStatusResponse
s {$sel:nextToken:GetVehicleStatusResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetVehicleStatusResponse)
getVehicleStatusResponse_httpStatus :: Lens.Lens' GetVehicleStatusResponse Prelude.Int
getVehicleStatusResponse_httpStatus :: Lens' GetVehicleStatusResponse Int
getVehicleStatusResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVehicleStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetVehicleStatusResponse
s@GetVehicleStatusResponse' {} Int
a -> GetVehicleStatusResponse
s {$sel:httpStatus:GetVehicleStatusResponse' :: Int
httpStatus = Int
a} :: GetVehicleStatusResponse)
instance Prelude.NFData GetVehicleStatusResponse where
rnf :: GetVehicleStatusResponse -> ()
rnf GetVehicleStatusResponse' {Int
Maybe [VehicleStatus]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
campaigns :: Maybe [VehicleStatus]
$sel:httpStatus:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Int
$sel:nextToken:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Maybe Text
$sel:campaigns:GetVehicleStatusResponse' :: GetVehicleStatusResponse -> Maybe [VehicleStatus]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [VehicleStatus]
campaigns
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus