{-# 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.ListFleetsForVehicle
(
ListFleetsForVehicle (..),
newListFleetsForVehicle,
listFleetsForVehicle_maxResults,
listFleetsForVehicle_nextToken,
listFleetsForVehicle_vehicleName,
ListFleetsForVehicleResponse (..),
newListFleetsForVehicleResponse,
listFleetsForVehicleResponse_fleets,
listFleetsForVehicleResponse_nextToken,
listFleetsForVehicleResponse_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 ListFleetsForVehicle = ListFleetsForVehicle'
{
ListFleetsForVehicle -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListFleetsForVehicle -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFleetsForVehicle -> Text
vehicleName :: Prelude.Text
}
deriving (ListFleetsForVehicle -> ListFleetsForVehicle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFleetsForVehicle -> ListFleetsForVehicle -> Bool
$c/= :: ListFleetsForVehicle -> ListFleetsForVehicle -> Bool
== :: ListFleetsForVehicle -> ListFleetsForVehicle -> Bool
$c== :: ListFleetsForVehicle -> ListFleetsForVehicle -> Bool
Prelude.Eq, ReadPrec [ListFleetsForVehicle]
ReadPrec ListFleetsForVehicle
Int -> ReadS ListFleetsForVehicle
ReadS [ListFleetsForVehicle]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFleetsForVehicle]
$creadListPrec :: ReadPrec [ListFleetsForVehicle]
readPrec :: ReadPrec ListFleetsForVehicle
$creadPrec :: ReadPrec ListFleetsForVehicle
readList :: ReadS [ListFleetsForVehicle]
$creadList :: ReadS [ListFleetsForVehicle]
readsPrec :: Int -> ReadS ListFleetsForVehicle
$creadsPrec :: Int -> ReadS ListFleetsForVehicle
Prelude.Read, Int -> ListFleetsForVehicle -> ShowS
[ListFleetsForVehicle] -> ShowS
ListFleetsForVehicle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFleetsForVehicle] -> ShowS
$cshowList :: [ListFleetsForVehicle] -> ShowS
show :: ListFleetsForVehicle -> String
$cshow :: ListFleetsForVehicle -> String
showsPrec :: Int -> ListFleetsForVehicle -> ShowS
$cshowsPrec :: Int -> ListFleetsForVehicle -> ShowS
Prelude.Show, forall x. Rep ListFleetsForVehicle x -> ListFleetsForVehicle
forall x. ListFleetsForVehicle -> Rep ListFleetsForVehicle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFleetsForVehicle x -> ListFleetsForVehicle
$cfrom :: forall x. ListFleetsForVehicle -> Rep ListFleetsForVehicle x
Prelude.Generic)
newListFleetsForVehicle ::
Prelude.Text ->
ListFleetsForVehicle
newListFleetsForVehicle :: Text -> ListFleetsForVehicle
newListFleetsForVehicle Text
pVehicleName_ =
ListFleetsForVehicle'
{ $sel:maxResults:ListFleetsForVehicle' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListFleetsForVehicle' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:vehicleName:ListFleetsForVehicle' :: Text
vehicleName = Text
pVehicleName_
}
listFleetsForVehicle_maxResults :: Lens.Lens' ListFleetsForVehicle (Prelude.Maybe Prelude.Natural)
listFleetsForVehicle_maxResults :: Lens' ListFleetsForVehicle (Maybe Natural)
listFleetsForVehicle_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicle' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFleetsForVehicle' :: ListFleetsForVehicle -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFleetsForVehicle
s@ListFleetsForVehicle' {} Maybe Natural
a -> ListFleetsForVehicle
s {$sel:maxResults:ListFleetsForVehicle' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFleetsForVehicle)
listFleetsForVehicle_nextToken :: Lens.Lens' ListFleetsForVehicle (Prelude.Maybe Prelude.Text)
listFleetsForVehicle_nextToken :: Lens' ListFleetsForVehicle (Maybe Text)
listFleetsForVehicle_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicle' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFleetsForVehicle' :: ListFleetsForVehicle -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFleetsForVehicle
s@ListFleetsForVehicle' {} Maybe Text
a -> ListFleetsForVehicle
s {$sel:nextToken:ListFleetsForVehicle' :: Maybe Text
nextToken = Maybe Text
a} :: ListFleetsForVehicle)
listFleetsForVehicle_vehicleName :: Lens.Lens' ListFleetsForVehicle Prelude.Text
listFleetsForVehicle_vehicleName :: Lens' ListFleetsForVehicle Text
listFleetsForVehicle_vehicleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicle' {Text
vehicleName :: Text
$sel:vehicleName:ListFleetsForVehicle' :: ListFleetsForVehicle -> Text
vehicleName} -> Text
vehicleName) (\s :: ListFleetsForVehicle
s@ListFleetsForVehicle' {} Text
a -> ListFleetsForVehicle
s {$sel:vehicleName:ListFleetsForVehicle' :: Text
vehicleName = Text
a} :: ListFleetsForVehicle)
instance Core.AWSPager ListFleetsForVehicle where
page :: ListFleetsForVehicle
-> AWSResponse ListFleetsForVehicle -> Maybe ListFleetsForVehicle
page ListFleetsForVehicle
rq AWSResponse ListFleetsForVehicle
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListFleetsForVehicle
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFleetsForVehicleResponse (Maybe Text)
listFleetsForVehicleResponse_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 ListFleetsForVehicle
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFleetsForVehicleResponse (Maybe [Text])
listFleetsForVehicleResponse_fleets
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.$ ListFleetsForVehicle
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListFleetsForVehicle (Maybe Text)
listFleetsForVehicle_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFleetsForVehicle
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListFleetsForVehicleResponse (Maybe Text)
listFleetsForVehicleResponse_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 ListFleetsForVehicle where
type
AWSResponse ListFleetsForVehicle =
ListFleetsForVehicleResponse
request :: (Service -> Service)
-> ListFleetsForVehicle -> Request ListFleetsForVehicle
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 ListFleetsForVehicle
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListFleetsForVehicle)))
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 [Text] -> Maybe Text -> Int -> ListFleetsForVehicleResponse
ListFleetsForVehicleResponse'
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
"fleets" 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 ListFleetsForVehicle where
hashWithSalt :: Int -> ListFleetsForVehicle -> Int
hashWithSalt Int
_salt ListFleetsForVehicle' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:ListFleetsForVehicle' :: ListFleetsForVehicle -> Text
$sel:nextToken:ListFleetsForVehicle' :: ListFleetsForVehicle -> Maybe Text
$sel:maxResults:ListFleetsForVehicle' :: ListFleetsForVehicle -> 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 ListFleetsForVehicle where
rnf :: ListFleetsForVehicle -> ()
rnf ListFleetsForVehicle' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:ListFleetsForVehicle' :: ListFleetsForVehicle -> Text
$sel:nextToken:ListFleetsForVehicle' :: ListFleetsForVehicle -> Maybe Text
$sel:maxResults:ListFleetsForVehicle' :: ListFleetsForVehicle -> 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 ListFleetsForVehicle where
toHeaders :: ListFleetsForVehicle -> 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.ListFleetsForVehicle" ::
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 ListFleetsForVehicle where
toJSON :: ListFleetsForVehicle -> Value
toJSON ListFleetsForVehicle' {Maybe Natural
Maybe Text
Text
vehicleName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:vehicleName:ListFleetsForVehicle' :: ListFleetsForVehicle -> Text
$sel:nextToken:ListFleetsForVehicle' :: ListFleetsForVehicle -> Maybe Text
$sel:maxResults:ListFleetsForVehicle' :: ListFleetsForVehicle -> 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 ListFleetsForVehicle where
toPath :: ListFleetsForVehicle -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListFleetsForVehicle where
toQuery :: ListFleetsForVehicle -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListFleetsForVehicleResponse = ListFleetsForVehicleResponse'
{
ListFleetsForVehicleResponse -> Maybe [Text]
fleets :: Prelude.Maybe [Prelude.Text],
ListFleetsForVehicleResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFleetsForVehicleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListFleetsForVehicleResponse
-> ListFleetsForVehicleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFleetsForVehicleResponse
-> ListFleetsForVehicleResponse -> Bool
$c/= :: ListFleetsForVehicleResponse
-> ListFleetsForVehicleResponse -> Bool
== :: ListFleetsForVehicleResponse
-> ListFleetsForVehicleResponse -> Bool
$c== :: ListFleetsForVehicleResponse
-> ListFleetsForVehicleResponse -> Bool
Prelude.Eq, ReadPrec [ListFleetsForVehicleResponse]
ReadPrec ListFleetsForVehicleResponse
Int -> ReadS ListFleetsForVehicleResponse
ReadS [ListFleetsForVehicleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFleetsForVehicleResponse]
$creadListPrec :: ReadPrec [ListFleetsForVehicleResponse]
readPrec :: ReadPrec ListFleetsForVehicleResponse
$creadPrec :: ReadPrec ListFleetsForVehicleResponse
readList :: ReadS [ListFleetsForVehicleResponse]
$creadList :: ReadS [ListFleetsForVehicleResponse]
readsPrec :: Int -> ReadS ListFleetsForVehicleResponse
$creadsPrec :: Int -> ReadS ListFleetsForVehicleResponse
Prelude.Read, Int -> ListFleetsForVehicleResponse -> ShowS
[ListFleetsForVehicleResponse] -> ShowS
ListFleetsForVehicleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFleetsForVehicleResponse] -> ShowS
$cshowList :: [ListFleetsForVehicleResponse] -> ShowS
show :: ListFleetsForVehicleResponse -> String
$cshow :: ListFleetsForVehicleResponse -> String
showsPrec :: Int -> ListFleetsForVehicleResponse -> ShowS
$cshowsPrec :: Int -> ListFleetsForVehicleResponse -> ShowS
Prelude.Show, forall x.
Rep ListFleetsForVehicleResponse x -> ListFleetsForVehicleResponse
forall x.
ListFleetsForVehicleResponse -> Rep ListFleetsForVehicleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListFleetsForVehicleResponse x -> ListFleetsForVehicleResponse
$cfrom :: forall x.
ListFleetsForVehicleResponse -> Rep ListFleetsForVehicleResponse x
Prelude.Generic)
newListFleetsForVehicleResponse ::
Prelude.Int ->
ListFleetsForVehicleResponse
newListFleetsForVehicleResponse :: Int -> ListFleetsForVehicleResponse
newListFleetsForVehicleResponse Int
pHttpStatus_ =
ListFleetsForVehicleResponse'
{ $sel:fleets:ListFleetsForVehicleResponse' :: Maybe [Text]
fleets =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListFleetsForVehicleResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListFleetsForVehicleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listFleetsForVehicleResponse_fleets :: Lens.Lens' ListFleetsForVehicleResponse (Prelude.Maybe [Prelude.Text])
listFleetsForVehicleResponse_fleets :: Lens' ListFleetsForVehicleResponse (Maybe [Text])
listFleetsForVehicleResponse_fleets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicleResponse' {Maybe [Text]
fleets :: Maybe [Text]
$sel:fleets:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Maybe [Text]
fleets} -> Maybe [Text]
fleets) (\s :: ListFleetsForVehicleResponse
s@ListFleetsForVehicleResponse' {} Maybe [Text]
a -> ListFleetsForVehicleResponse
s {$sel:fleets:ListFleetsForVehicleResponse' :: Maybe [Text]
fleets = Maybe [Text]
a} :: ListFleetsForVehicleResponse) 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
listFleetsForVehicleResponse_nextToken :: Lens.Lens' ListFleetsForVehicleResponse (Prelude.Maybe Prelude.Text)
listFleetsForVehicleResponse_nextToken :: Lens' ListFleetsForVehicleResponse (Maybe Text)
listFleetsForVehicleResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicleResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFleetsForVehicleResponse
s@ListFleetsForVehicleResponse' {} Maybe Text
a -> ListFleetsForVehicleResponse
s {$sel:nextToken:ListFleetsForVehicleResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFleetsForVehicleResponse)
listFleetsForVehicleResponse_httpStatus :: Lens.Lens' ListFleetsForVehicleResponse Prelude.Int
listFleetsForVehicleResponse_httpStatus :: Lens' ListFleetsForVehicleResponse Int
listFleetsForVehicleResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsForVehicleResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListFleetsForVehicleResponse
s@ListFleetsForVehicleResponse' {} Int
a -> ListFleetsForVehicleResponse
s {$sel:httpStatus:ListFleetsForVehicleResponse' :: Int
httpStatus = Int
a} :: ListFleetsForVehicleResponse)
instance Prelude.NFData ListFleetsForVehicleResponse where
rnf :: ListFleetsForVehicleResponse -> ()
rnf ListFleetsForVehicleResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
fleets :: Maybe [Text]
$sel:httpStatus:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Int
$sel:nextToken:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Maybe Text
$sel:fleets:ListFleetsForVehicleResponse' :: ListFleetsForVehicleResponse -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
fleets
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