{-# 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.GetBackupPlanFromJSON
(
GetBackupPlanFromJSON (..),
newGetBackupPlanFromJSON,
getBackupPlanFromJSON_backupPlanTemplateJson,
GetBackupPlanFromJSONResponse (..),
newGetBackupPlanFromJSONResponse,
getBackupPlanFromJSONResponse_backupPlan,
getBackupPlanFromJSONResponse_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 GetBackupPlanFromJSON = GetBackupPlanFromJSON'
{
GetBackupPlanFromJSON -> Text
backupPlanTemplateJson :: Prelude.Text
}
deriving (GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
(GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool)
-> (GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool)
-> Eq GetBackupPlanFromJSON
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
$c/= :: GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
== :: GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
$c== :: GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
Prelude.Eq, ReadPrec [GetBackupPlanFromJSON]
ReadPrec GetBackupPlanFromJSON
Int -> ReadS GetBackupPlanFromJSON
ReadS [GetBackupPlanFromJSON]
(Int -> ReadS GetBackupPlanFromJSON)
-> ReadS [GetBackupPlanFromJSON]
-> ReadPrec GetBackupPlanFromJSON
-> ReadPrec [GetBackupPlanFromJSON]
-> Read GetBackupPlanFromJSON
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackupPlanFromJSON]
$creadListPrec :: ReadPrec [GetBackupPlanFromJSON]
readPrec :: ReadPrec GetBackupPlanFromJSON
$creadPrec :: ReadPrec GetBackupPlanFromJSON
readList :: ReadS [GetBackupPlanFromJSON]
$creadList :: ReadS [GetBackupPlanFromJSON]
readsPrec :: Int -> ReadS GetBackupPlanFromJSON
$creadsPrec :: Int -> ReadS GetBackupPlanFromJSON
Prelude.Read, Int -> GetBackupPlanFromJSON -> ShowS
[GetBackupPlanFromJSON] -> ShowS
GetBackupPlanFromJSON -> String
(Int -> GetBackupPlanFromJSON -> ShowS)
-> (GetBackupPlanFromJSON -> String)
-> ([GetBackupPlanFromJSON] -> ShowS)
-> Show GetBackupPlanFromJSON
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackupPlanFromJSON] -> ShowS
$cshowList :: [GetBackupPlanFromJSON] -> ShowS
show :: GetBackupPlanFromJSON -> String
$cshow :: GetBackupPlanFromJSON -> String
showsPrec :: Int -> GetBackupPlanFromJSON -> ShowS
$cshowsPrec :: Int -> GetBackupPlanFromJSON -> ShowS
Prelude.Show, (forall x. GetBackupPlanFromJSON -> Rep GetBackupPlanFromJSON x)
-> (forall x. Rep GetBackupPlanFromJSON x -> GetBackupPlanFromJSON)
-> Generic GetBackupPlanFromJSON
forall x. Rep GetBackupPlanFromJSON x -> GetBackupPlanFromJSON
forall x. GetBackupPlanFromJSON -> Rep GetBackupPlanFromJSON x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackupPlanFromJSON x -> GetBackupPlanFromJSON
$cfrom :: forall x. GetBackupPlanFromJSON -> Rep GetBackupPlanFromJSON x
Prelude.Generic)
newGetBackupPlanFromJSON ::
Prelude.Text ->
GetBackupPlanFromJSON
newGetBackupPlanFromJSON :: Text -> GetBackupPlanFromJSON
newGetBackupPlanFromJSON Text
pBackupPlanTemplateJson_ =
GetBackupPlanFromJSON' :: Text -> GetBackupPlanFromJSON
GetBackupPlanFromJSON'
{ $sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: Text
backupPlanTemplateJson =
Text
pBackupPlanTemplateJson_
}
getBackupPlanFromJSON_backupPlanTemplateJson :: Lens.Lens' GetBackupPlanFromJSON Prelude.Text
getBackupPlanFromJSON_backupPlanTemplateJson :: (Text -> f Text)
-> GetBackupPlanFromJSON -> f GetBackupPlanFromJSON
getBackupPlanFromJSON_backupPlanTemplateJson = (GetBackupPlanFromJSON -> Text)
-> (GetBackupPlanFromJSON -> Text -> GetBackupPlanFromJSON)
-> Lens GetBackupPlanFromJSON GetBackupPlanFromJSON Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanFromJSON' {Text
backupPlanTemplateJson :: Text
$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: GetBackupPlanFromJSON -> Text
backupPlanTemplateJson} -> Text
backupPlanTemplateJson) (\s :: GetBackupPlanFromJSON
s@GetBackupPlanFromJSON' {} Text
a -> GetBackupPlanFromJSON
s {$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: Text
backupPlanTemplateJson = Text
a} :: GetBackupPlanFromJSON)
instance Core.AWSRequest GetBackupPlanFromJSON where
type
AWSResponse GetBackupPlanFromJSON =
GetBackupPlanFromJSONResponse
request :: GetBackupPlanFromJSON -> Request GetBackupPlanFromJSON
request = Service -> GetBackupPlanFromJSON -> Request GetBackupPlanFromJSON
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetBackupPlanFromJSON
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBackupPlanFromJSON)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetBackupPlanFromJSON))
-> Logger
-> Service
-> Proxy GetBackupPlanFromJSON
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBackupPlanFromJSON)))
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 BackupPlan -> Int -> GetBackupPlanFromJSONResponse
GetBackupPlanFromJSONResponse'
(Maybe BackupPlan -> Int -> GetBackupPlanFromJSONResponse)
-> Either String (Maybe BackupPlan)
-> Either String (Int -> GetBackupPlanFromJSONResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BackupPlan)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupPlan")
Either String (Int -> GetBackupPlanFromJSONResponse)
-> Either String Int -> Either String GetBackupPlanFromJSONResponse
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 GetBackupPlanFromJSON
instance Prelude.NFData GetBackupPlanFromJSON
instance Core.ToHeaders GetBackupPlanFromJSON where
toHeaders :: GetBackupPlanFromJSON -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetBackupPlanFromJSON -> 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.ToJSON GetBackupPlanFromJSON where
toJSON :: GetBackupPlanFromJSON -> Value
toJSON GetBackupPlanFromJSON' {Text
backupPlanTemplateJson :: Text
$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: GetBackupPlanFromJSON -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"BackupPlanTemplateJson"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backupPlanTemplateJson
)
]
)
instance Core.ToPath GetBackupPlanFromJSON where
toPath :: GetBackupPlanFromJSON -> ByteString
toPath = ByteString -> GetBackupPlanFromJSON -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/backup/template/json/toPlan"
instance Core.ToQuery GetBackupPlanFromJSON where
toQuery :: GetBackupPlanFromJSON -> QueryString
toQuery = QueryString -> GetBackupPlanFromJSON -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetBackupPlanFromJSONResponse = GetBackupPlanFromJSONResponse'
{
GetBackupPlanFromJSONResponse -> Maybe BackupPlan
backupPlan :: Prelude.Maybe BackupPlan,
GetBackupPlanFromJSONResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool
(GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool)
-> (GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool)
-> Eq GetBackupPlanFromJSONResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool
$c/= :: GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool
== :: GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool
$c== :: GetBackupPlanFromJSONResponse
-> GetBackupPlanFromJSONResponse -> Bool
Prelude.Eq, Int -> GetBackupPlanFromJSONResponse -> ShowS
[GetBackupPlanFromJSONResponse] -> ShowS
GetBackupPlanFromJSONResponse -> String
(Int -> GetBackupPlanFromJSONResponse -> ShowS)
-> (GetBackupPlanFromJSONResponse -> String)
-> ([GetBackupPlanFromJSONResponse] -> ShowS)
-> Show GetBackupPlanFromJSONResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackupPlanFromJSONResponse] -> ShowS
$cshowList :: [GetBackupPlanFromJSONResponse] -> ShowS
show :: GetBackupPlanFromJSONResponse -> String
$cshow :: GetBackupPlanFromJSONResponse -> String
showsPrec :: Int -> GetBackupPlanFromJSONResponse -> ShowS
$cshowsPrec :: Int -> GetBackupPlanFromJSONResponse -> ShowS
Prelude.Show, (forall x.
GetBackupPlanFromJSONResponse
-> Rep GetBackupPlanFromJSONResponse x)
-> (forall x.
Rep GetBackupPlanFromJSONResponse x
-> GetBackupPlanFromJSONResponse)
-> Generic GetBackupPlanFromJSONResponse
forall x.
Rep GetBackupPlanFromJSONResponse x
-> GetBackupPlanFromJSONResponse
forall x.
GetBackupPlanFromJSONResponse
-> Rep GetBackupPlanFromJSONResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBackupPlanFromJSONResponse x
-> GetBackupPlanFromJSONResponse
$cfrom :: forall x.
GetBackupPlanFromJSONResponse
-> Rep GetBackupPlanFromJSONResponse x
Prelude.Generic)
newGetBackupPlanFromJSONResponse ::
Prelude.Int ->
GetBackupPlanFromJSONResponse
newGetBackupPlanFromJSONResponse :: Int -> GetBackupPlanFromJSONResponse
newGetBackupPlanFromJSONResponse Int
pHttpStatus_ =
GetBackupPlanFromJSONResponse' :: Maybe BackupPlan -> Int -> GetBackupPlanFromJSONResponse
GetBackupPlanFromJSONResponse'
{ $sel:backupPlan:GetBackupPlanFromJSONResponse' :: Maybe BackupPlan
backupPlan =
Maybe BackupPlan
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBackupPlanFromJSONResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBackupPlanFromJSONResponse_backupPlan :: Lens.Lens' GetBackupPlanFromJSONResponse (Prelude.Maybe BackupPlan)
getBackupPlanFromJSONResponse_backupPlan :: (Maybe BackupPlan -> f (Maybe BackupPlan))
-> GetBackupPlanFromJSONResponse -> f GetBackupPlanFromJSONResponse
getBackupPlanFromJSONResponse_backupPlan = (GetBackupPlanFromJSONResponse -> Maybe BackupPlan)
-> (GetBackupPlanFromJSONResponse
-> Maybe BackupPlan -> GetBackupPlanFromJSONResponse)
-> Lens
GetBackupPlanFromJSONResponse
GetBackupPlanFromJSONResponse
(Maybe BackupPlan)
(Maybe BackupPlan)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanFromJSONResponse' {Maybe BackupPlan
backupPlan :: Maybe BackupPlan
$sel:backupPlan:GetBackupPlanFromJSONResponse' :: GetBackupPlanFromJSONResponse -> Maybe BackupPlan
backupPlan} -> Maybe BackupPlan
backupPlan) (\s :: GetBackupPlanFromJSONResponse
s@GetBackupPlanFromJSONResponse' {} Maybe BackupPlan
a -> GetBackupPlanFromJSONResponse
s {$sel:backupPlan:GetBackupPlanFromJSONResponse' :: Maybe BackupPlan
backupPlan = Maybe BackupPlan
a} :: GetBackupPlanFromJSONResponse)
getBackupPlanFromJSONResponse_httpStatus :: Lens.Lens' GetBackupPlanFromJSONResponse Prelude.Int
getBackupPlanFromJSONResponse_httpStatus :: (Int -> f Int)
-> GetBackupPlanFromJSONResponse -> f GetBackupPlanFromJSONResponse
getBackupPlanFromJSONResponse_httpStatus = (GetBackupPlanFromJSONResponse -> Int)
-> (GetBackupPlanFromJSONResponse
-> Int -> GetBackupPlanFromJSONResponse)
-> Lens
GetBackupPlanFromJSONResponse GetBackupPlanFromJSONResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackupPlanFromJSONResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBackupPlanFromJSONResponse' :: GetBackupPlanFromJSONResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBackupPlanFromJSONResponse
s@GetBackupPlanFromJSONResponse' {} Int
a -> GetBackupPlanFromJSONResponse
s {$sel:httpStatus:GetBackupPlanFromJSONResponse' :: Int
httpStatus = Int
a} :: GetBackupPlanFromJSONResponse)
instance Prelude.NFData GetBackupPlanFromJSONResponse