{-# 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.SnowDeviceManagement.ListExecutions
(
ListExecutions (..),
newListExecutions,
listExecutions_maxResults,
listExecutions_nextToken,
listExecutions_state,
listExecutions_taskId,
ListExecutionsResponse (..),
newListExecutionsResponse,
listExecutionsResponse_executions,
listExecutionsResponse_nextToken,
listExecutionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SnowDeviceManagement.Types
data ListExecutions = ListExecutions'
{
ListExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListExecutions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListExecutions -> Maybe ExecutionState
state :: Prelude.Maybe ExecutionState,
ListExecutions -> Text
taskId :: Prelude.Text
}
deriving (ListExecutions -> ListExecutions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExecutions -> ListExecutions -> Bool
$c/= :: ListExecutions -> ListExecutions -> Bool
== :: ListExecutions -> ListExecutions -> Bool
$c== :: ListExecutions -> ListExecutions -> Bool
Prelude.Eq, ReadPrec [ListExecutions]
ReadPrec ListExecutions
Int -> ReadS ListExecutions
ReadS [ListExecutions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExecutions]
$creadListPrec :: ReadPrec [ListExecutions]
readPrec :: ReadPrec ListExecutions
$creadPrec :: ReadPrec ListExecutions
readList :: ReadS [ListExecutions]
$creadList :: ReadS [ListExecutions]
readsPrec :: Int -> ReadS ListExecutions
$creadsPrec :: Int -> ReadS ListExecutions
Prelude.Read, Int -> ListExecutions -> ShowS
[ListExecutions] -> ShowS
ListExecutions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExecutions] -> ShowS
$cshowList :: [ListExecutions] -> ShowS
show :: ListExecutions -> String
$cshow :: ListExecutions -> String
showsPrec :: Int -> ListExecutions -> ShowS
$cshowsPrec :: Int -> ListExecutions -> ShowS
Prelude.Show, forall x. Rep ListExecutions x -> ListExecutions
forall x. ListExecutions -> Rep ListExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExecutions x -> ListExecutions
$cfrom :: forall x. ListExecutions -> Rep ListExecutions x
Prelude.Generic)
newListExecutions ::
Prelude.Text ->
ListExecutions
newListExecutions :: Text -> ListExecutions
newListExecutions Text
pTaskId_ =
ListExecutions'
{ $sel:maxResults:ListExecutions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListExecutions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:state:ListExecutions' :: Maybe ExecutionState
state = forall a. Maybe a
Prelude.Nothing,
$sel:taskId:ListExecutions' :: Text
taskId = Text
pTaskId_
}
listExecutions_maxResults :: Lens.Lens' ListExecutions (Prelude.Maybe Prelude.Natural)
listExecutions_maxResults :: Lens' ListExecutions (Maybe Natural)
listExecutions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListExecutions' :: ListExecutions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListExecutions
s@ListExecutions' {} Maybe Natural
a -> ListExecutions
s {$sel:maxResults:ListExecutions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListExecutions)
listExecutions_nextToken :: Lens.Lens' ListExecutions (Prelude.Maybe Prelude.Text)
listExecutions_nextToken :: Lens' ListExecutions (Maybe Text)
listExecutions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExecutions
s@ListExecutions' {} Maybe Text
a -> ListExecutions
s {$sel:nextToken:ListExecutions' :: Maybe Text
nextToken = Maybe Text
a} :: ListExecutions)
listExecutions_state :: Lens.Lens' ListExecutions (Prelude.Maybe ExecutionState)
listExecutions_state :: Lens' ListExecutions (Maybe ExecutionState)
listExecutions_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Maybe ExecutionState
state :: Maybe ExecutionState
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
state} -> Maybe ExecutionState
state) (\s :: ListExecutions
s@ListExecutions' {} Maybe ExecutionState
a -> ListExecutions
s {$sel:state:ListExecutions' :: Maybe ExecutionState
state = Maybe ExecutionState
a} :: ListExecutions)
listExecutions_taskId :: Lens.Lens' ListExecutions Prelude.Text
listExecutions_taskId :: Lens' ListExecutions Text
listExecutions_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutions' {Text
taskId :: Text
$sel:taskId:ListExecutions' :: ListExecutions -> Text
taskId} -> Text
taskId) (\s :: ListExecutions
s@ListExecutions' {} Text
a -> ListExecutions
s {$sel:taskId:ListExecutions' :: Text
taskId = Text
a} :: ListExecutions)
instance Core.AWSPager ListExecutions where
page :: ListExecutions
-> AWSResponse ListExecutions -> Maybe ListExecutions
page ListExecutions
rq AWSResponse ListExecutions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListExecutions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListExecutionsResponse (Maybe Text)
listExecutionsResponse_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 ListExecutions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListExecutionsResponse (Maybe [ExecutionSummary])
listExecutionsResponse_executions
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.$ ListExecutions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListExecutions (Maybe Text)
listExecutions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListExecutions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListExecutionsResponse (Maybe Text)
listExecutionsResponse_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 ListExecutions where
type
AWSResponse ListExecutions =
ListExecutionsResponse
request :: (Service -> Service) -> ListExecutions -> Request ListExecutions
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListExecutions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExecutions)))
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 [ExecutionSummary]
-> Maybe Text -> Int -> ListExecutionsResponse
ListExecutionsResponse'
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
"executions" 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 ListExecutions where
hashWithSalt :: Int -> ListExecutions -> Int
hashWithSalt Int
_salt ListExecutions' {Maybe Natural
Maybe Text
Maybe ExecutionState
Text
taskId :: Text
state :: Maybe ExecutionState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:taskId:ListExecutions' :: ListExecutions -> Text
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
$sel:maxResults:ListExecutions' :: ListExecutions -> 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` Maybe ExecutionState
state
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
taskId
instance Prelude.NFData ListExecutions where
rnf :: ListExecutions -> ()
rnf ListExecutions' {Maybe Natural
Maybe Text
Maybe ExecutionState
Text
taskId :: Text
state :: Maybe ExecutionState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:taskId:ListExecutions' :: ListExecutions -> Text
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
$sel:maxResults:ListExecutions' :: ListExecutions -> 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 Maybe ExecutionState
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
taskId
instance Data.ToHeaders ListExecutions where
toHeaders :: ListExecutions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListExecutions where
toPath :: ListExecutions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/executions"
instance Data.ToQuery ListExecutions where
toQuery :: ListExecutions -> QueryString
toQuery ListExecutions' {Maybe Natural
Maybe Text
Maybe ExecutionState
Text
taskId :: Text
state :: Maybe ExecutionState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:taskId:ListExecutions' :: ListExecutions -> Text
$sel:state:ListExecutions' :: ListExecutions -> Maybe ExecutionState
$sel:nextToken:ListExecutions' :: ListExecutions -> Maybe Text
$sel:maxResults:ListExecutions' :: ListExecutions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"state" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ExecutionState
state,
ByteString
"taskId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
taskId
]
data ListExecutionsResponse = ListExecutionsResponse'
{
ListExecutionsResponse -> Maybe [ExecutionSummary]
executions :: Prelude.Maybe [ExecutionSummary],
ListExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListExecutionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListExecutionsResponse -> ListExecutionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
$c/= :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
== :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
$c== :: ListExecutionsResponse -> ListExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [ListExecutionsResponse]
ReadPrec ListExecutionsResponse
Int -> ReadS ListExecutionsResponse
ReadS [ListExecutionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExecutionsResponse]
$creadListPrec :: ReadPrec [ListExecutionsResponse]
readPrec :: ReadPrec ListExecutionsResponse
$creadPrec :: ReadPrec ListExecutionsResponse
readList :: ReadS [ListExecutionsResponse]
$creadList :: ReadS [ListExecutionsResponse]
readsPrec :: Int -> ReadS ListExecutionsResponse
$creadsPrec :: Int -> ReadS ListExecutionsResponse
Prelude.Read, Int -> ListExecutionsResponse -> ShowS
[ListExecutionsResponse] -> ShowS
ListExecutionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExecutionsResponse] -> ShowS
$cshowList :: [ListExecutionsResponse] -> ShowS
show :: ListExecutionsResponse -> String
$cshow :: ListExecutionsResponse -> String
showsPrec :: Int -> ListExecutionsResponse -> ShowS
$cshowsPrec :: Int -> ListExecutionsResponse -> ShowS
Prelude.Show, forall x. Rep ListExecutionsResponse x -> ListExecutionsResponse
forall x. ListExecutionsResponse -> Rep ListExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExecutionsResponse x -> ListExecutionsResponse
$cfrom :: forall x. ListExecutionsResponse -> Rep ListExecutionsResponse x
Prelude.Generic)
newListExecutionsResponse ::
Prelude.Int ->
ListExecutionsResponse
newListExecutionsResponse :: Int -> ListExecutionsResponse
newListExecutionsResponse Int
pHttpStatus_ =
ListExecutionsResponse'
{ $sel:executions:ListExecutionsResponse' :: Maybe [ExecutionSummary]
executions =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListExecutionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listExecutionsResponse_executions :: Lens.Lens' ListExecutionsResponse (Prelude.Maybe [ExecutionSummary])
listExecutionsResponse_executions :: Lens' ListExecutionsResponse (Maybe [ExecutionSummary])
listExecutionsResponse_executions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutionsResponse' {Maybe [ExecutionSummary]
executions :: Maybe [ExecutionSummary]
$sel:executions:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe [ExecutionSummary]
executions} -> Maybe [ExecutionSummary]
executions) (\s :: ListExecutionsResponse
s@ListExecutionsResponse' {} Maybe [ExecutionSummary]
a -> ListExecutionsResponse
s {$sel:executions:ListExecutionsResponse' :: Maybe [ExecutionSummary]
executions = Maybe [ExecutionSummary]
a} :: ListExecutionsResponse) 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
listExecutionsResponse_nextToken :: Lens.Lens' ListExecutionsResponse (Prelude.Maybe Prelude.Text)
listExecutionsResponse_nextToken :: Lens' ListExecutionsResponse (Maybe Text)
listExecutionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExecutionsResponse
s@ListExecutionsResponse' {} Maybe Text
a -> ListExecutionsResponse
s {$sel:nextToken:ListExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListExecutionsResponse)
listExecutionsResponse_httpStatus :: Lens.Lens' ListExecutionsResponse Prelude.Int
listExecutionsResponse_httpStatus :: Lens' ListExecutionsResponse Int
listExecutionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExecutionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListExecutionsResponse' :: ListExecutionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListExecutionsResponse
s@ListExecutionsResponse' {} Int
a -> ListExecutionsResponse
s {$sel:httpStatus:ListExecutionsResponse' :: Int
httpStatus = Int
a} :: ListExecutionsResponse)
instance Prelude.NFData ListExecutionsResponse where
rnf :: ListExecutionsResponse -> ()
rnf ListExecutionsResponse' {Int
Maybe [ExecutionSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
executions :: Maybe [ExecutionSummary]
$sel:httpStatus:ListExecutionsResponse' :: ListExecutionsResponse -> Int
$sel:nextToken:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe Text
$sel:executions:ListExecutionsResponse' :: ListExecutionsResponse -> Maybe [ExecutionSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ExecutionSummary]
executions
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