{-# 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.ExportBackupPlanTemplate
(
ExportBackupPlanTemplate (..),
newExportBackupPlanTemplate,
exportBackupPlanTemplate_backupPlanId,
ExportBackupPlanTemplateResponse (..),
newExportBackupPlanTemplateResponse,
exportBackupPlanTemplateResponse_backupPlanTemplateJson,
exportBackupPlanTemplateResponse_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 ExportBackupPlanTemplate = ExportBackupPlanTemplate'
{
ExportBackupPlanTemplate -> Text
backupPlanId :: Prelude.Text
}
deriving (ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool
(ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool)
-> (ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool)
-> Eq ExportBackupPlanTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool
$c/= :: ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool
== :: ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool
$c== :: ExportBackupPlanTemplate -> ExportBackupPlanTemplate -> Bool
Prelude.Eq, ReadPrec [ExportBackupPlanTemplate]
ReadPrec ExportBackupPlanTemplate
Int -> ReadS ExportBackupPlanTemplate
ReadS [ExportBackupPlanTemplate]
(Int -> ReadS ExportBackupPlanTemplate)
-> ReadS [ExportBackupPlanTemplate]
-> ReadPrec ExportBackupPlanTemplate
-> ReadPrec [ExportBackupPlanTemplate]
-> Read ExportBackupPlanTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportBackupPlanTemplate]
$creadListPrec :: ReadPrec [ExportBackupPlanTemplate]
readPrec :: ReadPrec ExportBackupPlanTemplate
$creadPrec :: ReadPrec ExportBackupPlanTemplate
readList :: ReadS [ExportBackupPlanTemplate]
$creadList :: ReadS [ExportBackupPlanTemplate]
readsPrec :: Int -> ReadS ExportBackupPlanTemplate
$creadsPrec :: Int -> ReadS ExportBackupPlanTemplate
Prelude.Read, Int -> ExportBackupPlanTemplate -> ShowS
[ExportBackupPlanTemplate] -> ShowS
ExportBackupPlanTemplate -> String
(Int -> ExportBackupPlanTemplate -> ShowS)
-> (ExportBackupPlanTemplate -> String)
-> ([ExportBackupPlanTemplate] -> ShowS)
-> Show ExportBackupPlanTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportBackupPlanTemplate] -> ShowS
$cshowList :: [ExportBackupPlanTemplate] -> ShowS
show :: ExportBackupPlanTemplate -> String
$cshow :: ExportBackupPlanTemplate -> String
showsPrec :: Int -> ExportBackupPlanTemplate -> ShowS
$cshowsPrec :: Int -> ExportBackupPlanTemplate -> ShowS
Prelude.Show, (forall x.
ExportBackupPlanTemplate -> Rep ExportBackupPlanTemplate x)
-> (forall x.
Rep ExportBackupPlanTemplate x -> ExportBackupPlanTemplate)
-> Generic ExportBackupPlanTemplate
forall x.
Rep ExportBackupPlanTemplate x -> ExportBackupPlanTemplate
forall x.
ExportBackupPlanTemplate -> Rep ExportBackupPlanTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportBackupPlanTemplate x -> ExportBackupPlanTemplate
$cfrom :: forall x.
ExportBackupPlanTemplate -> Rep ExportBackupPlanTemplate x
Prelude.Generic)
newExportBackupPlanTemplate ::
Prelude.Text ->
ExportBackupPlanTemplate
newExportBackupPlanTemplate :: Text -> ExportBackupPlanTemplate
newExportBackupPlanTemplate Text
pBackupPlanId_ =
ExportBackupPlanTemplate' :: Text -> ExportBackupPlanTemplate
ExportBackupPlanTemplate'
{ $sel:backupPlanId:ExportBackupPlanTemplate' :: Text
backupPlanId =
Text
pBackupPlanId_
}
exportBackupPlanTemplate_backupPlanId :: Lens.Lens' ExportBackupPlanTemplate Prelude.Text
exportBackupPlanTemplate_backupPlanId :: (Text -> f Text)
-> ExportBackupPlanTemplate -> f ExportBackupPlanTemplate
exportBackupPlanTemplate_backupPlanId = (ExportBackupPlanTemplate -> Text)
-> (ExportBackupPlanTemplate -> Text -> ExportBackupPlanTemplate)
-> Lens ExportBackupPlanTemplate ExportBackupPlanTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportBackupPlanTemplate' {Text
backupPlanId :: Text
$sel:backupPlanId:ExportBackupPlanTemplate' :: ExportBackupPlanTemplate -> Text
backupPlanId} -> Text
backupPlanId) (\s :: ExportBackupPlanTemplate
s@ExportBackupPlanTemplate' {} Text
a -> ExportBackupPlanTemplate
s {$sel:backupPlanId:ExportBackupPlanTemplate' :: Text
backupPlanId = Text
a} :: ExportBackupPlanTemplate)
instance Core.AWSRequest ExportBackupPlanTemplate where
type
AWSResponse ExportBackupPlanTemplate =
ExportBackupPlanTemplateResponse
request :: ExportBackupPlanTemplate -> Request ExportBackupPlanTemplate
request = Service
-> ExportBackupPlanTemplate -> Request ExportBackupPlanTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ExportBackupPlanTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ExportBackupPlanTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ExportBackupPlanTemplate))
-> Logger
-> Service
-> Proxy ExportBackupPlanTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ExportBackupPlanTemplate)))
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 -> Int -> ExportBackupPlanTemplateResponse
ExportBackupPlanTemplateResponse'
(Maybe Text -> Int -> ExportBackupPlanTemplateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ExportBackupPlanTemplateResponse)
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
"BackupPlanTemplateJson")
Either String (Int -> ExportBackupPlanTemplateResponse)
-> Either String Int
-> Either String ExportBackupPlanTemplateResponse
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 ExportBackupPlanTemplate
instance Prelude.NFData ExportBackupPlanTemplate
instance Core.ToHeaders ExportBackupPlanTemplate where
toHeaders :: ExportBackupPlanTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> ExportBackupPlanTemplate -> 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 ExportBackupPlanTemplate where
toPath :: ExportBackupPlanTemplate -> ByteString
toPath ExportBackupPlanTemplate' {Text
backupPlanId :: Text
$sel:backupPlanId:ExportBackupPlanTemplate' :: ExportBackupPlanTemplate -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/backup/plans/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backupPlanId,
ByteString
"/toTemplate/"
]
instance Core.ToQuery ExportBackupPlanTemplate where
toQuery :: ExportBackupPlanTemplate -> QueryString
toQuery = QueryString -> ExportBackupPlanTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ExportBackupPlanTemplateResponse = ExportBackupPlanTemplateResponse'
{
ExportBackupPlanTemplateResponse -> Maybe Text
backupPlanTemplateJson :: Prelude.Maybe Prelude.Text,
ExportBackupPlanTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool
(ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool)
-> (ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool)
-> Eq ExportBackupPlanTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool
$c/= :: ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool
== :: ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool
$c== :: ExportBackupPlanTemplateResponse
-> ExportBackupPlanTemplateResponse -> Bool
Prelude.Eq, ReadPrec [ExportBackupPlanTemplateResponse]
ReadPrec ExportBackupPlanTemplateResponse
Int -> ReadS ExportBackupPlanTemplateResponse
ReadS [ExportBackupPlanTemplateResponse]
(Int -> ReadS ExportBackupPlanTemplateResponse)
-> ReadS [ExportBackupPlanTemplateResponse]
-> ReadPrec ExportBackupPlanTemplateResponse
-> ReadPrec [ExportBackupPlanTemplateResponse]
-> Read ExportBackupPlanTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportBackupPlanTemplateResponse]
$creadListPrec :: ReadPrec [ExportBackupPlanTemplateResponse]
readPrec :: ReadPrec ExportBackupPlanTemplateResponse
$creadPrec :: ReadPrec ExportBackupPlanTemplateResponse
readList :: ReadS [ExportBackupPlanTemplateResponse]
$creadList :: ReadS [ExportBackupPlanTemplateResponse]
readsPrec :: Int -> ReadS ExportBackupPlanTemplateResponse
$creadsPrec :: Int -> ReadS ExportBackupPlanTemplateResponse
Prelude.Read, Int -> ExportBackupPlanTemplateResponse -> ShowS
[ExportBackupPlanTemplateResponse] -> ShowS
ExportBackupPlanTemplateResponse -> String
(Int -> ExportBackupPlanTemplateResponse -> ShowS)
-> (ExportBackupPlanTemplateResponse -> String)
-> ([ExportBackupPlanTemplateResponse] -> ShowS)
-> Show ExportBackupPlanTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportBackupPlanTemplateResponse] -> ShowS
$cshowList :: [ExportBackupPlanTemplateResponse] -> ShowS
show :: ExportBackupPlanTemplateResponse -> String
$cshow :: ExportBackupPlanTemplateResponse -> String
showsPrec :: Int -> ExportBackupPlanTemplateResponse -> ShowS
$cshowsPrec :: Int -> ExportBackupPlanTemplateResponse -> ShowS
Prelude.Show, (forall x.
ExportBackupPlanTemplateResponse
-> Rep ExportBackupPlanTemplateResponse x)
-> (forall x.
Rep ExportBackupPlanTemplateResponse x
-> ExportBackupPlanTemplateResponse)
-> Generic ExportBackupPlanTemplateResponse
forall x.
Rep ExportBackupPlanTemplateResponse x
-> ExportBackupPlanTemplateResponse
forall x.
ExportBackupPlanTemplateResponse
-> Rep ExportBackupPlanTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ExportBackupPlanTemplateResponse x
-> ExportBackupPlanTemplateResponse
$cfrom :: forall x.
ExportBackupPlanTemplateResponse
-> Rep ExportBackupPlanTemplateResponse x
Prelude.Generic)
newExportBackupPlanTemplateResponse ::
Prelude.Int ->
ExportBackupPlanTemplateResponse
newExportBackupPlanTemplateResponse :: Int -> ExportBackupPlanTemplateResponse
newExportBackupPlanTemplateResponse Int
pHttpStatus_ =
ExportBackupPlanTemplateResponse' :: Maybe Text -> Int -> ExportBackupPlanTemplateResponse
ExportBackupPlanTemplateResponse'
{ $sel:backupPlanTemplateJson:ExportBackupPlanTemplateResponse' :: Maybe Text
backupPlanTemplateJson =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ExportBackupPlanTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
exportBackupPlanTemplateResponse_backupPlanTemplateJson :: Lens.Lens' ExportBackupPlanTemplateResponse (Prelude.Maybe Prelude.Text)
exportBackupPlanTemplateResponse_backupPlanTemplateJson :: (Maybe Text -> f (Maybe Text))
-> ExportBackupPlanTemplateResponse
-> f ExportBackupPlanTemplateResponse
exportBackupPlanTemplateResponse_backupPlanTemplateJson = (ExportBackupPlanTemplateResponse -> Maybe Text)
-> (ExportBackupPlanTemplateResponse
-> Maybe Text -> ExportBackupPlanTemplateResponse)
-> Lens
ExportBackupPlanTemplateResponse
ExportBackupPlanTemplateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportBackupPlanTemplateResponse' {Maybe Text
backupPlanTemplateJson :: Maybe Text
$sel:backupPlanTemplateJson:ExportBackupPlanTemplateResponse' :: ExportBackupPlanTemplateResponse -> Maybe Text
backupPlanTemplateJson} -> Maybe Text
backupPlanTemplateJson) (\s :: ExportBackupPlanTemplateResponse
s@ExportBackupPlanTemplateResponse' {} Maybe Text
a -> ExportBackupPlanTemplateResponse
s {$sel:backupPlanTemplateJson:ExportBackupPlanTemplateResponse' :: Maybe Text
backupPlanTemplateJson = Maybe Text
a} :: ExportBackupPlanTemplateResponse)
exportBackupPlanTemplateResponse_httpStatus :: Lens.Lens' ExportBackupPlanTemplateResponse Prelude.Int
exportBackupPlanTemplateResponse_httpStatus :: (Int -> f Int)
-> ExportBackupPlanTemplateResponse
-> f ExportBackupPlanTemplateResponse
exportBackupPlanTemplateResponse_httpStatus = (ExportBackupPlanTemplateResponse -> Int)
-> (ExportBackupPlanTemplateResponse
-> Int -> ExportBackupPlanTemplateResponse)
-> Lens
ExportBackupPlanTemplateResponse
ExportBackupPlanTemplateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportBackupPlanTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:ExportBackupPlanTemplateResponse' :: ExportBackupPlanTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ExportBackupPlanTemplateResponse
s@ExportBackupPlanTemplateResponse' {} Int
a -> ExportBackupPlanTemplateResponse
s {$sel:httpStatus:ExportBackupPlanTemplateResponse' :: Int
httpStatus = Int
a} :: ExportBackupPlanTemplateResponse)
instance
Prelude.NFData
ExportBackupPlanTemplateResponse