{-# 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.Athena.ListWorkGroups
(
ListWorkGroups (..),
newListWorkGroups,
listWorkGroups_nextToken,
listWorkGroups_maxResults,
ListWorkGroupsResponse (..),
newListWorkGroupsResponse,
listWorkGroupsResponse_nextToken,
listWorkGroupsResponse_workGroups,
listWorkGroupsResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
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 ListWorkGroups = ListWorkGroups'
{
ListWorkGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListWorkGroups -> ListWorkGroups -> Bool
(ListWorkGroups -> ListWorkGroups -> Bool)
-> (ListWorkGroups -> ListWorkGroups -> Bool) -> Eq ListWorkGroups
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]
(Int -> ReadS ListWorkGroups)
-> ReadS [ListWorkGroups]
-> ReadPrec ListWorkGroups
-> ReadPrec [ListWorkGroups]
-> Read 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
(Int -> ListWorkGroups -> ShowS)
-> (ListWorkGroups -> String)
-> ([ListWorkGroups] -> ShowS)
-> Show ListWorkGroups
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. ListWorkGroups -> Rep ListWorkGroups x)
-> (forall x. Rep ListWorkGroups x -> ListWorkGroups)
-> Generic ListWorkGroups
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' :: Maybe Text -> Maybe Natural -> ListWorkGroups
ListWorkGroups'
{ $sel:nextToken:ListWorkGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListWorkGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listWorkGroups_nextToken :: Lens.Lens' ListWorkGroups (Prelude.Maybe Prelude.Text)
listWorkGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkGroups -> f ListWorkGroups
listWorkGroups_nextToken = (ListWorkGroups -> Maybe Text)
-> (ListWorkGroups -> Maybe Text -> ListWorkGroups)
-> Lens ListWorkGroups ListWorkGroups (Maybe Text) (Maybe Text)
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)
listWorkGroups_maxResults :: Lens.Lens' ListWorkGroups (Prelude.Maybe Prelude.Natural)
listWorkGroups_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListWorkGroups -> f ListWorkGroups
listWorkGroups_maxResults = (ListWorkGroups -> Maybe Natural)
-> (ListWorkGroups -> Maybe Natural -> ListWorkGroups)
-> Lens
ListWorkGroups ListWorkGroups (Maybe Natural) (Maybe Natural)
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)
instance Core.AWSRequest ListWorkGroups where
type
AWSResponse ListWorkGroups =
ListWorkGroupsResponse
request :: ListWorkGroups -> Request ListWorkGroups
request = Service -> ListWorkGroups -> Request ListWorkGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListWorkGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkGroups)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListWorkGroups))
-> Logger
-> Service
-> Proxy ListWorkGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWorkGroups)))
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
-> Maybe [WorkGroupSummary] -> Int -> ListWorkGroupsResponse
ListWorkGroupsResponse'
(Maybe Text
-> Maybe [WorkGroupSummary] -> Int -> ListWorkGroupsResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [WorkGroupSummary] -> Int -> ListWorkGroupsResponse)
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 (Maybe [WorkGroupSummary] -> Int -> ListWorkGroupsResponse)
-> Either String (Maybe [WorkGroupSummary])
-> Either String (Int -> ListWorkGroupsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [WorkGroupSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WorkGroups" Either String (Maybe (Maybe [WorkGroupSummary]))
-> Maybe [WorkGroupSummary]
-> Either String (Maybe [WorkGroupSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [WorkGroupSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListWorkGroupsResponse)
-> Either String Int -> Either String ListWorkGroupsResponse
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))
)
instance Prelude.Hashable ListWorkGroups
instance Prelude.NFData ListWorkGroups
instance Core.ToHeaders ListWorkGroups where
toHeaders :: ListWorkGroups -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListWorkGroups -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonAthena.ListWorkGroups" ::
Prelude.ByteString
),
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.ToJSON ListWorkGroups where
toJSON :: ListWorkGroups -> Value
toJSON ListWorkGroups' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListWorkGroups' :: ListWorkGroups -> Maybe Natural
$sel:nextToken:ListWorkGroups' :: ListWorkGroups -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListWorkGroups where
toPath :: ListWorkGroups -> ByteString
toPath = ByteString -> ListWorkGroups -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListWorkGroups where
toQuery :: ListWorkGroups -> QueryString
toQuery = QueryString -> ListWorkGroups -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListWorkGroupsResponse = ListWorkGroupsResponse'
{
ListWorkGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListWorkGroupsResponse -> Maybe [WorkGroupSummary]
workGroups :: Prelude.Maybe [WorkGroupSummary],
ListWorkGroupsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListWorkGroupsResponse -> ListWorkGroupsResponse -> Bool
(ListWorkGroupsResponse -> ListWorkGroupsResponse -> Bool)
-> (ListWorkGroupsResponse -> ListWorkGroupsResponse -> Bool)
-> Eq ListWorkGroupsResponse
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]
(Int -> ReadS ListWorkGroupsResponse)
-> ReadS [ListWorkGroupsResponse]
-> ReadPrec ListWorkGroupsResponse
-> ReadPrec [ListWorkGroupsResponse]
-> Read 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
(Int -> ListWorkGroupsResponse -> ShowS)
-> (ListWorkGroupsResponse -> String)
-> ([ListWorkGroupsResponse] -> ShowS)
-> Show ListWorkGroupsResponse
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. ListWorkGroupsResponse -> Rep ListWorkGroupsResponse x)
-> (forall x.
Rep ListWorkGroupsResponse x -> ListWorkGroupsResponse)
-> Generic ListWorkGroupsResponse
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' :: Maybe Text
-> Maybe [WorkGroupSummary] -> Int -> ListWorkGroupsResponse
ListWorkGroupsResponse'
{ $sel:nextToken:ListWorkGroupsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:workGroups:ListWorkGroupsResponse' :: Maybe [WorkGroupSummary]
workGroups = Maybe [WorkGroupSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListWorkGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listWorkGroupsResponse_nextToken :: Lens.Lens' ListWorkGroupsResponse (Prelude.Maybe Prelude.Text)
listWorkGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkGroupsResponse -> f ListWorkGroupsResponse
listWorkGroupsResponse_nextToken = (ListWorkGroupsResponse -> Maybe Text)
-> (ListWorkGroupsResponse -> Maybe Text -> ListWorkGroupsResponse)
-> Lens
ListWorkGroupsResponse
ListWorkGroupsResponse
(Maybe Text)
(Maybe Text)
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_workGroups :: Lens.Lens' ListWorkGroupsResponse (Prelude.Maybe [WorkGroupSummary])
listWorkGroupsResponse_workGroups :: (Maybe [WorkGroupSummary] -> f (Maybe [WorkGroupSummary]))
-> ListWorkGroupsResponse -> f ListWorkGroupsResponse
listWorkGroupsResponse_workGroups = (ListWorkGroupsResponse -> Maybe [WorkGroupSummary])
-> (ListWorkGroupsResponse
-> Maybe [WorkGroupSummary] -> ListWorkGroupsResponse)
-> Lens
ListWorkGroupsResponse
ListWorkGroupsResponse
(Maybe [WorkGroupSummary])
(Maybe [WorkGroupSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkGroupsResponse' {Maybe [WorkGroupSummary]
workGroups :: Maybe [WorkGroupSummary]
$sel:workGroups:ListWorkGroupsResponse' :: ListWorkGroupsResponse -> Maybe [WorkGroupSummary]
workGroups} -> Maybe [WorkGroupSummary]
workGroups) (\s :: ListWorkGroupsResponse
s@ListWorkGroupsResponse' {} Maybe [WorkGroupSummary]
a -> ListWorkGroupsResponse
s {$sel:workGroups:ListWorkGroupsResponse' :: Maybe [WorkGroupSummary]
workGroups = Maybe [WorkGroupSummary]
a} :: ListWorkGroupsResponse) ((Maybe [WorkGroupSummary] -> f (Maybe [WorkGroupSummary]))
-> ListWorkGroupsResponse -> f ListWorkGroupsResponse)
-> ((Maybe [WorkGroupSummary] -> f (Maybe [WorkGroupSummary]))
-> Maybe [WorkGroupSummary] -> f (Maybe [WorkGroupSummary]))
-> (Maybe [WorkGroupSummary] -> f (Maybe [WorkGroupSummary]))
-> ListWorkGroupsResponse
-> f ListWorkGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[WorkGroupSummary]
[WorkGroupSummary]
[WorkGroupSummary]
[WorkGroupSummary]
-> Iso
(Maybe [WorkGroupSummary])
(Maybe [WorkGroupSummary])
(Maybe [WorkGroupSummary])
(Maybe [WorkGroupSummary])
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 AnIso
[WorkGroupSummary]
[WorkGroupSummary]
[WorkGroupSummary]
[WorkGroupSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listWorkGroupsResponse_httpStatus :: Lens.Lens' ListWorkGroupsResponse Prelude.Int
listWorkGroupsResponse_httpStatus :: (Int -> f Int)
-> ListWorkGroupsResponse -> f ListWorkGroupsResponse
listWorkGroupsResponse_httpStatus = (ListWorkGroupsResponse -> Int)
-> (ListWorkGroupsResponse -> Int -> ListWorkGroupsResponse)
-> Lens ListWorkGroupsResponse ListWorkGroupsResponse Int Int
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)
instance Prelude.NFData ListWorkGroupsResponse