{-# 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.RedshiftServerLess.ListWorkgroups
(
ListWorkgroups (..),
newListWorkgroups,
listWorkgroups_maxResults,
listWorkgroups_nextToken,
ListWorkgroupsResponse (..),
newListWorkgroupsResponse,
listWorkgroupsResponse_nextToken,
listWorkgroupsResponse_httpStatus,
listWorkgroupsResponse_workgroups,
)
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 Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListWorkgroups = ListWorkgroups'
{
ListWorkgroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListWorkgroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListWorkgroups -> ListWorkgroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkgroups -> ListWorkgroups -> Bool
$c/= :: ListWorkgroups -> ListWorkgroups -> Bool
== :: ListWorkgroups -> ListWorkgroups -> Bool
$c== :: ListWorkgroups -> ListWorkgroups -> Bool
Prelude.Eq, ReadPrec [ListWorkgroups]
ReadPrec ListWorkgroups
Int -> ReadS ListWorkgroups
ReadS [ListWorkgroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkgroups]
$creadListPrec :: ReadPrec [ListWorkgroups]
readPrec :: ReadPrec ListWorkgroups
$creadPrec :: ReadPrec ListWorkgroups
readList :: ReadS [ListWorkgroups]
$creadList :: ReadS [ListWorkgroups]
readsPrec :: Int -> ReadS ListWorkgroups
$creadsPrec :: Int -> ReadS ListWorkgroups
Prelude.Read, Int -> ListWorkgroups -> ShowS
[ListWorkgroups] -> ShowS
ListWorkgroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkgroups] -> ShowS
$cshowList :: [ListWorkgroups] -> ShowS
show :: ListWorkgroups -> String
$cshow :: ListWorkgroups -> String
showsPrec :: Int -> ListWorkgroups -> ShowS
$cshowsPrec :: Int -> ListWorkgroups -> ShowS
Prelude.Show, forall x. Rep ListWorkgroups x -> ListWorkgroups
forall x. ListWorkgroups -> Rep ListWorkgroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkgroups x -> ListWorkgroups
$cfrom :: forall x. ListWorkgroups -> Rep ListWorkgroups x
Prelude.Generic)
newListWorkgroups ::
ListWorkgroups
newListWorkgroups :: ListWorkgroups
newListWorkgroups =
ListWorkgroups'
{ $sel:maxResults:ListWorkgroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListWorkgroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listWorkgroups_maxResults :: Lens.Lens' ListWorkgroups (Prelude.Maybe Prelude.Natural)
listWorkgroups_maxResults :: Lens' ListWorkgroups (Maybe Natural)
listWorkgroups_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkgroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListWorkgroups' :: ListWorkgroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListWorkgroups
s@ListWorkgroups' {} Maybe Natural
a -> ListWorkgroups
s {$sel:maxResults:ListWorkgroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListWorkgroups)
listWorkgroups_nextToken :: Lens.Lens' ListWorkgroups (Prelude.Maybe Prelude.Text)
listWorkgroups_nextToken :: Lens' ListWorkgroups (Maybe Text)
listWorkgroups_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkgroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkgroups' :: ListWorkgroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkgroups
s@ListWorkgroups' {} Maybe Text
a -> ListWorkgroups
s {$sel:nextToken:ListWorkgroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkgroups)
instance Core.AWSPager ListWorkgroups where
page :: ListWorkgroups
-> AWSResponse ListWorkgroups -> Maybe ListWorkgroups
page ListWorkgroups
rq AWSResponse ListWorkgroups
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListWorkgroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkgroupsResponse (Maybe Text)
listWorkgroupsResponse_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 ListWorkgroups
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListWorkgroupsResponse [Workgroup]
listWorkgroupsResponse_workgroups) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListWorkgroups
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListWorkgroups (Maybe Text)
listWorkgroups_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorkgroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkgroupsResponse (Maybe Text)
listWorkgroupsResponse_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 ListWorkgroups where
type
AWSResponse ListWorkgroups =
ListWorkgroupsResponse
request :: (Service -> Service) -> ListWorkgroups -> Request ListWorkgroups
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 ListWorkgroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkgroups)))
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 -> [Workgroup] -> ListWorkgroupsResponse
ListWorkgroupsResponse'
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
"workgroups" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListWorkgroups where
hashWithSalt :: Int -> ListWorkgroups -> Int
hashWithSalt Int
_salt ListWorkgroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkgroups' :: ListWorkgroups -> Maybe Text
$sel:maxResults:ListWorkgroups' :: ListWorkgroups -> 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 ListWorkgroups where
rnf :: ListWorkgroups -> ()
rnf ListWorkgroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkgroups' :: ListWorkgroups -> Maybe Text
$sel:maxResults:ListWorkgroups' :: ListWorkgroups -> 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 ListWorkgroups where
toHeaders :: ListWorkgroups -> 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
"RedshiftServerless.ListWorkgroups" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListWorkgroups where
toJSON :: ListWorkgroups -> Value
toJSON ListWorkgroups' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListWorkgroups' :: ListWorkgroups -> Maybe Text
$sel:maxResults:ListWorkgroups' :: ListWorkgroups -> 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 ListWorkgroups where
toPath :: ListWorkgroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListWorkgroups where
toQuery :: ListWorkgroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListWorkgroupsResponse = ListWorkgroupsResponse'
{
ListWorkgroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkgroupsResponse -> Int
httpStatus :: Prelude.Int,
ListWorkgroupsResponse -> [Workgroup]
workgroups :: [Workgroup]
}
deriving (ListWorkgroupsResponse -> ListWorkgroupsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkgroupsResponse -> ListWorkgroupsResponse -> Bool
$c/= :: ListWorkgroupsResponse -> ListWorkgroupsResponse -> Bool
== :: ListWorkgroupsResponse -> ListWorkgroupsResponse -> Bool
$c== :: ListWorkgroupsResponse -> ListWorkgroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListWorkgroupsResponse]
ReadPrec ListWorkgroupsResponse
Int -> ReadS ListWorkgroupsResponse
ReadS [ListWorkgroupsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkgroupsResponse]
$creadListPrec :: ReadPrec [ListWorkgroupsResponse]
readPrec :: ReadPrec ListWorkgroupsResponse
$creadPrec :: ReadPrec ListWorkgroupsResponse
readList :: ReadS [ListWorkgroupsResponse]
$creadList :: ReadS [ListWorkgroupsResponse]
readsPrec :: Int -> ReadS ListWorkgroupsResponse
$creadsPrec :: Int -> ReadS ListWorkgroupsResponse
Prelude.Read, Int -> ListWorkgroupsResponse -> ShowS
[ListWorkgroupsResponse] -> ShowS
ListWorkgroupsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkgroupsResponse] -> ShowS
$cshowList :: [ListWorkgroupsResponse] -> ShowS
show :: ListWorkgroupsResponse -> String
$cshow :: ListWorkgroupsResponse -> String
showsPrec :: Int -> ListWorkgroupsResponse -> ShowS
$cshowsPrec :: Int -> ListWorkgroupsResponse -> ShowS
Prelude.Show, forall x. Rep ListWorkgroupsResponse x -> ListWorkgroupsResponse
forall x. ListWorkgroupsResponse -> Rep ListWorkgroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkgroupsResponse x -> ListWorkgroupsResponse
$cfrom :: forall x. ListWorkgroupsResponse -> Rep ListWorkgroupsResponse x
Prelude.Generic)
newListWorkgroupsResponse ::
Prelude.Int ->
ListWorkgroupsResponse
newListWorkgroupsResponse :: Int -> ListWorkgroupsResponse
newListWorkgroupsResponse Int
pHttpStatus_ =
ListWorkgroupsResponse'
{ $sel:nextToken:ListWorkgroupsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorkgroupsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:workgroups:ListWorkgroupsResponse' :: [Workgroup]
workgroups = forall a. Monoid a => a
Prelude.mempty
}
listWorkgroupsResponse_nextToken :: Lens.Lens' ListWorkgroupsResponse (Prelude.Maybe Prelude.Text)
listWorkgroupsResponse_nextToken :: Lens' ListWorkgroupsResponse (Maybe Text)
listWorkgroupsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkgroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListWorkgroupsResponse
s@ListWorkgroupsResponse' {} Maybe Text
a -> ListWorkgroupsResponse
s {$sel:nextToken:ListWorkgroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListWorkgroupsResponse)
listWorkgroupsResponse_httpStatus :: Lens.Lens' ListWorkgroupsResponse Prelude.Int
listWorkgroupsResponse_httpStatus :: Lens' ListWorkgroupsResponse Int
listWorkgroupsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkgroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWorkgroupsResponse
s@ListWorkgroupsResponse' {} Int
a -> ListWorkgroupsResponse
s {$sel:httpStatus:ListWorkgroupsResponse' :: Int
httpStatus = Int
a} :: ListWorkgroupsResponse)
listWorkgroupsResponse_workgroups :: Lens.Lens' ListWorkgroupsResponse [Workgroup]
listWorkgroupsResponse_workgroups :: Lens' ListWorkgroupsResponse [Workgroup]
listWorkgroupsResponse_workgroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkgroupsResponse' {[Workgroup]
workgroups :: [Workgroup]
$sel:workgroups:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> [Workgroup]
workgroups} -> [Workgroup]
workgroups) (\s :: ListWorkgroupsResponse
s@ListWorkgroupsResponse' {} [Workgroup]
a -> ListWorkgroupsResponse
s {$sel:workgroups:ListWorkgroupsResponse' :: [Workgroup]
workgroups = [Workgroup]
a} :: ListWorkgroupsResponse) 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 ListWorkgroupsResponse where
rnf :: ListWorkgroupsResponse -> ()
rnf ListWorkgroupsResponse' {Int
[Workgroup]
Maybe Text
workgroups :: [Workgroup]
httpStatus :: Int
nextToken :: Maybe Text
$sel:workgroups:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> [Workgroup]
$sel:httpStatus:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> Int
$sel:nextToken:ListWorkgroupsResponse' :: ListWorkgroupsResponse -> 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 [Workgroup]
workgroups