{-# 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_nextToken,
listBackupPlans_maxResults,
listBackupPlans_includeDeleted,
ListBackupPlansResponse (..),
newListBackupPlansResponse,
listBackupPlansResponse_nextToken,
listBackupPlansResponse_backupPlansList,
listBackupPlansResponse_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 ListBackupPlans = ListBackupPlans'
{
ListBackupPlans -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBackupPlans -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListBackupPlans -> Maybe Bool
includeDeleted :: Prelude.Maybe Prelude.Bool
}
deriving (ListBackupPlans -> ListBackupPlans -> Bool
(ListBackupPlans -> ListBackupPlans -> Bool)
-> (ListBackupPlans -> ListBackupPlans -> Bool)
-> Eq ListBackupPlans
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]
(Int -> ReadS ListBackupPlans)
-> ReadS [ListBackupPlans]
-> ReadPrec ListBackupPlans
-> ReadPrec [ListBackupPlans]
-> Read 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
(Int -> ListBackupPlans -> ShowS)
-> (ListBackupPlans -> String)
-> ([ListBackupPlans] -> ShowS)
-> Show ListBackupPlans
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. ListBackupPlans -> Rep ListBackupPlans x)
-> (forall x. Rep ListBackupPlans x -> ListBackupPlans)
-> Generic ListBackupPlans
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' :: Maybe Text -> Maybe Natural -> Maybe Bool -> ListBackupPlans
ListBackupPlans'
{ $sel:nextToken:ListBackupPlans' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListBackupPlans' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:includeDeleted:ListBackupPlans' :: Maybe Bool
includeDeleted = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
listBackupPlans_nextToken :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Text)
listBackupPlans_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBackupPlans -> f ListBackupPlans
listBackupPlans_nextToken = (ListBackupPlans -> Maybe Text)
-> (ListBackupPlans -> Maybe Text -> ListBackupPlans)
-> Lens ListBackupPlans ListBackupPlans (Maybe Text) (Maybe Text)
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)
listBackupPlans_maxResults :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Natural)
listBackupPlans_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListBackupPlans -> f ListBackupPlans
listBackupPlans_maxResults = (ListBackupPlans -> Maybe Natural)
-> (ListBackupPlans -> Maybe Natural -> ListBackupPlans)
-> Lens
ListBackupPlans ListBackupPlans (Maybe Natural) (Maybe Natural)
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_includeDeleted :: Lens.Lens' ListBackupPlans (Prelude.Maybe Prelude.Bool)
listBackupPlans_includeDeleted :: (Maybe Bool -> f (Maybe Bool))
-> ListBackupPlans -> f ListBackupPlans
listBackupPlans_includeDeleted = (ListBackupPlans -> Maybe Bool)
-> (ListBackupPlans -> Maybe Bool -> ListBackupPlans)
-> Lens ListBackupPlans ListBackupPlans (Maybe Bool) (Maybe Bool)
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)
instance Core.AWSRequest ListBackupPlans where
type
AWSResponse ListBackupPlans =
ListBackupPlansResponse
request :: ListBackupPlans -> Request ListBackupPlans
request = Service -> ListBackupPlans -> Request ListBackupPlans
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListBackupPlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackupPlans)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListBackupPlans))
-> Logger
-> Service
-> Proxy ListBackupPlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackupPlans)))
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 Text
-> Maybe [BackupPlansListMember] -> Int -> ListBackupPlansResponse
ListBackupPlansResponse'
(Maybe Text
-> Maybe [BackupPlansListMember] -> Int -> ListBackupPlansResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe [BackupPlansListMember] -> Int -> ListBackupPlansResponse)
forall (f :: * -> *) a b. Functor 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
(Maybe [BackupPlansListMember] -> Int -> ListBackupPlansResponse)
-> Either String (Maybe [BackupPlansListMember])
-> Either String (Int -> ListBackupPlansResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [BackupPlansListMember]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupPlansList"
Either String (Maybe (Maybe [BackupPlansListMember]))
-> Maybe [BackupPlansListMember]
-> Either String (Maybe [BackupPlansListMember])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BackupPlansListMember]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> ListBackupPlansResponse)
-> Either String Int -> Either String ListBackupPlansResponse
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 ListBackupPlans
instance Prelude.NFData ListBackupPlans
instance Core.ToHeaders ListBackupPlans where
toHeaders :: ListBackupPlans -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListBackupPlans -> 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 ListBackupPlans where
toPath :: ListBackupPlans -> ByteString
toPath = ByteString -> ListBackupPlans -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/backup/plans/"
instance Core.ToQuery ListBackupPlans where
toQuery :: ListBackupPlans -> QueryString
toQuery ListBackupPlans' {Maybe Bool
Maybe Natural
Maybe Text
includeDeleted :: Maybe Bool
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:includeDeleted:ListBackupPlans' :: ListBackupPlans -> Maybe Bool
$sel:maxResults:ListBackupPlans' :: ListBackupPlans -> Maybe Natural
$sel:nextToken:ListBackupPlans' :: ListBackupPlans -> 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,
ByteString
"includeDeleted" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeDeleted
]
data ListBackupPlansResponse = ListBackupPlansResponse'
{
ListBackupPlansResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBackupPlansResponse -> Maybe [BackupPlansListMember]
backupPlansList :: Prelude.Maybe [BackupPlansListMember],
ListBackupPlansResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListBackupPlansResponse -> ListBackupPlansResponse -> Bool
(ListBackupPlansResponse -> ListBackupPlansResponse -> Bool)
-> (ListBackupPlansResponse -> ListBackupPlansResponse -> Bool)
-> Eq ListBackupPlansResponse
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]
(Int -> ReadS ListBackupPlansResponse)
-> ReadS [ListBackupPlansResponse]
-> ReadPrec ListBackupPlansResponse
-> ReadPrec [ListBackupPlansResponse]
-> Read 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
(Int -> ListBackupPlansResponse -> ShowS)
-> (ListBackupPlansResponse -> String)
-> ([ListBackupPlansResponse] -> ShowS)
-> Show ListBackupPlansResponse
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.
ListBackupPlansResponse -> Rep ListBackupPlansResponse x)
-> (forall x.
Rep ListBackupPlansResponse x -> ListBackupPlansResponse)
-> Generic ListBackupPlansResponse
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' :: Maybe Text
-> Maybe [BackupPlansListMember] -> Int -> ListBackupPlansResponse
ListBackupPlansResponse'
{ $sel:nextToken:ListBackupPlansResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:backupPlansList:ListBackupPlansResponse' :: Maybe [BackupPlansListMember]
backupPlansList = Maybe [BackupPlansListMember]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBackupPlansResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listBackupPlansResponse_nextToken :: Lens.Lens' ListBackupPlansResponse (Prelude.Maybe Prelude.Text)
listBackupPlansResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBackupPlansResponse -> f ListBackupPlansResponse
listBackupPlansResponse_nextToken = (ListBackupPlansResponse -> Maybe Text)
-> (ListBackupPlansResponse
-> Maybe Text -> ListBackupPlansResponse)
-> Lens
ListBackupPlansResponse
ListBackupPlansResponse
(Maybe Text)
(Maybe Text)
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_backupPlansList :: Lens.Lens' ListBackupPlansResponse (Prelude.Maybe [BackupPlansListMember])
listBackupPlansResponse_backupPlansList :: (Maybe [BackupPlansListMember]
-> f (Maybe [BackupPlansListMember]))
-> ListBackupPlansResponse -> f ListBackupPlansResponse
listBackupPlansResponse_backupPlansList = (ListBackupPlansResponse -> Maybe [BackupPlansListMember])
-> (ListBackupPlansResponse
-> Maybe [BackupPlansListMember] -> ListBackupPlansResponse)
-> Lens
ListBackupPlansResponse
ListBackupPlansResponse
(Maybe [BackupPlansListMember])
(Maybe [BackupPlansListMember])
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) ((Maybe [BackupPlansListMember]
-> f (Maybe [BackupPlansListMember]))
-> ListBackupPlansResponse -> f ListBackupPlansResponse)
-> ((Maybe [BackupPlansListMember]
-> f (Maybe [BackupPlansListMember]))
-> Maybe [BackupPlansListMember]
-> f (Maybe [BackupPlansListMember]))
-> (Maybe [BackupPlansListMember]
-> f (Maybe [BackupPlansListMember]))
-> ListBackupPlansResponse
-> f ListBackupPlansResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BackupPlansListMember]
[BackupPlansListMember]
[BackupPlansListMember]
[BackupPlansListMember]
-> Iso
(Maybe [BackupPlansListMember])
(Maybe [BackupPlansListMember])
(Maybe [BackupPlansListMember])
(Maybe [BackupPlansListMember])
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
[BackupPlansListMember]
[BackupPlansListMember]
[BackupPlansListMember]
[BackupPlansListMember]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listBackupPlansResponse_httpStatus :: Lens.Lens' ListBackupPlansResponse Prelude.Int
listBackupPlansResponse_httpStatus :: (Int -> f Int)
-> ListBackupPlansResponse -> f ListBackupPlansResponse
listBackupPlansResponse_httpStatus = (ListBackupPlansResponse -> Int)
-> (ListBackupPlansResponse -> Int -> ListBackupPlansResponse)
-> Lens ListBackupPlansResponse ListBackupPlansResponse Int Int
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