{-# 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_nextToken,
listWorkspaces_maxResults,
ListWorkspacesResponse (..),
newListWorkspacesResponse,
listWorkspacesResponse_nextToken,
listWorkspacesResponse_httpStatus,
listWorkspacesResponse_workspaces,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Grafana.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListWorkspaces = ListWorkspaces'
{
ListWorkspaces -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkspaces -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListWorkspaces -> ListWorkspaces -> Bool
(ListWorkspaces -> ListWorkspaces -> Bool)
-> (ListWorkspaces -> ListWorkspaces -> Bool) -> Eq ListWorkspaces
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]
(Int -> ReadS ListWorkspaces)
-> ReadS [ListWorkspaces]
-> ReadPrec ListWorkspaces
-> ReadPrec [ListWorkspaces]
-> Read 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
(Int -> ListWorkspaces -> ShowS)
-> (ListWorkspaces -> String)
-> ([ListWorkspaces] -> ShowS)
-> Show ListWorkspaces
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. ListWorkspaces -> Rep ListWorkspaces x)
-> (forall x. Rep ListWorkspaces x -> ListWorkspaces)
-> Generic ListWorkspaces
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' :: Maybe Text -> Maybe Natural -> ListWorkspaces
ListWorkspaces'
{ $sel:nextToken:ListWorkspaces' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListWorkspaces' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listWorkspaces_nextToken :: Lens.Lens' ListWorkspaces (Prelude.Maybe Prelude.Text)
listWorkspaces_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkspaces -> f ListWorkspaces
listWorkspaces_nextToken = (ListWorkspaces -> Maybe Text)
-> (ListWorkspaces -> Maybe Text -> ListWorkspaces)
-> Lens ListWorkspaces ListWorkspaces (Maybe Text) (Maybe Text)
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)
listWorkspaces_maxResults :: Lens.Lens' ListWorkspaces (Prelude.Maybe Prelude.Natural)
listWorkspaces_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListWorkspaces -> f ListWorkspaces
listWorkspaces_maxResults = (ListWorkspaces -> Maybe Natural)
-> (ListWorkspaces -> Maybe Natural -> ListWorkspaces)
-> Lens
ListWorkspaces ListWorkspaces (Maybe Natural) (Maybe Natural)
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)
instance Core.AWSPager ListWorkspaces where
page :: ListWorkspaces
-> AWSResponse ListWorkspaces -> Maybe ListWorkspaces
page ListWorkspaces
rq AWSResponse ListWorkspaces
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListWorkspaces
ListWorkspacesResponse
rs
ListWorkspacesResponse
-> Getting (First Text) ListWorkspacesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkspacesResponse
-> Const (First Text) ListWorkspacesResponse
Lens' ListWorkspacesResponse (Maybe Text)
listWorkspacesResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkspacesResponse
-> Const (First Text) ListWorkspacesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListWorkspacesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListWorkspaces
forall a. Maybe a
Prelude.Nothing
| [WorkspaceSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListWorkspaces
ListWorkspacesResponse
rs ListWorkspacesResponse
-> Getting
[WorkspaceSummary] ListWorkspacesResponse [WorkspaceSummary]
-> [WorkspaceSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[WorkspaceSummary] ListWorkspacesResponse [WorkspaceSummary]
Lens' ListWorkspacesResponse [WorkspaceSummary]
listWorkspacesResponse_workspaces) =
Maybe ListWorkspaces
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListWorkspaces -> Maybe ListWorkspaces
forall a. a -> Maybe a
Prelude.Just (ListWorkspaces -> Maybe ListWorkspaces)
-> ListWorkspaces -> Maybe ListWorkspaces
forall a b. (a -> b) -> a -> b
Prelude.$
ListWorkspaces
rq
ListWorkspaces
-> (ListWorkspaces -> ListWorkspaces) -> ListWorkspaces
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListWorkspaces -> Identity ListWorkspaces
Lens ListWorkspaces ListWorkspaces (Maybe Text) (Maybe Text)
listWorkspaces_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListWorkspaces -> Identity ListWorkspaces)
-> Maybe Text -> ListWorkspaces -> ListWorkspaces
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorkspaces
ListWorkspacesResponse
rs
ListWorkspacesResponse
-> Getting (First Text) ListWorkspacesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkspacesResponse
-> Const (First Text) ListWorkspacesResponse
Lens' ListWorkspacesResponse (Maybe Text)
listWorkspacesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListWorkspacesResponse
-> Const (First Text) ListWorkspacesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListWorkspacesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListWorkspaces where
type
AWSResponse ListWorkspaces =
ListWorkspacesResponse
request :: ListWorkspaces -> Request ListWorkspaces
request = Service -> ListWorkspaces -> Request ListWorkspaces
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListWorkspaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkspaces)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListWorkspaces))
-> Logger
-> Service
-> Proxy ListWorkspaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkspaces)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> 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'
(Maybe Text -> Int -> [WorkspaceSummary] -> ListWorkspacesResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [WorkspaceSummary] -> ListWorkspacesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Int -> [WorkspaceSummary] -> ListWorkspacesResponse)
-> Either String Int
-> Either String ([WorkspaceSummary] -> ListWorkspacesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String ([WorkspaceSummary] -> ListWorkspacesResponse)
-> Either String [WorkspaceSummary]
-> Either String ListWorkspacesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [WorkspaceSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"workspaces" Either String (Maybe [WorkspaceSummary])
-> [WorkspaceSummary] -> Either String [WorkspaceSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [WorkspaceSummary]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListWorkspaces
instance Prelude.NFData ListWorkspaces
instance Core.ToHeaders ListWorkspaces where
toHeaders :: ListWorkspaces -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListWorkspaces -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath ListWorkspaces where
toPath :: ListWorkspaces -> ByteString
toPath = ByteString -> ListWorkspaces -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/workspaces"
instance Core.ToQuery ListWorkspaces where
toQuery :: ListWorkspaces -> QueryString
toQuery ListWorkspaces' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListWorkspaces' :: ListWorkspaces -> Maybe Natural
$sel:nextToken:ListWorkspaces' :: ListWorkspaces -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListWorkspacesResponse = ListWorkspacesResponse'
{
ListWorkspacesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkspacesResponse -> Int
httpStatus :: Prelude.Int,
ListWorkspacesResponse -> [WorkspaceSummary]
workspaces :: [WorkspaceSummary]
}
deriving (ListWorkspacesResponse -> ListWorkspacesResponse -> Bool
(ListWorkspacesResponse -> ListWorkspacesResponse -> Bool)
-> (ListWorkspacesResponse -> ListWorkspacesResponse -> Bool)
-> Eq ListWorkspacesResponse
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
(Int -> ListWorkspacesResponse -> ShowS)
-> (ListWorkspacesResponse -> String)
-> ([ListWorkspacesResponse] -> ShowS)
-> Show ListWorkspacesResponse
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. ListWorkspacesResponse -> Rep ListWorkspacesResponse x)
-> (forall x.
Rep ListWorkspacesResponse x -> ListWorkspacesResponse)
-> Generic ListWorkspacesResponse
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' :: Maybe Text -> Int -> [WorkspaceSummary] -> ListWorkspacesResponse
ListWorkspacesResponse'
{ $sel:nextToken:ListWorkspacesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorkspacesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:workspaces:ListWorkspacesResponse' :: [WorkspaceSummary]
workspaces = [WorkspaceSummary]
forall a. Monoid a => a
Prelude.mempty
}
listWorkspacesResponse_nextToken :: Lens.Lens' ListWorkspacesResponse (Prelude.Maybe Prelude.Text)
listWorkspacesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkspacesResponse -> f ListWorkspacesResponse
listWorkspacesResponse_nextToken = (ListWorkspacesResponse -> Maybe Text)
-> (ListWorkspacesResponse -> Maybe Text -> ListWorkspacesResponse)
-> Lens' ListWorkspacesResponse (Maybe Text)
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 :: (Int -> f Int)
-> ListWorkspacesResponse -> f ListWorkspacesResponse
listWorkspacesResponse_httpStatus = (ListWorkspacesResponse -> Int)
-> (ListWorkspacesResponse -> Int -> ListWorkspacesResponse)
-> Lens ListWorkspacesResponse ListWorkspacesResponse Int Int
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 :: ([WorkspaceSummary] -> f [WorkspaceSummary])
-> ListWorkspacesResponse -> f ListWorkspacesResponse
listWorkspacesResponse_workspaces = (ListWorkspacesResponse -> [WorkspaceSummary])
-> (ListWorkspacesResponse
-> [WorkspaceSummary] -> ListWorkspacesResponse)
-> Lens' ListWorkspacesResponse [WorkspaceSummary]
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) (([WorkspaceSummary] -> f [WorkspaceSummary])
-> ListWorkspacesResponse -> f ListWorkspacesResponse)
-> (([WorkspaceSummary] -> f [WorkspaceSummary])
-> [WorkspaceSummary] -> f [WorkspaceSummary])
-> ([WorkspaceSummary] -> f [WorkspaceSummary])
-> ListWorkspacesResponse
-> f ListWorkspacesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([WorkspaceSummary] -> f [WorkspaceSummary])
-> [WorkspaceSummary] -> f [WorkspaceSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListWorkspacesResponse