{-# 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.GlobalAccelerator.ListEndpointGroups
(
ListEndpointGroups (..),
newListEndpointGroups,
listEndpointGroups_maxResults,
listEndpointGroups_nextToken,
listEndpointGroups_listenerArn,
ListEndpointGroupsResponse (..),
newListEndpointGroupsResponse,
listEndpointGroupsResponse_endpointGroups,
listEndpointGroupsResponse_nextToken,
listEndpointGroupsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GlobalAccelerator.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListEndpointGroups = ListEndpointGroups'
{
ListEndpointGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListEndpointGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEndpointGroups -> Text
listenerArn :: Prelude.Text
}
deriving (ListEndpointGroups -> ListEndpointGroups -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEndpointGroups -> ListEndpointGroups -> Bool
$c/= :: ListEndpointGroups -> ListEndpointGroups -> Bool
== :: ListEndpointGroups -> ListEndpointGroups -> Bool
$c== :: ListEndpointGroups -> ListEndpointGroups -> Bool
Prelude.Eq, ReadPrec [ListEndpointGroups]
ReadPrec ListEndpointGroups
Int -> ReadS ListEndpointGroups
ReadS [ListEndpointGroups]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEndpointGroups]
$creadListPrec :: ReadPrec [ListEndpointGroups]
readPrec :: ReadPrec ListEndpointGroups
$creadPrec :: ReadPrec ListEndpointGroups
readList :: ReadS [ListEndpointGroups]
$creadList :: ReadS [ListEndpointGroups]
readsPrec :: Int -> ReadS ListEndpointGroups
$creadsPrec :: Int -> ReadS ListEndpointGroups
Prelude.Read, Int -> ListEndpointGroups -> ShowS
[ListEndpointGroups] -> ShowS
ListEndpointGroups -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEndpointGroups] -> ShowS
$cshowList :: [ListEndpointGroups] -> ShowS
show :: ListEndpointGroups -> String
$cshow :: ListEndpointGroups -> String
showsPrec :: Int -> ListEndpointGroups -> ShowS
$cshowsPrec :: Int -> ListEndpointGroups -> ShowS
Prelude.Show, forall x. Rep ListEndpointGroups x -> ListEndpointGroups
forall x. ListEndpointGroups -> Rep ListEndpointGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEndpointGroups x -> ListEndpointGroups
$cfrom :: forall x. ListEndpointGroups -> Rep ListEndpointGroups x
Prelude.Generic)
newListEndpointGroups ::
Prelude.Text ->
ListEndpointGroups
newListEndpointGroups :: Text -> ListEndpointGroups
newListEndpointGroups Text
pListenerArn_ =
ListEndpointGroups'
{ $sel:maxResults:ListEndpointGroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEndpointGroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:listenerArn:ListEndpointGroups' :: Text
listenerArn = Text
pListenerArn_
}
listEndpointGroups_maxResults :: Lens.Lens' ListEndpointGroups (Prelude.Maybe Prelude.Natural)
listEndpointGroups_maxResults :: Lens' ListEndpointGroups (Maybe Natural)
listEndpointGroups_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEndpointGroups' :: ListEndpointGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEndpointGroups
s@ListEndpointGroups' {} Maybe Natural
a -> ListEndpointGroups
s {$sel:maxResults:ListEndpointGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEndpointGroups)
listEndpointGroups_nextToken :: Lens.Lens' ListEndpointGroups (Prelude.Maybe Prelude.Text)
listEndpointGroups_nextToken :: Lens' ListEndpointGroups (Maybe Text)
listEndpointGroups_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEndpointGroups' :: ListEndpointGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEndpointGroups
s@ListEndpointGroups' {} Maybe Text
a -> ListEndpointGroups
s {$sel:nextToken:ListEndpointGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListEndpointGroups)
listEndpointGroups_listenerArn :: Lens.Lens' ListEndpointGroups Prelude.Text
listEndpointGroups_listenerArn :: Lens' ListEndpointGroups Text
listEndpointGroups_listenerArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroups' {Text
listenerArn :: Text
$sel:listenerArn:ListEndpointGroups' :: ListEndpointGroups -> Text
listenerArn} -> Text
listenerArn) (\s :: ListEndpointGroups
s@ListEndpointGroups' {} Text
a -> ListEndpointGroups
s {$sel:listenerArn:ListEndpointGroups' :: Text
listenerArn = Text
a} :: ListEndpointGroups)
instance Core.AWSPager ListEndpointGroups where
page :: ListEndpointGroups
-> AWSResponse ListEndpointGroups -> Maybe ListEndpointGroups
page ListEndpointGroups
rq AWSResponse ListEndpointGroups
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListEndpointGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEndpointGroupsResponse (Maybe Text)
listEndpointGroupsResponse_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 ListEndpointGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEndpointGroupsResponse (Maybe [EndpointGroup])
listEndpointGroupsResponse_endpointGroups
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListEndpointGroups
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListEndpointGroups (Maybe Text)
listEndpointGroups_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEndpointGroups
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEndpointGroupsResponse (Maybe Text)
listEndpointGroupsResponse_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 ListEndpointGroups where
type
AWSResponse ListEndpointGroups =
ListEndpointGroupsResponse
request :: (Service -> Service)
-> ListEndpointGroups -> Request ListEndpointGroups
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 ListEndpointGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListEndpointGroups)))
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 [EndpointGroup]
-> Maybe Text -> Int -> ListEndpointGroupsResponse
ListEndpointGroupsResponse'
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
"EndpointGroups" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"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))
)
instance Prelude.Hashable ListEndpointGroups where
hashWithSalt :: Int -> ListEndpointGroups -> Int
hashWithSalt Int
_salt ListEndpointGroups' {Maybe Natural
Maybe Text
Text
listenerArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:listenerArn:ListEndpointGroups' :: ListEndpointGroups -> Text
$sel:nextToken:ListEndpointGroups' :: ListEndpointGroups -> Maybe Text
$sel:maxResults:ListEndpointGroups' :: ListEndpointGroups -> 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
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
listenerArn
instance Prelude.NFData ListEndpointGroups where
rnf :: ListEndpointGroups -> ()
rnf ListEndpointGroups' {Maybe Natural
Maybe Text
Text
listenerArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:listenerArn:ListEndpointGroups' :: ListEndpointGroups -> Text
$sel:nextToken:ListEndpointGroups' :: ListEndpointGroups -> Maybe Text
$sel:maxResults:ListEndpointGroups' :: ListEndpointGroups -> 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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
listenerArn
instance Data.ToHeaders ListEndpointGroups where
toHeaders :: ListEndpointGroups -> 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
"GlobalAccelerator_V20180706.ListEndpointGroups" ::
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 ListEndpointGroups where
toJSON :: ListEndpointGroups -> Value
toJSON ListEndpointGroups' {Maybe Natural
Maybe Text
Text
listenerArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:listenerArn:ListEndpointGroups' :: ListEndpointGroups -> Text
$sel:nextToken:ListEndpointGroups' :: ListEndpointGroups -> Maybe Text
$sel:maxResults:ListEndpointGroups' :: ListEndpointGroups -> 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,
forall a. a -> Maybe a
Prelude.Just (Key
"ListenerArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
listenerArn)
]
)
instance Data.ToPath ListEndpointGroups where
toPath :: ListEndpointGroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListEndpointGroups where
toQuery :: ListEndpointGroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListEndpointGroupsResponse = ListEndpointGroupsResponse'
{
ListEndpointGroupsResponse -> Maybe [EndpointGroup]
endpointGroups :: Prelude.Maybe [EndpointGroup],
ListEndpointGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEndpointGroupsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListEndpointGroupsResponse -> ListEndpointGroupsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEndpointGroupsResponse -> ListEndpointGroupsResponse -> Bool
$c/= :: ListEndpointGroupsResponse -> ListEndpointGroupsResponse -> Bool
== :: ListEndpointGroupsResponse -> ListEndpointGroupsResponse -> Bool
$c== :: ListEndpointGroupsResponse -> ListEndpointGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListEndpointGroupsResponse]
ReadPrec ListEndpointGroupsResponse
Int -> ReadS ListEndpointGroupsResponse
ReadS [ListEndpointGroupsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEndpointGroupsResponse]
$creadListPrec :: ReadPrec [ListEndpointGroupsResponse]
readPrec :: ReadPrec ListEndpointGroupsResponse
$creadPrec :: ReadPrec ListEndpointGroupsResponse
readList :: ReadS [ListEndpointGroupsResponse]
$creadList :: ReadS [ListEndpointGroupsResponse]
readsPrec :: Int -> ReadS ListEndpointGroupsResponse
$creadsPrec :: Int -> ReadS ListEndpointGroupsResponse
Prelude.Read, Int -> ListEndpointGroupsResponse -> ShowS
[ListEndpointGroupsResponse] -> ShowS
ListEndpointGroupsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEndpointGroupsResponse] -> ShowS
$cshowList :: [ListEndpointGroupsResponse] -> ShowS
show :: ListEndpointGroupsResponse -> String
$cshow :: ListEndpointGroupsResponse -> String
showsPrec :: Int -> ListEndpointGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListEndpointGroupsResponse -> ShowS
Prelude.Show, forall x.
Rep ListEndpointGroupsResponse x -> ListEndpointGroupsResponse
forall x.
ListEndpointGroupsResponse -> Rep ListEndpointGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEndpointGroupsResponse x -> ListEndpointGroupsResponse
$cfrom :: forall x.
ListEndpointGroupsResponse -> Rep ListEndpointGroupsResponse x
Prelude.Generic)
newListEndpointGroupsResponse ::
Prelude.Int ->
ListEndpointGroupsResponse
newListEndpointGroupsResponse :: Int -> ListEndpointGroupsResponse
newListEndpointGroupsResponse Int
pHttpStatus_ =
ListEndpointGroupsResponse'
{ $sel:endpointGroups:ListEndpointGroupsResponse' :: Maybe [EndpointGroup]
endpointGroups =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEndpointGroupsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEndpointGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listEndpointGroupsResponse_endpointGroups :: Lens.Lens' ListEndpointGroupsResponse (Prelude.Maybe [EndpointGroup])
listEndpointGroupsResponse_endpointGroups :: Lens' ListEndpointGroupsResponse (Maybe [EndpointGroup])
listEndpointGroupsResponse_endpointGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroupsResponse' {Maybe [EndpointGroup]
endpointGroups :: Maybe [EndpointGroup]
$sel:endpointGroups:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Maybe [EndpointGroup]
endpointGroups} -> Maybe [EndpointGroup]
endpointGroups) (\s :: ListEndpointGroupsResponse
s@ListEndpointGroupsResponse' {} Maybe [EndpointGroup]
a -> ListEndpointGroupsResponse
s {$sel:endpointGroups:ListEndpointGroupsResponse' :: Maybe [EndpointGroup]
endpointGroups = Maybe [EndpointGroup]
a} :: ListEndpointGroupsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listEndpointGroupsResponse_nextToken :: Lens.Lens' ListEndpointGroupsResponse (Prelude.Maybe Prelude.Text)
listEndpointGroupsResponse_nextToken :: Lens' ListEndpointGroupsResponse (Maybe Text)
listEndpointGroupsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEndpointGroupsResponse
s@ListEndpointGroupsResponse' {} Maybe Text
a -> ListEndpointGroupsResponse
s {$sel:nextToken:ListEndpointGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEndpointGroupsResponse)
listEndpointGroupsResponse_httpStatus :: Lens.Lens' ListEndpointGroupsResponse Prelude.Int
listEndpointGroupsResponse_httpStatus :: Lens' ListEndpointGroupsResponse Int
listEndpointGroupsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEndpointGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEndpointGroupsResponse
s@ListEndpointGroupsResponse' {} Int
a -> ListEndpointGroupsResponse
s {$sel:httpStatus:ListEndpointGroupsResponse' :: Int
httpStatus = Int
a} :: ListEndpointGroupsResponse)
instance Prelude.NFData ListEndpointGroupsResponse where
rnf :: ListEndpointGroupsResponse -> ()
rnf ListEndpointGroupsResponse' {Int
Maybe [EndpointGroup]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
endpointGroups :: Maybe [EndpointGroup]
$sel:httpStatus:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Int
$sel:nextToken:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Maybe Text
$sel:endpointGroups:ListEndpointGroupsResponse' :: ListEndpointGroupsResponse -> Maybe [EndpointGroup]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [EndpointGroup]
endpointGroups
seq :: forall a b. a -> b -> b
`Prelude.seq` 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