{-# 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.Grafana.ListWorkspaces
(
ListWorkspaces (..),
newListWorkspaces,
listWorkspaces_maxResults,
listWorkspaces_nextToken,
ListWorkspacesResponse (..),
newListWorkspacesResponse,
listWorkspacesResponse_nextToken,
listWorkspacesResponse_httpStatus,
listWorkspacesResponse_workspaces,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Grafana.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.AWSPager ListWorkspaces where
page :: ListWorkspaces
-> AWSResponse ListWorkspaces -> Maybe ListWorkspaces
page ListWorkspaces
rq AWSResponse ListWorkspaces
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListWorkspaces
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkspacesResponse (Maybe Text)
listWorkspacesResponse_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 ListWorkspaces
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListWorkspacesResponse [WorkspaceSummary]
listWorkspacesResponse_workspaces) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListWorkspaces
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListWorkspaces (Maybe Text)
listWorkspaces_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorkspaces
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkspacesResponse (Maybe Text)
listWorkspacesResponse_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 ListWorkspaces where
type
AWSResponse ListWorkspaces =
ListWorkspacesResponse
request :: (Service -> Service) -> ListWorkspaces -> Request ListWorkspaces
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 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 -> Int -> [WorkspaceSummary] -> 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
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
"workspaces" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
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.ToPath ListWorkspaces where
toPath :: ListWorkspaces -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/workspaces"
instance Data.ToQuery ListWorkspaces where
toQuery :: ListWorkspaces -> QueryString
toQuery 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. 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
]
data ListWorkspacesResponse = ListWorkspacesResponse'
{
ListWorkspacesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkspacesResponse -> Int
httpStatus :: Prelude.Int,
ListWorkspacesResponse -> [WorkspaceSummary]
workspaces :: [WorkspaceSummary]
}
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, 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:httpStatus:ListWorkspacesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:workspaces:ListWorkspacesResponse' :: [WorkspaceSummary]
workspaces = forall a. Monoid a => a
Prelude.mempty
}
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_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)
listWorkspacesResponse_workspaces :: Lens.Lens' ListWorkspacesResponse [WorkspaceSummary]
listWorkspacesResponse_workspaces :: Lens' ListWorkspacesResponse [WorkspaceSummary]
listWorkspacesResponse_workspaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkspacesResponse' {[WorkspaceSummary]
workspaces :: [WorkspaceSummary]
$sel:workspaces:ListWorkspacesResponse' :: ListWorkspacesResponse -> [WorkspaceSummary]
workspaces} -> [WorkspaceSummary]
workspaces) (\s :: ListWorkspacesResponse
s@ListWorkspacesResponse' {} [WorkspaceSummary]
a -> ListWorkspacesResponse
s {$sel:workspaces:ListWorkspacesResponse' :: [WorkspaceSummary]
workspaces = [WorkspaceSummary]
a} :: ListWorkspacesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListWorkspacesResponse where
rnf :: ListWorkspacesResponse -> ()
rnf ListWorkspacesResponse' {Int
[WorkspaceSummary]
Maybe Text
workspaces :: [WorkspaceSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:workspaces:ListWorkspacesResponse' :: ListWorkspacesResponse -> [WorkspaceSummary]
$sel:httpStatus:ListWorkspacesResponse' :: ListWorkspacesResponse -> Int
$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 Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [WorkspaceSummary]
workspaces