{-# 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.XRay.GetGroups
(
GetGroups (..),
newGetGroups,
getGroups_nextToken,
GetGroupsResponse (..),
newGetGroupsResponse,
getGroupsResponse_groups,
getGroupsResponse_nextToken,
getGroupsResponse_httpStatus,
)
where
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
import Amazonka.XRay.Types
data GetGroups = GetGroups'
{
GetGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (GetGroups -> GetGroups -> Bool
(GetGroups -> GetGroups -> Bool)
-> (GetGroups -> GetGroups -> Bool) -> Eq GetGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroups -> GetGroups -> Bool
$c/= :: GetGroups -> GetGroups -> Bool
== :: GetGroups -> GetGroups -> Bool
$c== :: GetGroups -> GetGroups -> Bool
Prelude.Eq, ReadPrec [GetGroups]
ReadPrec GetGroups
Int -> ReadS GetGroups
ReadS [GetGroups]
(Int -> ReadS GetGroups)
-> ReadS [GetGroups]
-> ReadPrec GetGroups
-> ReadPrec [GetGroups]
-> Read GetGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroups]
$creadListPrec :: ReadPrec [GetGroups]
readPrec :: ReadPrec GetGroups
$creadPrec :: ReadPrec GetGroups
readList :: ReadS [GetGroups]
$creadList :: ReadS [GetGroups]
readsPrec :: Int -> ReadS GetGroups
$creadsPrec :: Int -> ReadS GetGroups
Prelude.Read, Int -> GetGroups -> ShowS
[GetGroups] -> ShowS
GetGroups -> String
(Int -> GetGroups -> ShowS)
-> (GetGroups -> String)
-> ([GetGroups] -> ShowS)
-> Show GetGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroups] -> ShowS
$cshowList :: [GetGroups] -> ShowS
show :: GetGroups -> String
$cshow :: GetGroups -> String
showsPrec :: Int -> GetGroups -> ShowS
$cshowsPrec :: Int -> GetGroups -> ShowS
Prelude.Show, (forall x. GetGroups -> Rep GetGroups x)
-> (forall x. Rep GetGroups x -> GetGroups) -> Generic GetGroups
forall x. Rep GetGroups x -> GetGroups
forall x. GetGroups -> Rep GetGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroups x -> GetGroups
$cfrom :: forall x. GetGroups -> Rep GetGroups x
Prelude.Generic)
newGetGroups ::
GetGroups
newGetGroups :: GetGroups
newGetGroups =
GetGroups' :: Maybe Text -> GetGroups
GetGroups' {$sel:nextToken:GetGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
getGroups_nextToken :: Lens.Lens' GetGroups (Prelude.Maybe Prelude.Text)
getGroups_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetGroups -> f GetGroups
getGroups_nextToken = (GetGroups -> Maybe Text)
-> (GetGroups -> Maybe Text -> GetGroups)
-> Lens GetGroups GetGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetGroups' :: GetGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetGroups
s@GetGroups' {} Maybe Text
a -> GetGroups
s {$sel:nextToken:GetGroups' :: Maybe Text
nextToken = Maybe Text
a} :: GetGroups)
instance Core.AWSPager GetGroups where
page :: GetGroups -> AWSResponse GetGroups -> Maybe GetGroups
page GetGroups
rq AWSResponse GetGroups
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetGroups
GetGroupsResponse
rs
GetGroupsResponse
-> Getting (First Text) GetGroupsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetGroupsResponse -> Const (First Text) GetGroupsResponse
Lens' GetGroupsResponse (Maybe Text)
getGroupsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetGroupsResponse -> Const (First Text) GetGroupsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetGroupsResponse 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 GetGroups
forall a. Maybe a
Prelude.Nothing
| Maybe [GroupSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetGroups
GetGroupsResponse
rs
GetGroupsResponse
-> Getting (First [GroupSummary]) GetGroupsResponse [GroupSummary]
-> Maybe [GroupSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GroupSummary]
-> Const (First [GroupSummary]) (Maybe [GroupSummary]))
-> GetGroupsResponse
-> Const (First [GroupSummary]) GetGroupsResponse
Lens' GetGroupsResponse (Maybe [GroupSummary])
getGroupsResponse_groups ((Maybe [GroupSummary]
-> Const (First [GroupSummary]) (Maybe [GroupSummary]))
-> GetGroupsResponse
-> Const (First [GroupSummary]) GetGroupsResponse)
-> (([GroupSummary] -> Const (First [GroupSummary]) [GroupSummary])
-> Maybe [GroupSummary]
-> Const (First [GroupSummary]) (Maybe [GroupSummary]))
-> Getting (First [GroupSummary]) GetGroupsResponse [GroupSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GroupSummary] -> Const (First [GroupSummary]) [GroupSummary])
-> Maybe [GroupSummary]
-> Const (First [GroupSummary]) (Maybe [GroupSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetGroups
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetGroups -> Maybe GetGroups
forall a. a -> Maybe a
Prelude.Just (GetGroups -> Maybe GetGroups) -> GetGroups -> Maybe GetGroups
forall a b. (a -> b) -> a -> b
Prelude.$
GetGroups
rq
GetGroups -> (GetGroups -> GetGroups) -> GetGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetGroups -> Identity GetGroups
Lens GetGroups GetGroups (Maybe Text) (Maybe Text)
getGroups_nextToken
((Maybe Text -> Identity (Maybe Text))
-> GetGroups -> Identity GetGroups)
-> Maybe Text -> GetGroups -> GetGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetGroups
GetGroupsResponse
rs
GetGroupsResponse
-> Getting (First Text) GetGroupsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetGroupsResponse -> Const (First Text) GetGroupsResponse
Lens' GetGroupsResponse (Maybe Text)
getGroupsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetGroupsResponse -> Const (First Text) GetGroupsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetGroupsResponse 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 GetGroups where
type AWSResponse GetGroups = GetGroupsResponse
request :: GetGroups -> Request GetGroups
request = Service -> GetGroups -> Request GetGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGroups)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetGroups))
-> Logger
-> Service
-> Proxy GetGroups
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGroups)))
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 [GroupSummary] -> Maybe Text -> Int -> GetGroupsResponse
GetGroupsResponse'
(Maybe [GroupSummary] -> Maybe Text -> Int -> GetGroupsResponse)
-> Either String (Maybe [GroupSummary])
-> Either String (Maybe Text -> Int -> GetGroupsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [GroupSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Groups" Either String (Maybe (Maybe [GroupSummary]))
-> Maybe [GroupSummary] -> Either String (Maybe [GroupSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GroupSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetGroupsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetGroupsResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> GetGroupsResponse)
-> Either String Int -> Either String GetGroupsResponse
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 GetGroups
instance Prelude.NFData GetGroups
instance Core.ToHeaders GetGroups where
toHeaders :: GetGroups -> ResponseHeaders
toHeaders = ResponseHeaders -> GetGroups -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON GetGroups where
toJSON :: GetGroups -> Value
toJSON GetGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetGroups' :: GetGroups -> 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]
)
instance Core.ToPath GetGroups where
toPath :: GetGroups -> ByteString
toPath = ByteString -> GetGroups -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/Groups"
instance Core.ToQuery GetGroups where
toQuery :: GetGroups -> QueryString
toQuery = QueryString -> GetGroups -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetGroupsResponse = GetGroupsResponse'
{
GetGroupsResponse -> Maybe [GroupSummary]
groups :: Prelude.Maybe [GroupSummary],
GetGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetGroupsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetGroupsResponse -> GetGroupsResponse -> Bool
(GetGroupsResponse -> GetGroupsResponse -> Bool)
-> (GetGroupsResponse -> GetGroupsResponse -> Bool)
-> Eq GetGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupsResponse -> GetGroupsResponse -> Bool
$c/= :: GetGroupsResponse -> GetGroupsResponse -> Bool
== :: GetGroupsResponse -> GetGroupsResponse -> Bool
$c== :: GetGroupsResponse -> GetGroupsResponse -> Bool
Prelude.Eq, ReadPrec [GetGroupsResponse]
ReadPrec GetGroupsResponse
Int -> ReadS GetGroupsResponse
ReadS [GetGroupsResponse]
(Int -> ReadS GetGroupsResponse)
-> ReadS [GetGroupsResponse]
-> ReadPrec GetGroupsResponse
-> ReadPrec [GetGroupsResponse]
-> Read GetGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupsResponse]
$creadListPrec :: ReadPrec [GetGroupsResponse]
readPrec :: ReadPrec GetGroupsResponse
$creadPrec :: ReadPrec GetGroupsResponse
readList :: ReadS [GetGroupsResponse]
$creadList :: ReadS [GetGroupsResponse]
readsPrec :: Int -> ReadS GetGroupsResponse
$creadsPrec :: Int -> ReadS GetGroupsResponse
Prelude.Read, Int -> GetGroupsResponse -> ShowS
[GetGroupsResponse] -> ShowS
GetGroupsResponse -> String
(Int -> GetGroupsResponse -> ShowS)
-> (GetGroupsResponse -> String)
-> ([GetGroupsResponse] -> ShowS)
-> Show GetGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupsResponse] -> ShowS
$cshowList :: [GetGroupsResponse] -> ShowS
show :: GetGroupsResponse -> String
$cshow :: GetGroupsResponse -> String
showsPrec :: Int -> GetGroupsResponse -> ShowS
$cshowsPrec :: Int -> GetGroupsResponse -> ShowS
Prelude.Show, (forall x. GetGroupsResponse -> Rep GetGroupsResponse x)
-> (forall x. Rep GetGroupsResponse x -> GetGroupsResponse)
-> Generic GetGroupsResponse
forall x. Rep GetGroupsResponse x -> GetGroupsResponse
forall x. GetGroupsResponse -> Rep GetGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroupsResponse x -> GetGroupsResponse
$cfrom :: forall x. GetGroupsResponse -> Rep GetGroupsResponse x
Prelude.Generic)
newGetGroupsResponse ::
Prelude.Int ->
GetGroupsResponse
newGetGroupsResponse :: Int -> GetGroupsResponse
newGetGroupsResponse Int
pHttpStatus_ =
GetGroupsResponse' :: Maybe [GroupSummary] -> Maybe Text -> Int -> GetGroupsResponse
GetGroupsResponse'
{ $sel:groups:GetGroupsResponse' :: Maybe [GroupSummary]
groups = Maybe [GroupSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetGroupsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getGroupsResponse_groups :: Lens.Lens' GetGroupsResponse (Prelude.Maybe [GroupSummary])
getGroupsResponse_groups :: (Maybe [GroupSummary] -> f (Maybe [GroupSummary]))
-> GetGroupsResponse -> f GetGroupsResponse
getGroupsResponse_groups = (GetGroupsResponse -> Maybe [GroupSummary])
-> (GetGroupsResponse -> Maybe [GroupSummary] -> GetGroupsResponse)
-> Lens' GetGroupsResponse (Maybe [GroupSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsResponse' {Maybe [GroupSummary]
groups :: Maybe [GroupSummary]
$sel:groups:GetGroupsResponse' :: GetGroupsResponse -> Maybe [GroupSummary]
groups} -> Maybe [GroupSummary]
groups) (\s :: GetGroupsResponse
s@GetGroupsResponse' {} Maybe [GroupSummary]
a -> GetGroupsResponse
s {$sel:groups:GetGroupsResponse' :: Maybe [GroupSummary]
groups = Maybe [GroupSummary]
a} :: GetGroupsResponse) ((Maybe [GroupSummary] -> f (Maybe [GroupSummary]))
-> GetGroupsResponse -> f GetGroupsResponse)
-> ((Maybe [GroupSummary] -> f (Maybe [GroupSummary]))
-> Maybe [GroupSummary] -> f (Maybe [GroupSummary]))
-> (Maybe [GroupSummary] -> f (Maybe [GroupSummary]))
-> GetGroupsResponse
-> f GetGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [GroupSummary] [GroupSummary] [GroupSummary] [GroupSummary]
-> Iso
(Maybe [GroupSummary])
(Maybe [GroupSummary])
(Maybe [GroupSummary])
(Maybe [GroupSummary])
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 [GroupSummary] [GroupSummary] [GroupSummary] [GroupSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getGroupsResponse_nextToken :: Lens.Lens' GetGroupsResponse (Prelude.Maybe Prelude.Text)
getGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetGroupsResponse -> f GetGroupsResponse
getGroupsResponse_nextToken = (GetGroupsResponse -> Maybe Text)
-> (GetGroupsResponse -> Maybe Text -> GetGroupsResponse)
-> Lens' GetGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetGroupsResponse' :: GetGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetGroupsResponse
s@GetGroupsResponse' {} Maybe Text
a -> GetGroupsResponse
s {$sel:nextToken:GetGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetGroupsResponse)
getGroupsResponse_httpStatus :: Lens.Lens' GetGroupsResponse Prelude.Int
getGroupsResponse_httpStatus :: (Int -> f Int) -> GetGroupsResponse -> f GetGroupsResponse
getGroupsResponse_httpStatus = (GetGroupsResponse -> Int)
-> (GetGroupsResponse -> Int -> GetGroupsResponse)
-> Lens GetGroupsResponse GetGroupsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGroupsResponse' :: GetGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGroupsResponse
s@GetGroupsResponse' {} Int
a -> GetGroupsResponse
s {$sel:httpStatus:GetGroupsResponse' :: Int
httpStatus = Int
a} :: GetGroupsResponse)
instance Prelude.NFData GetGroupsResponse