{-# 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.ListBackupPlans
(
ListBackupPlans (..),
newListBackupPlans,
listBackupPlans_includeDeleted,
listBackupPlans_maxResults,
listBackupPlans_nextToken,
ListBackupPlansResponse (..),
newListBackupPlansResponse,
listBackupPlansResponse_backupPlansList,
listBackupPlansResponse_nextToken,
listBackupPlansResponse_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 ListBackupPlans = ListBackupPlans'
{
ListBackupPlans -> Maybe Bool
includeDeleted :: Prelude.Maybe Prelude.Bool,
ListBackupPlans -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListBackupPlans -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListBackupPlans -> ListBackupPlans -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackupPlans -> ListBackupPlans -> Bool
$c/= :: ListBackupPlans -> ListBackupPlans -> Bool
== :: ListBackupPlans -> ListBackupPlans -> Bool
$c== :: ListBackupPlans -> ListBackupPlans -> Bool
Prelude.Eq, ReadPrec [ListBackupPlans]
ReadPrec ListBackupPlans
Int -> ReadS ListBackupPlans
ReadS [ListBackupPlans]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackupPlans]
$creadListPrec :: ReadPrec [ListBackupPlans]
readPrec :: ReadPrec ListBackupPlans
$creadPrec :: ReadPrec ListBackupPlans
readList :: ReadS [ListBackupPlans]
$creadList :: ReadS [ListBackupPlans]
readsPrec :: Int -> ReadS ListBackupPlans
$creadsPrec :: Int -> ReadS ListBackupPlans
Prelude.Read, Int -> ListBackupPlans -> ShowS
[ListBackupPlans] -> ShowS
ListBackupPlans -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackupPlans] -> ShowS
$cshowList :: [ListBackupPlans] -> ShowS
show :: ListBackupPlans -> String
$cshow :: ListBackupPlans -> String
showsPrec :: Int -> ListBackupPlans -> ShowS
$cshowsPrec :: Int -> ListBackupPlans -> ShowS
Prelude.Show, forall x. Rep ListBackupPlans x -> ListBackupPlans
forall x. ListBackupPlans -> Rep ListBackupPlans x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackupPlans x -> ListBackupPlans
$cfrom :: forall x. ListBackupPlans -> Rep ListBackupPlans x
Prelude.Generic)
newListBackupPlans ::
ListBackupPlans
newListBackupPlans :: ListBackupPlans
newListBackupPlans =
ListBackupPlans'
{ $sel:includeDeleted:ListBackupPlans' :: Maybe Bool
includeDeleted = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListBackupPlans' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBackupPlans' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listBackupPlans_includeDeleted :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Bool)
listBackupPlans_includeDeleted :: Lens' ListBackupPlans (Maybe Bool)
listBackupPlans_includeDeleted = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlans' {Maybe Bool
includeDeleted :: Maybe Bool
$sel:includeDeleted:ListBackupPlans' :: ListBackupPlans -> Maybe Bool
includeDeleted} -> Maybe Bool
includeDeleted) (\s :: ListBackupPlans
s@ListBackupPlans' {} Maybe Bool
a -> ListBackupPlans
s {$sel:includeDeleted:ListBackupPlans' :: Maybe Bool
includeDeleted = Maybe Bool
a} :: ListBackupPlans)
listBackupPlans_maxResults :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Natural)
listBackupPlans_maxResults :: Lens' ListBackupPlans (Maybe Natural)
listBackupPlans_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlans' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBackupPlans' :: ListBackupPlans -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBackupPlans
s@ListBackupPlans' {} Maybe Natural
a -> ListBackupPlans
s {$sel:maxResults:ListBackupPlans' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBackupPlans)
listBackupPlans_nextToken :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Text)
listBackupPlans_nextToken :: Lens' ListBackupPlans (Maybe Text)
listBackupPlans_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlans' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBackupPlans' :: ListBackupPlans -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBackupPlans
s@ListBackupPlans' {} Maybe Text
a -> ListBackupPlans
s {$sel:nextToken:ListBackupPlans' :: Maybe Text
nextToken = Maybe Text
a} :: ListBackupPlans)
instance Core.AWSPager ListBackupPlans where
page :: ListBackupPlans
-> AWSResponse ListBackupPlans -> Maybe ListBackupPlans
page ListBackupPlans
rq AWSResponse ListBackupPlans
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBackupPlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBackupPlansResponse (Maybe Text)
listBackupPlansResponse_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 ListBackupPlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBackupPlansResponse (Maybe [BackupPlansListMember])
listBackupPlansResponse_backupPlansList
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.$ ListBackupPlans
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListBackupPlans (Maybe Text)
listBackupPlans_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBackupPlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBackupPlansResponse (Maybe Text)
listBackupPlansResponse_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 ListBackupPlans where
type
AWSResponse ListBackupPlans =
ListBackupPlansResponse
request :: (Service -> Service) -> ListBackupPlans -> Request ListBackupPlans
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 ListBackupPlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackupPlans)))
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 [BackupPlansListMember]
-> Maybe Text -> Int -> ListBackupPlansResponse
ListBackupPlansResponse'
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
"BackupPlansList"
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.<*> (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))
)
instance Prelude.Hashable ListBackupPlans where
hashWithSalt :: Int -> ListBackupPlans -> Int
hashWithSalt Int
_salt ListBackupPlans' {Maybe Bool
Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeDeleted :: Maybe Bool
$sel:nextToken:ListBackupPlans' :: ListBackupPlans -> Maybe Text
$sel:maxResults:ListBackupPlans' :: ListBackupPlans -> Maybe Natural
$sel:includeDeleted:ListBackupPlans' :: ListBackupPlans -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
includeDeleted
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 ListBackupPlans where
rnf :: ListBackupPlans -> ()
rnf ListBackupPlans' {Maybe Bool
Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeDeleted :: Maybe Bool
$sel:nextToken:ListBackupPlans' :: ListBackupPlans -> Maybe Text
$sel:maxResults:ListBackupPlans' :: ListBackupPlans -> Maybe Natural
$sel:includeDeleted:ListBackupPlans' :: ListBackupPlans -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
includeDeleted
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 ListBackupPlans where
toHeaders :: ListBackupPlans -> 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 ListBackupPlans where
toPath :: ListBackupPlans -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/backup/plans/"
instance Data.ToQuery ListBackupPlans where
toQuery :: ListBackupPlans -> QueryString
toQuery ListBackupPlans' {Maybe Bool
Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
includeDeleted :: Maybe Bool
$sel:nextToken:ListBackupPlans' :: ListBackupPlans -> Maybe Text
$sel:maxResults:ListBackupPlans' :: ListBackupPlans -> Maybe Natural
$sel:includeDeleted:ListBackupPlans' :: ListBackupPlans -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"includeDeleted" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
includeDeleted,
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 ListBackupPlansResponse = ListBackupPlansResponse'
{
ListBackupPlansResponse -> Maybe [BackupPlansListMember]
backupPlansList :: Prelude.Maybe [BackupPlansListMember],
ListBackupPlansResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBackupPlansResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
$c/= :: ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
== :: ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
$c== :: ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
Prelude.Eq, ReadPrec [ListBackupPlansResponse]
ReadPrec ListBackupPlansResponse
Int -> ReadS ListBackupPlansResponse
ReadS [ListBackupPlansResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackupPlansResponse]
$creadListPrec :: ReadPrec [ListBackupPlansResponse]
readPrec :: ReadPrec ListBackupPlansResponse
$creadPrec :: ReadPrec ListBackupPlansResponse
readList :: ReadS [ListBackupPlansResponse]
$creadList :: ReadS [ListBackupPlansResponse]
readsPrec :: Int -> ReadS ListBackupPlansResponse
$creadsPrec :: Int -> ReadS ListBackupPlansResponse
Prelude.Read, Int -> ListBackupPlansResponse -> ShowS
[ListBackupPlansResponse] -> ShowS
ListBackupPlansResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackupPlansResponse] -> ShowS
$cshowList :: [ListBackupPlansResponse] -> ShowS
show :: ListBackupPlansResponse -> String
$cshow :: ListBackupPlansResponse -> String
showsPrec :: Int -> ListBackupPlansResponse -> ShowS
$cshowsPrec :: Int -> ListBackupPlansResponse -> ShowS
Prelude.Show, forall x. Rep ListBackupPlansResponse x -> ListBackupPlansResponse
forall x. ListBackupPlansResponse -> Rep ListBackupPlansResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackupPlansResponse x -> ListBackupPlansResponse
$cfrom :: forall x. ListBackupPlansResponse -> Rep ListBackupPlansResponse x
Prelude.Generic)
newListBackupPlansResponse ::
Prelude.Int ->
ListBackupPlansResponse
newListBackupPlansResponse :: Int -> ListBackupPlansResponse
newListBackupPlansResponse Int
pHttpStatus_ =
ListBackupPlansResponse'
{ $sel:backupPlansList:ListBackupPlansResponse' :: Maybe [BackupPlansListMember]
backupPlansList =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBackupPlansResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBackupPlansResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listBackupPlansResponse_backupPlansList :: Lens.Lens' ListBackupPlansResponse (Prelude.Maybe [BackupPlansListMember])
listBackupPlansResponse_backupPlansList :: Lens' ListBackupPlansResponse (Maybe [BackupPlansListMember])
listBackupPlansResponse_backupPlansList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlansResponse' {Maybe [BackupPlansListMember]
backupPlansList :: Maybe [BackupPlansListMember]
$sel:backupPlansList:ListBackupPlansResponse' :: ListBackupPlansResponse -> Maybe [BackupPlansListMember]
backupPlansList} -> Maybe [BackupPlansListMember]
backupPlansList) (\s :: ListBackupPlansResponse
s@ListBackupPlansResponse' {} Maybe [BackupPlansListMember]
a -> ListBackupPlansResponse
s {$sel:backupPlansList:ListBackupPlansResponse' :: Maybe [BackupPlansListMember]
backupPlansList = Maybe [BackupPlansListMember]
a} :: ListBackupPlansResponse) 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
listBackupPlansResponse_nextToken :: Lens.Lens' ListBackupPlansResponse (Prelude.Maybe Prelude.Text)
listBackupPlansResponse_nextToken :: Lens' ListBackupPlansResponse (Maybe Text)
listBackupPlansResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlansResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBackupPlansResponse' :: ListBackupPlansResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBackupPlansResponse
s@ListBackupPlansResponse' {} Maybe Text
a -> ListBackupPlansResponse
s {$sel:nextToken:ListBackupPlansResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBackupPlansResponse)
listBackupPlansResponse_httpStatus :: Lens.Lens' ListBackupPlansResponse Prelude.Int
listBackupPlansResponse_httpStatus :: Lens' ListBackupPlansResponse Int
listBackupPlansResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupPlansResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListBackupPlansResponse' :: ListBackupPlansResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListBackupPlansResponse
s@ListBackupPlansResponse' {} Int
a -> ListBackupPlansResponse
s {$sel:httpStatus:ListBackupPlansResponse' :: Int
httpStatus = Int
a} :: ListBackupPlansResponse)
instance Prelude.NFData ListBackupPlansResponse where
rnf :: ListBackupPlansResponse -> ()
rnf ListBackupPlansResponse' {Int
Maybe [BackupPlansListMember]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
backupPlansList :: Maybe [BackupPlansListMember]
$sel:httpStatus:ListBackupPlansResponse' :: ListBackupPlansResponse -> Int
$sel:nextToken:ListBackupPlansResponse' :: ListBackupPlansResponse -> Maybe Text
$sel:backupPlansList:ListBackupPlansResponse' :: ListBackupPlansResponse -> Maybe [BackupPlansListMember]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [BackupPlansListMember]
backupPlansList
seq :: forall a b. a -> b -> b
`Prelude.seq` 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