{-# 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.ListProtections
(
ListProtections (..),
newListProtections,
listProtections_inclusionFilters,
listProtections_maxResults,
listProtections_nextToken,
ListProtectionsResponse (..),
newListProtectionsResponse,
listProtectionsResponse_nextToken,
listProtectionsResponse_protections,
listProtectionsResponse_httpStatus,
)
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 ListProtections = ListProtections'
{
ListProtections -> Maybe InclusionProtectionFilters
inclusionFilters :: Prelude.Maybe InclusionProtectionFilters,
ListProtections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProtections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListProtections -> ListProtections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtections -> ListProtections -> Bool
$c/= :: ListProtections -> ListProtections -> Bool
== :: ListProtections -> ListProtections -> Bool
$c== :: ListProtections -> ListProtections -> Bool
Prelude.Eq, ReadPrec [ListProtections]
ReadPrec ListProtections
Int -> ReadS ListProtections
ReadS [ListProtections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtections]
$creadListPrec :: ReadPrec [ListProtections]
readPrec :: ReadPrec ListProtections
$creadPrec :: ReadPrec ListProtections
readList :: ReadS [ListProtections]
$creadList :: ReadS [ListProtections]
readsPrec :: Int -> ReadS ListProtections
$creadsPrec :: Int -> ReadS ListProtections
Prelude.Read, Int -> ListProtections -> ShowS
[ListProtections] -> ShowS
ListProtections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtections] -> ShowS
$cshowList :: [ListProtections] -> ShowS
show :: ListProtections -> String
$cshow :: ListProtections -> String
showsPrec :: Int -> ListProtections -> ShowS
$cshowsPrec :: Int -> ListProtections -> ShowS
Prelude.Show, forall x. Rep ListProtections x -> ListProtections
forall x. ListProtections -> Rep ListProtections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtections x -> ListProtections
$cfrom :: forall x. ListProtections -> Rep ListProtections x
Prelude.Generic)
newListProtections ::
ListProtections
newListProtections :: ListProtections
newListProtections =
ListProtections'
{ $sel:inclusionFilters:ListProtections' :: Maybe InclusionProtectionFilters
inclusionFilters =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProtections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProtections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listProtections_inclusionFilters :: Lens.Lens' ListProtections (Prelude.Maybe InclusionProtectionFilters)
listProtections_inclusionFilters :: Lens' ListProtections (Maybe InclusionProtectionFilters)
listProtections_inclusionFilters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe InclusionProtectionFilters
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
inclusionFilters} -> Maybe InclusionProtectionFilters
inclusionFilters) (\s :: ListProtections
s@ListProtections' {} Maybe InclusionProtectionFilters
a -> ListProtections
s {$sel:inclusionFilters:ListProtections' :: Maybe InclusionProtectionFilters
inclusionFilters = Maybe InclusionProtectionFilters
a} :: ListProtections)
listProtections_maxResults :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Natural)
listProtections_maxResults :: Lens' ListProtections (Maybe Natural)
listProtections_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProtections
s@ListProtections' {} Maybe Natural
a -> ListProtections
s {$sel:maxResults:ListProtections' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProtections)
listProtections_nextToken :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Text)
listProtections_nextToken :: Lens' ListProtections (Maybe Text)
listProtections_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtections
s@ListProtections' {} Maybe Text
a -> ListProtections
s {$sel:nextToken:ListProtections' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtections)
instance Core.AWSPager ListProtections where
page :: ListProtections
-> AWSResponse ListProtections -> Maybe ListProtections
page ListProtections
rq AWSResponse ListProtections
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListProtections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_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 ListProtections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectionsResponse (Maybe [Protection])
listProtectionsResponse_protections
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.$ ListProtections
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListProtections (Maybe Text)
listProtections_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProtections
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_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 ListProtections where
type
AWSResponse ListProtections =
ListProtectionsResponse
request :: (Service -> Service) -> ListProtections -> Request ListProtections
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 ListProtections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProtections)))
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 -> Maybe [Protection] -> Int -> ListProtectionsResponse
ListProtectionsResponse'
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Protections" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListProtections where
hashWithSalt :: Int -> ListProtections -> Int
hashWithSalt Int
_salt ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InclusionProtectionFilters
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 ListProtections where
rnf :: ListProtections -> ()
rnf ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe InclusionProtectionFilters
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 ListProtections where
toHeaders :: ListProtections -> 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.ListProtections" ::
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 ListProtections where
toJSON :: ListProtections -> Value
toJSON ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
[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 InclusionProtectionFilters
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 ListProtections where
toPath :: ListProtections -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListProtections where
toQuery :: ListProtections -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListProtectionsResponse = ListProtectionsResponse'
{
ListProtectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectionsResponse -> Maybe [Protection]
protections :: Prelude.Maybe [Protection],
ListProtectionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProtectionsResponse -> ListProtectionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
$c/= :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
== :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
$c== :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
Prelude.Eq, ReadPrec [ListProtectionsResponse]
ReadPrec ListProtectionsResponse
Int -> ReadS ListProtectionsResponse
ReadS [ListProtectionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectionsResponse]
$creadListPrec :: ReadPrec [ListProtectionsResponse]
readPrec :: ReadPrec ListProtectionsResponse
$creadPrec :: ReadPrec ListProtectionsResponse
readList :: ReadS [ListProtectionsResponse]
$creadList :: ReadS [ListProtectionsResponse]
readsPrec :: Int -> ReadS ListProtectionsResponse
$creadsPrec :: Int -> ReadS ListProtectionsResponse
Prelude.Read, Int -> ListProtectionsResponse -> ShowS
[ListProtectionsResponse] -> ShowS
ListProtectionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectionsResponse] -> ShowS
$cshowList :: [ListProtectionsResponse] -> ShowS
show :: ListProtectionsResponse -> String
$cshow :: ListProtectionsResponse -> String
showsPrec :: Int -> ListProtectionsResponse -> ShowS
$cshowsPrec :: Int -> ListProtectionsResponse -> ShowS
Prelude.Show, forall x. Rep ListProtectionsResponse x -> ListProtectionsResponse
forall x. ListProtectionsResponse -> Rep ListProtectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtectionsResponse x -> ListProtectionsResponse
$cfrom :: forall x. ListProtectionsResponse -> Rep ListProtectionsResponse x
Prelude.Generic)
newListProtectionsResponse ::
Prelude.Int ->
ListProtectionsResponse
newListProtectionsResponse :: Int -> ListProtectionsResponse
newListProtectionsResponse Int
pHttpStatus_ =
ListProtectionsResponse'
{ $sel:nextToken:ListProtectionsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:protections:ListProtectionsResponse' :: Maybe [Protection]
protections = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProtectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProtectionsResponse_nextToken :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe Prelude.Text)
listProtectionsResponse_nextToken :: Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectionsResponse
s@ListProtectionsResponse' {} Maybe Text
a -> ListProtectionsResponse
s {$sel:nextToken:ListProtectionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectionsResponse)
listProtectionsResponse_protections :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe [Protection])
listProtectionsResponse_protections :: Lens' ListProtectionsResponse (Maybe [Protection])
listProtectionsResponse_protections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionsResponse' {Maybe [Protection]
protections :: Maybe [Protection]
$sel:protections:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe [Protection]
protections} -> Maybe [Protection]
protections) (\s :: ListProtectionsResponse
s@ListProtectionsResponse' {} Maybe [Protection]
a -> ListProtectionsResponse
s {$sel:protections:ListProtectionsResponse' :: Maybe [Protection]
protections = Maybe [Protection]
a} :: ListProtectionsResponse) 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
listProtectionsResponse_httpStatus :: Lens.Lens' ListProtectionsResponse Prelude.Int
listProtectionsResponse_httpStatus :: Lens' ListProtectionsResponse Int
listProtectionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProtectionsResponse' :: ListProtectionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProtectionsResponse
s@ListProtectionsResponse' {} Int
a -> ListProtectionsResponse
s {$sel:httpStatus:ListProtectionsResponse' :: Int
httpStatus = Int
a} :: ListProtectionsResponse)
instance Prelude.NFData ListProtectionsResponse where
rnf :: ListProtectionsResponse -> ()
rnf ListProtectionsResponse' {Int
Maybe [Protection]
Maybe Text
httpStatus :: Int
protections :: Maybe [Protection]
nextToken :: Maybe Text
$sel:httpStatus:ListProtectionsResponse' :: ListProtectionsResponse -> Int
$sel:protections:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe [Protection]
$sel:nextToken:ListProtectionsResponse' :: ListProtectionsResponse -> 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 Maybe [Protection]
protections
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus