{-# 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_nextToken,
listProtectedResources_maxResults,
ListProtectedResourcesResponse (..),
newListProtectedResourcesResponse,
listProtectedResourcesResponse_results,
listProtectedResourcesResponse_nextToken,
listProtectedResourcesResponse_httpStatus,
)
where
import Amazonka.Backup.Types
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
data ListProtectedResources = ListProtectedResources'
{
ListProtectedResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectedResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListProtectedResources -> ListProtectedResources -> Bool
(ListProtectedResources -> ListProtectedResources -> Bool)
-> (ListProtectedResources -> ListProtectedResources -> Bool)
-> Eq ListProtectedResources
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]
(Int -> ReadS ListProtectedResources)
-> ReadS [ListProtectedResources]
-> ReadPrec ListProtectedResources
-> ReadPrec [ListProtectedResources]
-> Read 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
(Int -> ListProtectedResources -> ShowS)
-> (ListProtectedResources -> String)
-> ([ListProtectedResources] -> ShowS)
-> Show ListProtectedResources
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. ListProtectedResources -> Rep ListProtectedResources x)
-> (forall x.
Rep ListProtectedResources x -> ListProtectedResources)
-> Generic ListProtectedResources
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' :: Maybe Text -> Maybe Natural -> ListProtectedResources
ListProtectedResources'
{ $sel:nextToken:ListProtectedResources' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProtectedResources' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listProtectedResources_nextToken :: Lens.Lens' ListProtectedResources (Prelude.Maybe Prelude.Text)
listProtectedResources_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtectedResources -> f ListProtectedResources
listProtectedResources_nextToken = (ListProtectedResources -> Maybe Text)
-> (ListProtectedResources -> Maybe Text -> ListProtectedResources)
-> Lens
ListProtectedResources
ListProtectedResources
(Maybe Text)
(Maybe Text)
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)
listProtectedResources_maxResults :: Lens.Lens' ListProtectedResources (Prelude.Maybe Prelude.Natural)
listProtectedResources_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProtectedResources -> f ListProtectedResources
listProtectedResources_maxResults = (ListProtectedResources -> Maybe Natural)
-> (ListProtectedResources
-> Maybe Natural -> ListProtectedResources)
-> Lens
ListProtectedResources
ListProtectedResources
(Maybe Natural)
(Maybe Natural)
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)
instance Core.AWSRequest ListProtectedResources where
type
AWSResponse ListProtectedResources =
ListProtectedResourcesResponse
request :: ListProtectedResources -> Request ListProtectedResources
request = Service -> ListProtectedResources -> Request ListProtectedResources
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListProtectedResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectedResources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListProtectedResources))
-> Logger
-> Service
-> Proxy ListProtectedResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProtectedResources)))
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 [ProtectedResource]
-> Maybe Text -> Int -> ListProtectedResourcesResponse
ListProtectedResourcesResponse'
(Maybe [ProtectedResource]
-> Maybe Text -> Int -> ListProtectedResourcesResponse)
-> Either String (Maybe [ProtectedResource])
-> Either
String (Maybe Text -> Int -> ListProtectedResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ProtectedResource]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Results" Either String (Maybe (Maybe [ProtectedResource]))
-> Maybe [ProtectedResource]
-> Either String (Maybe [ProtectedResource])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProtectedResource]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListProtectedResourcesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListProtectedResourcesResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListProtectedResourcesResponse)
-> Either String Int
-> Either String ListProtectedResourcesResponse
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))
)
instance Prelude.Hashable ListProtectedResources
instance Prelude.NFData ListProtectedResources
instance Core.ToHeaders ListProtectedResources where
toHeaders :: ListProtectedResources -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListProtectedResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListProtectedResources where
toPath :: ListProtectedResources -> ByteString
toPath = ByteString -> ListProtectedResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/resources/"
instance Core.ToQuery ListProtectedResources where
toQuery :: ListProtectedResources -> QueryString
toQuery ListProtectedResources' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListProtectedResources' :: ListProtectedResources -> Maybe Natural
$sel:nextToken:ListProtectedResources' :: ListProtectedResources -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListProtectedResourcesResponse = ListProtectedResourcesResponse'
{
ListProtectedResourcesResponse -> Maybe [ProtectedResource]
results :: Prelude.Maybe [ProtectedResource],
ListProtectedResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProtectedResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool
(ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool)
-> (ListProtectedResourcesResponse
-> ListProtectedResourcesResponse -> Bool)
-> Eq ListProtectedResourcesResponse
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]
(Int -> ReadS ListProtectedResourcesResponse)
-> ReadS [ListProtectedResourcesResponse]
-> ReadPrec ListProtectedResourcesResponse
-> ReadPrec [ListProtectedResourcesResponse]
-> Read 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
(Int -> ListProtectedResourcesResponse -> ShowS)
-> (ListProtectedResourcesResponse -> String)
-> ([ListProtectedResourcesResponse] -> ShowS)
-> Show ListProtectedResourcesResponse
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.
ListProtectedResourcesResponse
-> Rep ListProtectedResourcesResponse x)
-> (forall x.
Rep ListProtectedResourcesResponse x
-> ListProtectedResourcesResponse)
-> Generic ListProtectedResourcesResponse
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' :: Maybe [ProtectedResource]
-> Maybe Text -> Int -> ListProtectedResourcesResponse
ListProtectedResourcesResponse'
{ $sel:results:ListProtectedResourcesResponse' :: Maybe [ProtectedResource]
results =
Maybe [ProtectedResource]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProtectedResourcesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProtectedResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProtectedResourcesResponse_results :: Lens.Lens' ListProtectedResourcesResponse (Prelude.Maybe [ProtectedResource])
listProtectedResourcesResponse_results :: (Maybe [ProtectedResource] -> f (Maybe [ProtectedResource]))
-> ListProtectedResourcesResponse
-> f ListProtectedResourcesResponse
listProtectedResourcesResponse_results = (ListProtectedResourcesResponse -> Maybe [ProtectedResource])
-> (ListProtectedResourcesResponse
-> Maybe [ProtectedResource] -> ListProtectedResourcesResponse)
-> Lens
ListProtectedResourcesResponse
ListProtectedResourcesResponse
(Maybe [ProtectedResource])
(Maybe [ProtectedResource])
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) ((Maybe [ProtectedResource] -> f (Maybe [ProtectedResource]))
-> ListProtectedResourcesResponse
-> f ListProtectedResourcesResponse)
-> ((Maybe [ProtectedResource] -> f (Maybe [ProtectedResource]))
-> Maybe [ProtectedResource] -> f (Maybe [ProtectedResource]))
-> (Maybe [ProtectedResource] -> f (Maybe [ProtectedResource]))
-> ListProtectedResourcesResponse
-> f ListProtectedResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ProtectedResource]
[ProtectedResource]
[ProtectedResource]
[ProtectedResource]
-> Iso
(Maybe [ProtectedResource])
(Maybe [ProtectedResource])
(Maybe [ProtectedResource])
(Maybe [ProtectedResource])
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 AnIso
[ProtectedResource]
[ProtectedResource]
[ProtectedResource]
[ProtectedResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listProtectedResourcesResponse_nextToken :: Lens.Lens' ListProtectedResourcesResponse (Prelude.Maybe Prelude.Text)
listProtectedResourcesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtectedResourcesResponse
-> f ListProtectedResourcesResponse
listProtectedResourcesResponse_nextToken = (ListProtectedResourcesResponse -> Maybe Text)
-> (ListProtectedResourcesResponse
-> Maybe Text -> ListProtectedResourcesResponse)
-> Lens
ListProtectedResourcesResponse
ListProtectedResourcesResponse
(Maybe Text)
(Maybe Text)
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_httpStatus :: Lens.Lens' ListProtectedResourcesResponse Prelude.Int
listProtectedResourcesResponse_httpStatus :: (Int -> f Int)
-> ListProtectedResourcesResponse
-> f ListProtectedResourcesResponse
listProtectedResourcesResponse_httpStatus = (ListProtectedResourcesResponse -> Int)
-> (ListProtectedResourcesResponse
-> Int -> ListProtectedResourcesResponse)
-> Lens
ListProtectedResourcesResponse
ListProtectedResourcesResponse
Int
Int
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