{-# 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.Backup.ListProtectedResources
(
ListProtectedResources (..),
newListProtectedResources,
listProtectedResources_maxResults,
listProtectedResources_nextToken,
ListProtectedResourcesResponse (..),
newListProtectedResourcesResponse,
listProtectedResourcesResponse_nextToken,
listProtectedResourcesResponse_results,
listProtectedResourcesResponse_httpStatus,
)
where
import Amazonka.Backup.Types
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
data ListProtectedResources = ListProtectedResources'
{
ListProtectedResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProtectedResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListProtectedResources -> ListProtectedResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectedResources -> ListProtectedResources -> Bool
$c/= :: ListProtectedResources -> ListProtectedResources -> Bool
== :: ListProtectedResources -> ListProtectedResources -> Bool
$c== :: ListProtectedResources -> ListProtectedResources -> Bool
Prelude.Eq, ReadPrec [ListProtectedResources]
ReadPrec ListProtectedResources
Int -> ReadS ListProtectedResources
ReadS [ListProtectedResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectedResources]
$creadListPrec :: ReadPrec [ListProtectedResources]
readPrec :: ReadPrec ListProtectedResources
$creadPrec :: ReadPrec ListProtectedResources
readList :: ReadS [ListProtectedResources]
$creadList :: ReadS [ListProtectedResources]
readsPrec :: Int -> ReadS ListProtectedResources
$creadsPrec :: Int -> ReadS ListProtectedResources
Prelude.Read, Int -> ListProtectedResources -> ShowS
[ListProtectedResources] -> ShowS
ListProtectedResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectedResources] -> ShowS
$cshowList :: [ListProtectedResources] -> ShowS
show :: ListProtectedResources -> String
$cshow :: ListProtectedResources -> String
showsPrec :: Int -> ListProtectedResources -> ShowS
$cshowsPrec :: Int -> ListProtectedResources -> ShowS
Prelude.Show, forall x. Rep ListProtectedResources x -> ListProtectedResources
forall x. ListProtectedResources -> Rep ListProtectedResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtectedResources x -> ListProtectedResources
$cfrom :: forall x. ListProtectedResources -> Rep ListProtectedResources x
Prelude.Generic)
newListProtectedResources ::
ListProtectedResources
newListProtectedResources :: ListProtectedResources
newListProtectedResources =
ListProtectedResources'
{ $sel:maxResults:ListProtectedResources' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProtectedResources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listProtectedResources_maxResults :: Lens.Lens' ListProtectedResources (Prelude.Maybe Prelude.Natural)
listProtectedResources_maxResults :: Lens' ListProtectedResources (Maybe Natural)
listProtectedResources_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectedResources' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProtectedResources' :: ListProtectedResources -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProtectedResources
s@ListProtectedResources' {} Maybe Natural
a -> ListProtectedResources
s {$sel:maxResults:ListProtectedResources' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProtectedResources)
listProtectedResources_nextToken :: Lens.Lens' ListProtectedResources (Prelude.Maybe Prelude.Text)
listProtectedResources_nextToken :: Lens' ListProtectedResources (Maybe Text)
listProtectedResources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectedResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectedResources' :: ListProtectedResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectedResources
s@ListProtectedResources' {} Maybe Text
a -> ListProtectedResources
s {$sel:nextToken:ListProtectedResources' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectedResources)
instance Core.AWSPager ListProtectedResources where
page :: ListProtectedResources
-> AWSResponse ListProtectedResources
-> Maybe ListProtectedResources
page ListProtectedResources
rq AWSResponse ListProtectedResources
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListProtectedResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectedResourcesResponse (Maybe Text)
listProtectedResourcesResponse_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 ListProtectedResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectedResourcesResponse (Maybe [ProtectedResource])
listProtectedResourcesResponse_results
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.$ ListProtectedResources
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListProtectedResources (Maybe Text)
listProtectedResources_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProtectedResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListProtectedResourcesResponse (Maybe Text)
listProtectedResourcesResponse_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 ListProtectedResources where
type
AWSResponse ListProtectedResources =
ListProtectedResourcesResponse
request :: (Service -> Service)
-> ListProtectedResources -> Request ListProtectedResources
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListProtectedResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectedResources)))
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 [ProtectedResource]
-> Int
-> ListProtectedResourcesResponse
ListProtectedResourcesResponse'
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
"Results" 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 ListProtectedResources where
hashWithSalt :: Int -> ListProtectedResources -> Int
hashWithSalt Int
_salt ListProtectedResources' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProtectedResources' :: ListProtectedResources -> Maybe Text
$sel:maxResults:ListProtectedResources' :: ListProtectedResources -> 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
instance Prelude.NFData ListProtectedResources where
rnf :: ListProtectedResources -> ()
rnf ListProtectedResources' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProtectedResources' :: ListProtectedResources -> Maybe Text
$sel:maxResults:ListProtectedResources' :: ListProtectedResources -> 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
instance Data.ToHeaders ListProtectedResources where
toHeaders :: ListProtectedResources -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListProtectedResources where
toPath :: ListProtectedResources -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/resources/"
instance Data.ToQuery ListProtectedResources where
toQuery :: ListProtectedResources -> QueryString
toQuery ListProtectedResources' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListProtectedResources' :: ListProtectedResources -> Maybe Text
$sel:maxResults:ListProtectedResources' :: ListProtectedResources -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListProtectedResourcesResponse = ListProtectedResourcesResponse'
{
ListProtectedResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectedResourcesResponse -> Maybe [ProtectedResource]
results :: Prelude.Maybe [ProtectedResource],
ListProtectedResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
$c/= :: ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
== :: ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
$c== :: ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListProtectedResourcesResponse]
ReadPrec ListProtectedResourcesResponse
Int -> ReadS ListProtectedResourcesResponse
ReadS [ListProtectedResourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectedResourcesResponse]
$creadListPrec :: ReadPrec [ListProtectedResourcesResponse]
readPrec :: ReadPrec ListProtectedResourcesResponse
$creadPrec :: ReadPrec ListProtectedResourcesResponse
readList :: ReadS [ListProtectedResourcesResponse]
$creadList :: ReadS [ListProtectedResourcesResponse]
readsPrec :: Int -> ReadS ListProtectedResourcesResponse
$creadsPrec :: Int -> ReadS ListProtectedResourcesResponse
Prelude.Read, Int -> ListProtectedResourcesResponse -> ShowS
[ListProtectedResourcesResponse] -> ShowS
ListProtectedResourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectedResourcesResponse] -> ShowS
$cshowList :: [ListProtectedResourcesResponse] -> ShowS
show :: ListProtectedResourcesResponse -> String
$cshow :: ListProtectedResourcesResponse -> String
showsPrec :: Int -> ListProtectedResourcesResponse -> ShowS
$cshowsPrec :: Int -> ListProtectedResourcesResponse -> ShowS
Prelude.Show, forall x.
Rep ListProtectedResourcesResponse x
-> ListProtectedResourcesResponse
forall x.
ListProtectedResourcesResponse
-> Rep ListProtectedResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProtectedResourcesResponse x
-> ListProtectedResourcesResponse
$cfrom :: forall x.
ListProtectedResourcesResponse
-> Rep ListProtectedResourcesResponse x
Prelude.Generic)
newListProtectedResourcesResponse ::
Prelude.Int ->
ListProtectedResourcesResponse
newListProtectedResourcesResponse :: Int -> ListProtectedResourcesResponse
newListProtectedResourcesResponse Int
pHttpStatus_ =
ListProtectedResourcesResponse'
{ $sel:nextToken:ListProtectedResourcesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:results:ListProtectedResourcesResponse' :: Maybe [ProtectedResource]
results = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProtectedResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProtectedResourcesResponse_nextToken :: Lens.Lens' ListProtectedResourcesResponse (Prelude.Maybe Prelude.Text)
listProtectedResourcesResponse_nextToken :: Lens' ListProtectedResourcesResponse (Maybe Text)
listProtectedResourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectedResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectedResourcesResponse
s@ListProtectedResourcesResponse' {} Maybe Text
a -> ListProtectedResourcesResponse
s {$sel:nextToken:ListProtectedResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectedResourcesResponse)
listProtectedResourcesResponse_results :: Lens.Lens' ListProtectedResourcesResponse (Prelude.Maybe [ProtectedResource])
listProtectedResourcesResponse_results :: Lens' ListProtectedResourcesResponse (Maybe [ProtectedResource])
listProtectedResourcesResponse_results = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectedResourcesResponse' {Maybe [ProtectedResource]
results :: Maybe [ProtectedResource]
$sel:results:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> Maybe [ProtectedResource]
results} -> Maybe [ProtectedResource]
results) (\s :: ListProtectedResourcesResponse
s@ListProtectedResourcesResponse' {} Maybe [ProtectedResource]
a -> ListProtectedResourcesResponse
s {$sel:results:ListProtectedResourcesResponse' :: Maybe [ProtectedResource]
results = Maybe [ProtectedResource]
a} :: ListProtectedResourcesResponse) 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
listProtectedResourcesResponse_httpStatus :: Lens.Lens' ListProtectedResourcesResponse Prelude.Int
listProtectedResourcesResponse_httpStatus :: Lens' ListProtectedResourcesResponse Int
listProtectedResourcesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectedResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProtectedResourcesResponse
s@ListProtectedResourcesResponse' {} Int
a -> ListProtectedResourcesResponse
s {$sel:httpStatus:ListProtectedResourcesResponse' :: Int
httpStatus = Int
a} :: ListProtectedResourcesResponse)
instance
Prelude.NFData
ListProtectedResourcesResponse
where
rnf :: ListProtectedResourcesResponse -> ()
rnf ListProtectedResourcesResponse' {Int
Maybe [ProtectedResource]
Maybe Text
httpStatus :: Int
results :: Maybe [ProtectedResource]
nextToken :: Maybe Text
$sel:httpStatus:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> Int
$sel:results:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> Maybe [ProtectedResource]
$sel:nextToken:ListProtectedResourcesResponse' :: ListProtectedResourcesResponse -> 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 [ProtectedResource]
results
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus