{-# 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.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 GetBackupPlanFromJSON = GetBackupPlanFromJSON'
{
GetBackupPlanFromJSON -> Text
backupPlanTemplateJson :: Prelude.Text
}
deriving (GetBackupPlanFromJSON -> GetBackupPlanFromJSON -> Bool
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]
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
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. 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'
{ $sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: Text
backupPlanTemplateJson =
Text
pBackupPlanTemplateJson_
}
getBackupPlanFromJSON_backupPlanTemplateJson :: Lens.Lens' GetBackupPlanFromJSON Prelude.Text
getBackupPlanFromJSON_backupPlanTemplateJson :: Lens' GetBackupPlanFromJSON Text
getBackupPlanFromJSON_backupPlanTemplateJson = 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 :: (Service -> Service)
-> GetBackupPlanFromJSON -> Request GetBackupPlanFromJSON
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetBackupPlanFromJSON
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBackupPlanFromJSON)))
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 BackupPlan -> Int -> GetBackupPlanFromJSONResponse
GetBackupPlanFromJSONResponse'
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
"BackupPlan")
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 GetBackupPlanFromJSON where
hashWithSalt :: Int -> GetBackupPlanFromJSON -> Int
hashWithSalt Int
_salt GetBackupPlanFromJSON' {Text
backupPlanTemplateJson :: Text
$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: GetBackupPlanFromJSON -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backupPlanTemplateJson
instance Prelude.NFData GetBackupPlanFromJSON where
rnf :: GetBackupPlanFromJSON -> ()
rnf GetBackupPlanFromJSON' {Text
backupPlanTemplateJson :: Text
$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: GetBackupPlanFromJSON -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
backupPlanTemplateJson
instance Data.ToHeaders GetBackupPlanFromJSON where
toHeaders :: GetBackupPlanFromJSON -> 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.ToJSON GetBackupPlanFromJSON where
toJSON :: GetBackupPlanFromJSON -> Value
toJSON GetBackupPlanFromJSON' {Text
backupPlanTemplateJson :: Text
$sel:backupPlanTemplateJson:GetBackupPlanFromJSON' :: GetBackupPlanFromJSON -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"BackupPlanTemplateJson"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
backupPlanTemplateJson
)
]
)
instance Data.ToPath GetBackupPlanFromJSON where
toPath :: GetBackupPlanFromJSON -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/backup/template/json/toPlan"
instance Data.ToQuery GetBackupPlanFromJSON where
toQuery :: GetBackupPlanFromJSON -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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.
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'
{ $sel:backupPlan:GetBackupPlanFromJSONResponse' :: Maybe BackupPlan
backupPlan =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBackupPlanFromJSONResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBackupPlanFromJSONResponse_backupPlan :: Lens.Lens' GetBackupPlanFromJSONResponse (Prelude.Maybe BackupPlan)
getBackupPlanFromJSONResponse_backupPlan :: Lens' GetBackupPlanFromJSONResponse (Maybe BackupPlan)
getBackupPlanFromJSONResponse_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 :: Lens' GetBackupPlanFromJSONResponse Int
getBackupPlanFromJSONResponse_httpStatus = 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 where
rnf :: GetBackupPlanFromJSONResponse -> ()
rnf GetBackupPlanFromJSONResponse' {Int
Maybe BackupPlan
httpStatus :: Int
backupPlan :: Maybe BackupPlan
$sel:httpStatus:GetBackupPlanFromJSONResponse' :: GetBackupPlanFromJSONResponse -> Int
$sel:backupPlan:GetBackupPlanFromJSONResponse' :: GetBackupPlanFromJSONResponse -> Maybe BackupPlan
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BackupPlan
backupPlan
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus