{-# 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.Shield.ListProtectionGroups
(
ListProtectionGroups (..),
newListProtectionGroups,
listProtectionGroups_nextToken,
listProtectionGroups_maxResults,
ListProtectionGroupsResponse (..),
newListProtectionGroupsResponse,
listProtectionGroupsResponse_nextToken,
listProtectionGroupsResponse_httpStatus,
listProtectionGroupsResponse_protectionGroups,
)
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.Shield.Types
data ListProtectionGroups = ListProtectionGroups'
{
ListProtectionGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectionGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListProtectionGroups -> ListProtectionGroups -> Bool
(ListProtectionGroups -> ListProtectionGroups -> Bool)
-> (ListProtectionGroups -> ListProtectionGroups -> Bool)
-> Eq ListProtectionGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectionGroups -> ListProtectionGroups -> Bool
$c/= :: ListProtectionGroups -> ListProtectionGroups -> Bool
== :: ListProtectionGroups -> ListProtectionGroups -> Bool
$c== :: ListProtectionGroups -> ListProtectionGroups -> Bool
Prelude.Eq, ReadPrec [ListProtectionGroups]
ReadPrec ListProtectionGroups
Int -> ReadS ListProtectionGroups
ReadS [ListProtectionGroups]
(Int -> ReadS ListProtectionGroups)
-> ReadS [ListProtectionGroups]
-> ReadPrec ListProtectionGroups
-> ReadPrec [ListProtectionGroups]
-> Read ListProtectionGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectionGroups]
$creadListPrec :: ReadPrec [ListProtectionGroups]
readPrec :: ReadPrec ListProtectionGroups
$creadPrec :: ReadPrec ListProtectionGroups
readList :: ReadS [ListProtectionGroups]
$creadList :: ReadS [ListProtectionGroups]
readsPrec :: Int -> ReadS ListProtectionGroups
$creadsPrec :: Int -> ReadS ListProtectionGroups
Prelude.Read, Int -> ListProtectionGroups -> ShowS
[ListProtectionGroups] -> ShowS
ListProtectionGroups -> String
(Int -> ListProtectionGroups -> ShowS)
-> (ListProtectionGroups -> String)
-> ([ListProtectionGroups] -> ShowS)
-> Show ListProtectionGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectionGroups] -> ShowS
$cshowList :: [ListProtectionGroups] -> ShowS
show :: ListProtectionGroups -> String
$cshow :: ListProtectionGroups -> String
showsPrec :: Int -> ListProtectionGroups -> ShowS
$cshowsPrec :: Int -> ListProtectionGroups -> ShowS
Prelude.Show, (forall x. ListProtectionGroups -> Rep ListProtectionGroups x)
-> (forall x. Rep ListProtectionGroups x -> ListProtectionGroups)
-> Generic ListProtectionGroups
forall x. Rep ListProtectionGroups x -> ListProtectionGroups
forall x. ListProtectionGroups -> Rep ListProtectionGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtectionGroups x -> ListProtectionGroups
$cfrom :: forall x. ListProtectionGroups -> Rep ListProtectionGroups x
Prelude.Generic)
newListProtectionGroups ::
ListProtectionGroups
newListProtectionGroups :: ListProtectionGroups
newListProtectionGroups =
ListProtectionGroups' :: Maybe Text -> Maybe Natural -> ListProtectionGroups
ListProtectionGroups'
{ $sel:nextToken:ListProtectionGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProtectionGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listProtectionGroups_nextToken :: Lens.Lens' ListProtectionGroups (Prelude.Maybe Prelude.Text)
listProtectionGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtectionGroups -> f ListProtectionGroups
listProtectionGroups_nextToken = (ListProtectionGroups -> Maybe Text)
-> (ListProtectionGroups -> Maybe Text -> ListProtectionGroups)
-> Lens
ListProtectionGroups ListProtectionGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectionGroups' :: ListProtectionGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectionGroups
s@ListProtectionGroups' {} Maybe Text
a -> ListProtectionGroups
s {$sel:nextToken:ListProtectionGroups' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectionGroups)
listProtectionGroups_maxResults :: Lens.Lens' ListProtectionGroups (Prelude.Maybe Prelude.Natural)
listProtectionGroups_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProtectionGroups -> f ListProtectionGroups
listProtectionGroups_maxResults = (ListProtectionGroups -> Maybe Natural)
-> (ListProtectionGroups -> Maybe Natural -> ListProtectionGroups)
-> Lens
ListProtectionGroups
ListProtectionGroups
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProtectionGroups' :: ListProtectionGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProtectionGroups
s@ListProtectionGroups' {} Maybe Natural
a -> ListProtectionGroups
s {$sel:maxResults:ListProtectionGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProtectionGroups)
instance Core.AWSRequest ListProtectionGroups where
type
AWSResponse ListProtectionGroups =
ListProtectionGroupsResponse
request :: ListProtectionGroups -> Request ListProtectionGroups
request = Service -> ListProtectionGroups -> Request ListProtectionGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListProtectionGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectionGroups)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListProtectionGroups))
-> Logger
-> Service
-> Proxy ListProtectionGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectionGroups)))
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 -> [ProtectionGroup] -> ListProtectionGroupsResponse
ListProtectionGroupsResponse'
(Maybe Text
-> Int -> [ProtectionGroup] -> ListProtectionGroupsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [ProtectionGroup] -> ListProtectionGroupsResponse)
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 -> [ProtectionGroup] -> ListProtectionGroupsResponse)
-> Either String Int
-> Either
String ([ProtectionGroup] -> ListProtectionGroupsResponse)
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 ([ProtectionGroup] -> ListProtectionGroupsResponse)
-> Either String [ProtectionGroup]
-> Either String ListProtectionGroupsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [ProtectionGroup])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProtectionGroups"
Either String (Maybe [ProtectionGroup])
-> [ProtectionGroup] -> Either String [ProtectionGroup]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ProtectionGroup]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListProtectionGroups
instance Prelude.NFData ListProtectionGroups
instance Core.ToHeaders ListProtectionGroups where
toHeaders :: ListProtectionGroups -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListProtectionGroups -> 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
"AWSShield_20160616.ListProtectionGroups" ::
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 ListProtectionGroups where
toJSON :: ListProtectionGroups -> Value
toJSON ListProtectionGroups' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListProtectionGroups' :: ListProtectionGroups -> Maybe Natural
$sel:nextToken:ListProtectionGroups' :: ListProtectionGroups -> 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 ListProtectionGroups where
toPath :: ListProtectionGroups -> ByteString
toPath = ByteString -> ListProtectionGroups -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListProtectionGroups where
toQuery :: ListProtectionGroups -> QueryString
toQuery = QueryString -> ListProtectionGroups -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListProtectionGroupsResponse = ListProtectionGroupsResponse'
{
ListProtectionGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectionGroupsResponse -> Int
httpStatus :: Prelude.Int,
ListProtectionGroupsResponse -> [ProtectionGroup]
protectionGroups :: [ProtectionGroup]
}
deriving (ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool
(ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool)
-> (ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool)
-> Eq ListProtectionGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool
$c/= :: ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool
== :: ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool
$c== :: ListProtectionGroupsResponse
-> ListProtectionGroupsResponse -> Bool
Prelude.Eq, ReadPrec [ListProtectionGroupsResponse]
ReadPrec ListProtectionGroupsResponse
Int -> ReadS ListProtectionGroupsResponse
ReadS [ListProtectionGroupsResponse]
(Int -> ReadS ListProtectionGroupsResponse)
-> ReadS [ListProtectionGroupsResponse]
-> ReadPrec ListProtectionGroupsResponse
-> ReadPrec [ListProtectionGroupsResponse]
-> Read ListProtectionGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectionGroupsResponse]
$creadListPrec :: ReadPrec [ListProtectionGroupsResponse]
readPrec :: ReadPrec ListProtectionGroupsResponse
$creadPrec :: ReadPrec ListProtectionGroupsResponse
readList :: ReadS [ListProtectionGroupsResponse]
$creadList :: ReadS [ListProtectionGroupsResponse]
readsPrec :: Int -> ReadS ListProtectionGroupsResponse
$creadsPrec :: Int -> ReadS ListProtectionGroupsResponse
Prelude.Read, Int -> ListProtectionGroupsResponse -> ShowS
[ListProtectionGroupsResponse] -> ShowS
ListProtectionGroupsResponse -> String
(Int -> ListProtectionGroupsResponse -> ShowS)
-> (ListProtectionGroupsResponse -> String)
-> ([ListProtectionGroupsResponse] -> ShowS)
-> Show ListProtectionGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectionGroupsResponse] -> ShowS
$cshowList :: [ListProtectionGroupsResponse] -> ShowS
show :: ListProtectionGroupsResponse -> String
$cshow :: ListProtectionGroupsResponse -> String
showsPrec :: Int -> ListProtectionGroupsResponse -> ShowS
$cshowsPrec :: Int -> ListProtectionGroupsResponse -> ShowS
Prelude.Show, (forall x.
ListProtectionGroupsResponse -> Rep ListProtectionGroupsResponse x)
-> (forall x.
Rep ListProtectionGroupsResponse x -> ListProtectionGroupsResponse)
-> Generic ListProtectionGroupsResponse
forall x.
Rep ListProtectionGroupsResponse x -> ListProtectionGroupsResponse
forall x.
ListProtectionGroupsResponse -> Rep ListProtectionGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProtectionGroupsResponse x -> ListProtectionGroupsResponse
$cfrom :: forall x.
ListProtectionGroupsResponse -> Rep ListProtectionGroupsResponse x
Prelude.Generic)
newListProtectionGroupsResponse ::
Prelude.Int ->
ListProtectionGroupsResponse
newListProtectionGroupsResponse :: Int -> ListProtectionGroupsResponse
newListProtectionGroupsResponse Int
pHttpStatus_ =
ListProtectionGroupsResponse' :: Maybe Text
-> Int -> [ProtectionGroup] -> ListProtectionGroupsResponse
ListProtectionGroupsResponse'
{ $sel:nextToken:ListProtectionGroupsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProtectionGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:protectionGroups:ListProtectionGroupsResponse' :: [ProtectionGroup]
protectionGroups = [ProtectionGroup]
forall a. Monoid a => a
Prelude.mempty
}
listProtectionGroupsResponse_nextToken :: Lens.Lens' ListProtectionGroupsResponse (Prelude.Maybe Prelude.Text)
listProtectionGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtectionGroupsResponse -> f ListProtectionGroupsResponse
listProtectionGroupsResponse_nextToken = (ListProtectionGroupsResponse -> Maybe Text)
-> (ListProtectionGroupsResponse
-> Maybe Text -> ListProtectionGroupsResponse)
-> Lens
ListProtectionGroupsResponse
ListProtectionGroupsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectionGroupsResponse
s@ListProtectionGroupsResponse' {} Maybe Text
a -> ListProtectionGroupsResponse
s {$sel:nextToken:ListProtectionGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectionGroupsResponse)
listProtectionGroupsResponse_httpStatus :: Lens.Lens' ListProtectionGroupsResponse Prelude.Int
listProtectionGroupsResponse_httpStatus :: (Int -> f Int)
-> ListProtectionGroupsResponse -> f ListProtectionGroupsResponse
listProtectionGroupsResponse_httpStatus = (ListProtectionGroupsResponse -> Int)
-> (ListProtectionGroupsResponse
-> Int -> ListProtectionGroupsResponse)
-> Lens
ListProtectionGroupsResponse ListProtectionGroupsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroupsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProtectionGroupsResponse
s@ListProtectionGroupsResponse' {} Int
a -> ListProtectionGroupsResponse
s {$sel:httpStatus:ListProtectionGroupsResponse' :: Int
httpStatus = Int
a} :: ListProtectionGroupsResponse)
listProtectionGroupsResponse_protectionGroups :: Lens.Lens' ListProtectionGroupsResponse [ProtectionGroup]
listProtectionGroupsResponse_protectionGroups :: ([ProtectionGroup] -> f [ProtectionGroup])
-> ListProtectionGroupsResponse -> f ListProtectionGroupsResponse
listProtectionGroupsResponse_protectionGroups = (ListProtectionGroupsResponse -> [ProtectionGroup])
-> (ListProtectionGroupsResponse
-> [ProtectionGroup] -> ListProtectionGroupsResponse)
-> Lens
ListProtectionGroupsResponse
ListProtectionGroupsResponse
[ProtectionGroup]
[ProtectionGroup]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroupsResponse' {[ProtectionGroup]
protectionGroups :: [ProtectionGroup]
$sel:protectionGroups:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> [ProtectionGroup]
protectionGroups} -> [ProtectionGroup]
protectionGroups) (\s :: ListProtectionGroupsResponse
s@ListProtectionGroupsResponse' {} [ProtectionGroup]
a -> ListProtectionGroupsResponse
s {$sel:protectionGroups:ListProtectionGroupsResponse' :: [ProtectionGroup]
protectionGroups = [ProtectionGroup]
a} :: ListProtectionGroupsResponse) (([ProtectionGroup] -> f [ProtectionGroup])
-> ListProtectionGroupsResponse -> f ListProtectionGroupsResponse)
-> (([ProtectionGroup] -> f [ProtectionGroup])
-> [ProtectionGroup] -> f [ProtectionGroup])
-> ([ProtectionGroup] -> f [ProtectionGroup])
-> ListProtectionGroupsResponse
-> f ListProtectionGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProtectionGroup] -> f [ProtectionGroup])
-> [ProtectionGroup] -> f [ProtectionGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListProtectionGroupsResponse