{-# 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_inclusionFilters,
listProtectionGroups_maxResults,
listProtectionGroups_nextToken,
ListProtectionGroupsResponse (..),
newListProtectionGroupsResponse,
listProtectionGroupsResponse_nextToken,
listProtectionGroupsResponse_httpStatus,
listProtectionGroupsResponse_protectionGroups,
)
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Shield.Types
data ListProtectionGroups = ListProtectionGroups'
{
ListProtectionGroups -> Maybe InclusionProtectionGroupFilters
inclusionFilters :: Prelude.Maybe InclusionProtectionGroupFilters,
ListProtectionGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProtectionGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListProtectionGroups -> ListProtectionGroups -> Bool
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]
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
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. 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'
{ $sel:inclusionFilters:ListProtectionGroups' :: Maybe InclusionProtectionGroupFilters
inclusionFilters =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProtectionGroups' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProtectionGroups' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listProtectionGroups_inclusionFilters :: Lens.Lens' ListProtectionGroups (Prelude.Maybe InclusionProtectionGroupFilters)
listProtectionGroups_inclusionFilters :: Lens' ListProtectionGroups (Maybe InclusionProtectionGroupFilters)
listProtectionGroups_inclusionFilters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionGroups' {Maybe InclusionProtectionGroupFilters
inclusionFilters :: Maybe InclusionProtectionGroupFilters
$sel:inclusionFilters:ListProtectionGroups' :: ListProtectionGroups -> Maybe InclusionProtectionGroupFilters
inclusionFilters} -> Maybe InclusionProtectionGroupFilters
inclusionFilters) (\s :: ListProtectionGroups
s@ListProtectionGroups' {} Maybe InclusionProtectionGroupFilters
a -> ListProtectionGroups
s {$sel:inclusionFilters:ListProtectionGroups' :: Maybe InclusionProtectionGroupFilters
inclusionFilters = Maybe InclusionProtectionGroupFilters
a} :: ListProtectionGroups)
listProtectionGroups_maxResults :: Lens.Lens' ListProtectionGroups (Prelude.Maybe Prelude.Natural)
listProtectionGroups_maxResults :: Lens' ListProtectionGroups (Maybe Natural)
listProtectionGroups_maxResults = 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)
listProtectionGroups_nextToken :: Lens.Lens' ListProtectionGroups (Prelude.Maybe Prelude.Text)
listProtectionGroups_nextToken :: Lens' ListProtectionGroups (Maybe Text)
listProtectionGroups_nextToken = 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)
instance Core.AWSRequest ListProtectionGroups where
type
AWSResponse ListProtectionGroups =
ListProtectionGroupsResponse
request :: (Service -> Service)
-> ListProtectionGroups -> Request ListProtectionGroups
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 ListProtectionGroups
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectionGroups)))
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 -> [ProtectionGroup] -> ListProtectionGroupsResponse
ListProtectionGroupsResponse'
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
"ProtectionGroups"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ListProtectionGroups where
hashWithSalt :: Int -> ListProtectionGroups -> Int
hashWithSalt Int
_salt ListProtectionGroups' {Maybe Natural
Maybe Text
Maybe InclusionProtectionGroupFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionGroupFilters
$sel:nextToken:ListProtectionGroups' :: ListProtectionGroups -> Maybe Text
$sel:maxResults:ListProtectionGroups' :: ListProtectionGroups -> Maybe Natural
$sel:inclusionFilters:ListProtectionGroups' :: ListProtectionGroups -> Maybe InclusionProtectionGroupFilters
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InclusionProtectionGroupFilters
inclusionFilters
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 ListProtectionGroups where
rnf :: ListProtectionGroups -> ()
rnf ListProtectionGroups' {Maybe Natural
Maybe Text
Maybe InclusionProtectionGroupFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionGroupFilters
$sel:nextToken:ListProtectionGroups' :: ListProtectionGroups -> Maybe Text
$sel:maxResults:ListProtectionGroups' :: ListProtectionGroups -> Maybe Natural
$sel:inclusionFilters:ListProtectionGroups' :: ListProtectionGroups -> Maybe InclusionProtectionGroupFilters
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe InclusionProtectionGroupFilters
inclusionFilters
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ListProtectionGroups where
toHeaders :: ListProtectionGroups -> 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
"AWSShield_20160616.ListProtectionGroups" ::
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 ListProtectionGroups where
toJSON :: ListProtectionGroups -> Value
toJSON ListProtectionGroups' {Maybe Natural
Maybe Text
Maybe InclusionProtectionGroupFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionGroupFilters
$sel:nextToken:ListProtectionGroups' :: ListProtectionGroups -> Maybe Text
$sel:maxResults:ListProtectionGroups' :: ListProtectionGroups -> Maybe Natural
$sel:inclusionFilters:ListProtectionGroups' :: ListProtectionGroups -> Maybe InclusionProtectionGroupFilters
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"InclusionFilters" 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 InclusionProtectionGroupFilters
inclusionFilters,
(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 ListProtectionGroups where
toPath :: ListProtectionGroups -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListProtectionGroups where
toQuery :: ListProtectionGroups -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:nextToken:ListProtectionGroupsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProtectionGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:protectionGroups:ListProtectionGroupsResponse' :: [ProtectionGroup]
protectionGroups = forall a. Monoid a => a
Prelude.mempty
}
listProtectionGroupsResponse_nextToken :: Lens.Lens' ListProtectionGroupsResponse (Prelude.Maybe Prelude.Text)
listProtectionGroupsResponse_nextToken :: Lens' ListProtectionGroupsResponse (Maybe Text)
listProtectionGroupsResponse_nextToken = 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 :: Lens' ListProtectionGroupsResponse Int
listProtectionGroupsResponse_httpStatus = 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 :: Lens' ListProtectionGroupsResponse [ProtectionGroup]
listProtectionGroupsResponse_protectionGroups = 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) 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 ListProtectionGroupsResponse where
rnf :: ListProtectionGroupsResponse -> ()
rnf ListProtectionGroupsResponse' {Int
[ProtectionGroup]
Maybe Text
protectionGroups :: [ProtectionGroup]
httpStatus :: Int
nextToken :: Maybe Text
$sel:protectionGroups:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> [ProtectionGroup]
$sel:httpStatus:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> Int
$sel:nextToken:ListProtectionGroupsResponse' :: ListProtectionGroupsResponse -> 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 [ProtectionGroup]
protectionGroups