{-# 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.StartRestoreJob
(
StartRestoreJob (..),
newStartRestoreJob,
startRestoreJob_idempotencyToken,
startRestoreJob_resourceType,
startRestoreJob_recoveryPointArn,
startRestoreJob_metadata,
startRestoreJob_iamRoleArn,
StartRestoreJobResponse (..),
newStartRestoreJobResponse,
startRestoreJobResponse_restoreJobId,
startRestoreJobResponse_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 StartRestoreJob = StartRestoreJob'
{
StartRestoreJob -> Maybe Text
idempotencyToken :: Prelude.Maybe Prelude.Text,
StartRestoreJob -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
StartRestoreJob -> Text
recoveryPointArn :: Prelude.Text,
StartRestoreJob -> Sensitive (HashMap Text Text)
metadata :: Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text),
StartRestoreJob -> Text
iamRoleArn :: Prelude.Text
}
deriving (StartRestoreJob -> StartRestoreJob -> Bool
(StartRestoreJob -> StartRestoreJob -> Bool)
-> (StartRestoreJob -> StartRestoreJob -> Bool)
-> Eq StartRestoreJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartRestoreJob -> StartRestoreJob -> Bool
$c/= :: StartRestoreJob -> StartRestoreJob -> Bool
== :: StartRestoreJob -> StartRestoreJob -> Bool
$c== :: StartRestoreJob -> StartRestoreJob -> Bool
Prelude.Eq, Int -> StartRestoreJob -> ShowS
[StartRestoreJob] -> ShowS
StartRestoreJob -> String
(Int -> StartRestoreJob -> ShowS)
-> (StartRestoreJob -> String)
-> ([StartRestoreJob] -> ShowS)
-> Show StartRestoreJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartRestoreJob] -> ShowS
$cshowList :: [StartRestoreJob] -> ShowS
show :: StartRestoreJob -> String
$cshow :: StartRestoreJob -> String
showsPrec :: Int -> StartRestoreJob -> ShowS
$cshowsPrec :: Int -> StartRestoreJob -> ShowS
Prelude.Show, (forall x. StartRestoreJob -> Rep StartRestoreJob x)
-> (forall x. Rep StartRestoreJob x -> StartRestoreJob)
-> Generic StartRestoreJob
forall x. Rep StartRestoreJob x -> StartRestoreJob
forall x. StartRestoreJob -> Rep StartRestoreJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartRestoreJob x -> StartRestoreJob
$cfrom :: forall x. StartRestoreJob -> Rep StartRestoreJob x
Prelude.Generic)
newStartRestoreJob ::
Prelude.Text ->
Prelude.Text ->
StartRestoreJob
newStartRestoreJob :: Text -> Text -> StartRestoreJob
newStartRestoreJob Text
pRecoveryPointArn_ Text
pIamRoleArn_ =
StartRestoreJob' :: Maybe Text
-> Maybe Text
-> Text
-> Sensitive (HashMap Text Text)
-> Text
-> StartRestoreJob
StartRestoreJob'
{ $sel:idempotencyToken:StartRestoreJob' :: Maybe Text
idempotencyToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:StartRestoreJob' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:recoveryPointArn:StartRestoreJob' :: Text
recoveryPointArn = Text
pRecoveryPointArn_,
$sel:metadata:StartRestoreJob' :: Sensitive (HashMap Text Text)
metadata = Sensitive (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty,
$sel:iamRoleArn:StartRestoreJob' :: Text
iamRoleArn = Text
pIamRoleArn_
}
startRestoreJob_idempotencyToken :: Lens.Lens' StartRestoreJob (Prelude.Maybe Prelude.Text)
startRestoreJob_idempotencyToken :: (Maybe Text -> f (Maybe Text))
-> StartRestoreJob -> f StartRestoreJob
startRestoreJob_idempotencyToken = (StartRestoreJob -> Maybe Text)
-> (StartRestoreJob -> Maybe Text -> StartRestoreJob)
-> Lens StartRestoreJob StartRestoreJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Maybe Text
idempotencyToken :: Maybe Text
$sel:idempotencyToken:StartRestoreJob' :: StartRestoreJob -> Maybe Text
idempotencyToken} -> Maybe Text
idempotencyToken) (\s :: StartRestoreJob
s@StartRestoreJob' {} Maybe Text
a -> StartRestoreJob
s {$sel:idempotencyToken:StartRestoreJob' :: Maybe Text
idempotencyToken = Maybe Text
a} :: StartRestoreJob)
startRestoreJob_resourceType :: Lens.Lens' StartRestoreJob (Prelude.Maybe Prelude.Text)
startRestoreJob_resourceType :: (Maybe Text -> f (Maybe Text))
-> StartRestoreJob -> f StartRestoreJob
startRestoreJob_resourceType = (StartRestoreJob -> Maybe Text)
-> (StartRestoreJob -> Maybe Text -> StartRestoreJob)
-> Lens StartRestoreJob StartRestoreJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:StartRestoreJob' :: StartRestoreJob -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: StartRestoreJob
s@StartRestoreJob' {} Maybe Text
a -> StartRestoreJob
s {$sel:resourceType:StartRestoreJob' :: Maybe Text
resourceType = Maybe Text
a} :: StartRestoreJob)
startRestoreJob_recoveryPointArn :: Lens.Lens' StartRestoreJob Prelude.Text
startRestoreJob_recoveryPointArn :: (Text -> f Text) -> StartRestoreJob -> f StartRestoreJob
startRestoreJob_recoveryPointArn = (StartRestoreJob -> Text)
-> (StartRestoreJob -> Text -> StartRestoreJob)
-> Lens StartRestoreJob StartRestoreJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Text
recoveryPointArn :: Text
$sel:recoveryPointArn:StartRestoreJob' :: StartRestoreJob -> Text
recoveryPointArn} -> Text
recoveryPointArn) (\s :: StartRestoreJob
s@StartRestoreJob' {} Text
a -> StartRestoreJob
s {$sel:recoveryPointArn:StartRestoreJob' :: Text
recoveryPointArn = Text
a} :: StartRestoreJob)
startRestoreJob_metadata :: Lens.Lens' StartRestoreJob (Prelude.HashMap Prelude.Text Prelude.Text)
startRestoreJob_metadata :: (HashMap Text Text -> f (HashMap Text Text))
-> StartRestoreJob -> f StartRestoreJob
startRestoreJob_metadata = (StartRestoreJob -> Sensitive (HashMap Text Text))
-> (StartRestoreJob
-> Sensitive (HashMap Text Text) -> StartRestoreJob)
-> Lens
StartRestoreJob
StartRestoreJob
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Sensitive (HashMap Text Text)
metadata :: Sensitive (HashMap Text Text)
$sel:metadata:StartRestoreJob' :: StartRestoreJob -> Sensitive (HashMap Text Text)
metadata} -> Sensitive (HashMap Text Text)
metadata) (\s :: StartRestoreJob
s@StartRestoreJob' {} Sensitive (HashMap Text Text)
a -> StartRestoreJob
s {$sel:metadata:StartRestoreJob' :: Sensitive (HashMap Text Text)
metadata = Sensitive (HashMap Text Text)
a} :: StartRestoreJob) ((Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> StartRestoreJob -> f StartRestoreJob)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> (HashMap Text Text -> f (HashMap Text Text))
-> StartRestoreJob
-> f StartRestoreJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text)))
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> Sensitive (HashMap Text Text)
-> f (Sensitive (HashMap Text Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startRestoreJob_iamRoleArn :: Lens.Lens' StartRestoreJob Prelude.Text
startRestoreJob_iamRoleArn :: (Text -> f Text) -> StartRestoreJob -> f StartRestoreJob
startRestoreJob_iamRoleArn = (StartRestoreJob -> Text)
-> (StartRestoreJob -> Text -> StartRestoreJob)
-> Lens StartRestoreJob StartRestoreJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Text
iamRoleArn :: Text
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Text
iamRoleArn} -> Text
iamRoleArn) (\s :: StartRestoreJob
s@StartRestoreJob' {} Text
a -> StartRestoreJob
s {$sel:iamRoleArn:StartRestoreJob' :: Text
iamRoleArn = Text
a} :: StartRestoreJob)
instance Core.AWSRequest StartRestoreJob where
type
AWSResponse StartRestoreJob =
StartRestoreJobResponse
request :: StartRestoreJob -> Request StartRestoreJob
request = Service -> StartRestoreJob -> Request StartRestoreJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartRestoreJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartRestoreJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartRestoreJob))
-> Logger
-> Service
-> Proxy StartRestoreJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartRestoreJob)))
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 -> StartRestoreJobResponse
StartRestoreJobResponse'
(Maybe Text -> Int -> StartRestoreJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartRestoreJobResponse)
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
"RestoreJobId")
Either String (Int -> StartRestoreJobResponse)
-> Either String Int -> Either String StartRestoreJobResponse
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 StartRestoreJob
instance Prelude.NFData StartRestoreJob
instance Core.ToHeaders StartRestoreJob where
toHeaders :: StartRestoreJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartRestoreJob -> 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 StartRestoreJob where
toJSON :: StartRestoreJob -> Value
toJSON StartRestoreJob' {Maybe Text
Text
Sensitive (HashMap Text Text)
iamRoleArn :: Text
metadata :: Sensitive (HashMap Text Text)
recoveryPointArn :: Text
resourceType :: Maybe Text
idempotencyToken :: Maybe Text
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Text
$sel:metadata:StartRestoreJob' :: StartRestoreJob -> Sensitive (HashMap Text Text)
$sel:recoveryPointArn:StartRestoreJob' :: StartRestoreJob -> Text
$sel:resourceType:StartRestoreJob' :: StartRestoreJob -> Maybe Text
$sel:idempotencyToken:StartRestoreJob' :: StartRestoreJob -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IdempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
idempotencyToken,
(Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RecoveryPointArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
recoveryPointArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Metadata" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (HashMap Text Text)
metadata),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IamRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
iamRoleArn)
]
)
instance Core.ToPath StartRestoreJob where
toPath :: StartRestoreJob -> ByteString
toPath = ByteString -> StartRestoreJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/restore-jobs"
instance Core.ToQuery StartRestoreJob where
toQuery :: StartRestoreJob -> QueryString
toQuery = QueryString -> StartRestoreJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartRestoreJobResponse = StartRestoreJobResponse'
{
StartRestoreJobResponse -> Maybe Text
restoreJobId :: Prelude.Maybe Prelude.Text,
StartRestoreJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
(StartRestoreJobResponse -> StartRestoreJobResponse -> Bool)
-> (StartRestoreJobResponse -> StartRestoreJobResponse -> Bool)
-> Eq StartRestoreJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
$c/= :: StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
== :: StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
$c== :: StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
Prelude.Eq, ReadPrec [StartRestoreJobResponse]
ReadPrec StartRestoreJobResponse
Int -> ReadS StartRestoreJobResponse
ReadS [StartRestoreJobResponse]
(Int -> ReadS StartRestoreJobResponse)
-> ReadS [StartRestoreJobResponse]
-> ReadPrec StartRestoreJobResponse
-> ReadPrec [StartRestoreJobResponse]
-> Read StartRestoreJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartRestoreJobResponse]
$creadListPrec :: ReadPrec [StartRestoreJobResponse]
readPrec :: ReadPrec StartRestoreJobResponse
$creadPrec :: ReadPrec StartRestoreJobResponse
readList :: ReadS [StartRestoreJobResponse]
$creadList :: ReadS [StartRestoreJobResponse]
readsPrec :: Int -> ReadS StartRestoreJobResponse
$creadsPrec :: Int -> ReadS StartRestoreJobResponse
Prelude.Read, Int -> StartRestoreJobResponse -> ShowS
[StartRestoreJobResponse] -> ShowS
StartRestoreJobResponse -> String
(Int -> StartRestoreJobResponse -> ShowS)
-> (StartRestoreJobResponse -> String)
-> ([StartRestoreJobResponse] -> ShowS)
-> Show StartRestoreJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartRestoreJobResponse] -> ShowS
$cshowList :: [StartRestoreJobResponse] -> ShowS
show :: StartRestoreJobResponse -> String
$cshow :: StartRestoreJobResponse -> String
showsPrec :: Int -> StartRestoreJobResponse -> ShowS
$cshowsPrec :: Int -> StartRestoreJobResponse -> ShowS
Prelude.Show, (forall x.
StartRestoreJobResponse -> Rep StartRestoreJobResponse x)
-> (forall x.
Rep StartRestoreJobResponse x -> StartRestoreJobResponse)
-> Generic StartRestoreJobResponse
forall x. Rep StartRestoreJobResponse x -> StartRestoreJobResponse
forall x. StartRestoreJobResponse -> Rep StartRestoreJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartRestoreJobResponse x -> StartRestoreJobResponse
$cfrom :: forall x. StartRestoreJobResponse -> Rep StartRestoreJobResponse x
Prelude.Generic)
newStartRestoreJobResponse ::
Prelude.Int ->
StartRestoreJobResponse
newStartRestoreJobResponse :: Int -> StartRestoreJobResponse
newStartRestoreJobResponse Int
pHttpStatus_ =
StartRestoreJobResponse' :: Maybe Text -> Int -> StartRestoreJobResponse
StartRestoreJobResponse'
{ $sel:restoreJobId:StartRestoreJobResponse' :: Maybe Text
restoreJobId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartRestoreJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startRestoreJobResponse_restoreJobId :: Lens.Lens' StartRestoreJobResponse (Prelude.Maybe Prelude.Text)
startRestoreJobResponse_restoreJobId :: (Maybe Text -> f (Maybe Text))
-> StartRestoreJobResponse -> f StartRestoreJobResponse
startRestoreJobResponse_restoreJobId = (StartRestoreJobResponse -> Maybe Text)
-> (StartRestoreJobResponse
-> Maybe Text -> StartRestoreJobResponse)
-> Lens
StartRestoreJobResponse
StartRestoreJobResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJobResponse' {Maybe Text
restoreJobId :: Maybe Text
$sel:restoreJobId:StartRestoreJobResponse' :: StartRestoreJobResponse -> Maybe Text
restoreJobId} -> Maybe Text
restoreJobId) (\s :: StartRestoreJobResponse
s@StartRestoreJobResponse' {} Maybe Text
a -> StartRestoreJobResponse
s {$sel:restoreJobId:StartRestoreJobResponse' :: Maybe Text
restoreJobId = Maybe Text
a} :: StartRestoreJobResponse)
startRestoreJobResponse_httpStatus :: Lens.Lens' StartRestoreJobResponse Prelude.Int
startRestoreJobResponse_httpStatus :: (Int -> f Int)
-> StartRestoreJobResponse -> f StartRestoreJobResponse
startRestoreJobResponse_httpStatus = (StartRestoreJobResponse -> Int)
-> (StartRestoreJobResponse -> Int -> StartRestoreJobResponse)
-> Lens StartRestoreJobResponse StartRestoreJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartRestoreJobResponse' :: StartRestoreJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartRestoreJobResponse
s@StartRestoreJobResponse' {} Int
a -> StartRestoreJobResponse
s {$sel:httpStatus:StartRestoreJobResponse' :: Int
httpStatus = Int
a} :: StartRestoreJobResponse)
instance Prelude.NFData StartRestoreJobResponse