{-# 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.IotTwinMaker.ListWorkspaces
(
ListWorkspaces (..),
newListWorkspaces,
listWorkspaces_maxResults,
listWorkspaces_nextToken,
ListWorkspacesResponse (..),
newListWorkspacesResponse,
listWorkspacesResponse_nextToken,
listWorkspacesResponse_workspaceSummaries,
listWorkspacesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListWorkspaces = ListWorkspaces'
{
ListWorkspaces -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListWorkspaces -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListWorkspaces -> ListWorkspaces -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkspaces -> ListWorkspaces -> Bool
$c/= :: ListWorkspaces -> ListWorkspaces -> Bool
== :: ListWorkspaces -> ListWorkspaces -> Bool
$c== :: ListWorkspaces -> ListWorkspaces -> Bool
Prelude.Eq, ReadPrec [ListWorkspaces]
ReadPrec ListWorkspaces
Int -> ReadS ListWorkspaces
ReadS [ListWorkspaces]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkspaces]
$creadListPrec :: ReadPrec [ListWorkspaces]
readPrec :: ReadPrec ListWorkspaces
$creadPrec :: ReadPrec ListWorkspaces
readList :: ReadS [ListWorkspaces]
$creadList :: ReadS [ListWorkspaces]
readsPrec :: Int -> ReadS ListWorkspaces
$creadsPrec :: Int -> ReadS ListWorkspaces
Prelude.Read, Int -> ListWorkspaces -> ShowS
[ListWorkspaces] -> ShowS
ListWorkspaces -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkspaces] -> ShowS
$cshowList :: [ListWorkspaces] -> ShowS
show :: ListWorkspaces -> String
$cshow :: ListWorkspaces -> String
showsPrec :: Int -> ListWorkspaces -> ShowS
$cshowsPrec :: Int -> ListWorkspaces -> ShowS
Prelude.Show, forall x. Rep ListWorkspaces x -> ListWorkspaces
forall x. ListWorkspaces -> Rep ListWorkspaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkspaces x -> ListWorkspaces
$cfrom :: forall x. ListWorkspaces -> Rep ListWorkspaces x
Prelude.Generic)
newListWorkspaces ::
ListWorkspaces
newListWorkspaces :: ListWorkspaces
newListWorkspaces =
ListWorkspaces'
{ $sel:maxResults:ListWorkspaces' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWorkspaces' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listWorkspaces_maxResults :: Lens.Lens' ListWorkspaces (Prelude.Maybe Prelude.Natural)
listWorkspaces_maxResults :: Lens' ListWorkspaces (Maybe Natural)
listWorkspaces_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspaces' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListWorkspaces' :: ListWorkspaces -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListWorkspaces
s@ListWorkspaces' {} Maybe Natural
a -> ListWorkspaces
s {$sel:maxResults:ListWorkspaces' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListWorkspaces)
listWorkspaces_nextToken :: Lens.Lens' ListWorkspaces (Prelude.Maybe Prelude.Text)
listWorkspaces_nextToken :: Lens' ListWorkspaces (Maybe Text)
listWorkspaces_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspaces' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkspaces' :: ListWorkspaces -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkspaces
s@ListWorkspaces' {} Maybe Text
a -> ListWorkspaces
s {$sel:nextToken:ListWorkspaces' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkspaces)
instance Core.AWSRequest ListWorkspaces where
type
AWSResponse ListWorkspaces =
ListWorkspacesResponse
request :: (Service -> Service) -> ListWorkspaces -> Request ListWorkspaces
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 ListWorkspaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkspaces)))
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 [WorkspaceSummary] -> Int -> ListWorkspacesResponse
ListWorkspacesResponse'
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
"nextToken")
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
"workspaceSummaries"
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListWorkspaces where
hashWithSalt :: Int -> ListWorkspaces -> Int
hashWithSalt Int
_salt ListWorkspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkspaces' :: ListWorkspaces -> Maybe Text
$sel:maxResults:ListWorkspaces' :: ListWorkspaces -> 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
instance Prelude.NFData ListWorkspaces where
rnf :: ListWorkspaces -> ()
rnf ListWorkspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkspaces' :: ListWorkspaces -> Maybe Text
$sel:maxResults:ListWorkspaces' :: ListWorkspaces -> 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
instance Data.ToHeaders ListWorkspaces where
toHeaders :: ListWorkspaces -> 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.ToJSON ListWorkspaces where
toJSON :: ListWorkspaces -> Value
toJSON ListWorkspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkspaces' :: ListWorkspaces -> Maybe Text
$sel:maxResults:ListWorkspaces' :: ListWorkspaces -> 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
]
)
instance Data.ToPath ListWorkspaces where
toPath :: ListWorkspaces -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/workspaces-list"
instance Data.ToQuery ListWorkspaces where
toQuery :: ListWorkspaces -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListWorkspacesResponse = ListWorkspacesResponse'
{
ListWorkspacesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkspacesResponse -> Maybe [WorkspaceSummary]
workspaceSummaries :: Prelude.Maybe [WorkspaceSummary],
ListWorkspacesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
$c/= :: ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
== :: ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
$c== :: ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
Prelude.Eq, ReadPrec [ListWorkspacesResponse]
ReadPrec ListWorkspacesResponse
Int -> ReadS ListWorkspacesResponse
ReadS [ListWorkspacesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkspacesResponse]
$creadListPrec :: ReadPrec [ListWorkspacesResponse]
readPrec :: ReadPrec ListWorkspacesResponse
$creadPrec :: ReadPrec ListWorkspacesResponse
readList :: ReadS [ListWorkspacesResponse]
$creadList :: ReadS [ListWorkspacesResponse]
readsPrec :: Int -> ReadS ListWorkspacesResponse
$creadsPrec :: Int -> ReadS ListWorkspacesResponse
Prelude.Read, Int -> ListWorkspacesResponse -> ShowS
[ListWorkspacesResponse] -> ShowS
ListWorkspacesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkspacesResponse] -> ShowS
$cshowList :: [ListWorkspacesResponse] -> ShowS
show :: ListWorkspacesResponse -> String
$cshow :: ListWorkspacesResponse -> String
showsPrec :: Int -> ListWorkspacesResponse -> ShowS
$cshowsPrec :: Int -> ListWorkspacesResponse -> ShowS
Prelude.Show, forall x. Rep ListWorkspacesResponse x -> ListWorkspacesResponse
forall x. ListWorkspacesResponse -> Rep ListWorkspacesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkspacesResponse x -> ListWorkspacesResponse
$cfrom :: forall x. ListWorkspacesResponse -> Rep ListWorkspacesResponse x
Prelude.Generic)
newListWorkspacesResponse ::
Prelude.Int ->
ListWorkspacesResponse
newListWorkspacesResponse :: Int -> ListWorkspacesResponse
newListWorkspacesResponse Int
pHttpStatus_ =
ListWorkspacesResponse'
{ $sel:nextToken:ListWorkspacesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:workspaceSummaries:ListWorkspacesResponse' :: Maybe [WorkspaceSummary]
workspaceSummaries = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorkspacesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listWorkspacesResponse_nextToken :: Lens.Lens' ListWorkspacesResponse (Prelude.Maybe Prelude.Text)
listWorkspacesResponse_nextToken :: Lens' ListWorkspacesResponse (Maybe Text)
listWorkspacesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspacesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkspacesResponse' :: ListWorkspacesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkspacesResponse
s@ListWorkspacesResponse' {} Maybe Text
a -> ListWorkspacesResponse
s {$sel:nextToken:ListWorkspacesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkspacesResponse)
listWorkspacesResponse_workspaceSummaries :: Lens.Lens' ListWorkspacesResponse (Prelude.Maybe [WorkspaceSummary])
listWorkspacesResponse_workspaceSummaries :: Lens' ListWorkspacesResponse (Maybe [WorkspaceSummary])
listWorkspacesResponse_workspaceSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspacesResponse' {Maybe [WorkspaceSummary]
workspaceSummaries :: Maybe [WorkspaceSummary]
$sel:workspaceSummaries:ListWorkspacesResponse' :: ListWorkspacesResponse -> Maybe [WorkspaceSummary]
workspaceSummaries} -> Maybe [WorkspaceSummary]
workspaceSummaries) (\s :: ListWorkspacesResponse
s@ListWorkspacesResponse' {} Maybe [WorkspaceSummary]
a -> ListWorkspacesResponse
s {$sel:workspaceSummaries:ListWorkspacesResponse' :: Maybe [WorkspaceSummary]
workspaceSummaries = Maybe [WorkspaceSummary]
a} :: ListWorkspacesResponse) 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
listWorkspacesResponse_httpStatus :: Lens.Lens' ListWorkspacesResponse Prelude.Int
listWorkspacesResponse_httpStatus :: Lens' ListWorkspacesResponse Int
listWorkspacesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspacesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWorkspacesResponse' :: ListWorkspacesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWorkspacesResponse
s@ListWorkspacesResponse' {} Int
a -> ListWorkspacesResponse
s {$sel:httpStatus:ListWorkspacesResponse' :: Int
httpStatus = Int
a} :: ListWorkspacesResponse)
instance Prelude.NFData ListWorkspacesResponse where
rnf :: ListWorkspacesResponse -> ()
rnf ListWorkspacesResponse' {Int
Maybe [WorkspaceSummary]
Maybe Text
httpStatus :: Int
workspaceSummaries :: Maybe [WorkspaceSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListWorkspacesResponse' :: ListWorkspacesResponse -> Int
$sel:workspaceSummaries:ListWorkspacesResponse' :: ListWorkspacesResponse -> Maybe [WorkspaceSummary]
$sel:nextToken:ListWorkspacesResponse' :: ListWorkspacesResponse -> Maybe Text
..} =
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 [WorkspaceSummary]
workspaceSummaries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus