{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Backup.StartRestoreJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Recovers the saved resource identified by an Amazon Resource Name (ARN).
module Amazonka.Backup.StartRestoreJob
  ( -- * Creating a Request
    StartRestoreJob (..),
    newStartRestoreJob,

    -- * Request Lenses
    startRestoreJob_iamRoleArn,
    startRestoreJob_idempotencyToken,
    startRestoreJob_resourceType,
    startRestoreJob_recoveryPointArn,
    startRestoreJob_metadata,

    -- * Destructuring the Response
    StartRestoreJobResponse (..),
    newStartRestoreJobResponse,

    -- * Response Lenses
    startRestoreJobResponse_restoreJobId,
    startRestoreJobResponse_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

-- | /See:/ 'newStartRestoreJob' smart constructor.
data StartRestoreJob = StartRestoreJob'
  { -- | The Amazon Resource Name (ARN) of the IAM role that Backup uses to
    -- create the target resource; for example:
    -- @arn:aws:iam::123456789012:role\/S3Access@.
    StartRestoreJob -> Maybe Text
iamRoleArn :: Prelude.Maybe Prelude.Text,
    -- | A customer-chosen string that you can use to distinguish between
    -- otherwise identical calls to @StartRestoreJob@. Retrying a successful
    -- request with the same idempotency token results in a success message
    -- with no action taken.
    StartRestoreJob -> Maybe Text
idempotencyToken :: Prelude.Maybe Prelude.Text,
    -- | Starts a job to restore a recovery point for one of the following
    -- resources:
    --
    -- -   @Aurora@ for Amazon Aurora
    --
    -- -   @DocumentDB@ for Amazon DocumentDB (with MongoDB compatibility)
    --
    -- -   @DynamoDB@ for Amazon DynamoDB
    --
    -- -   @EBS@ for Amazon Elastic Block Store
    --
    -- -   @EC2@ for Amazon Elastic Compute Cloud
    --
    -- -   @EFS@ for Amazon Elastic File System
    --
    -- -   @FSx@ for Amazon FSx
    --
    -- -   @Neptune@ for Amazon Neptune
    --
    -- -   @RDS@ for Amazon Relational Database Service
    --
    -- -   @Storage Gateway@ for Storage Gateway
    --
    -- -   @S3@ for Amazon S3
    --
    -- -   @VirtualMachine@ for virtual machines
    StartRestoreJob -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | An ARN that uniquely identifies a recovery point; for example,
    -- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
    StartRestoreJob -> Text
recoveryPointArn :: Prelude.Text,
    -- | A set of metadata key-value pairs. Contains information, such as a
    -- resource name, required to restore a recovery point.
    --
    -- You can get configuration metadata about a resource at the time it was
    -- backed up by calling @GetRecoveryPointRestoreMetadata@. However, values
    -- in addition to those provided by @GetRecoveryPointRestoreMetadata@ might
    -- be required to restore a resource. For example, you might need to
    -- provide a new resource name if the original already exists.
    --
    -- You need to specify specific metadata to restore an Amazon Elastic File
    -- System (Amazon EFS) instance:
    --
    -- -   @file-system-id@: The ID of the Amazon EFS file system that is
    --     backed up by Backup. Returned in @GetRecoveryPointRestoreMetadata@.
    --
    -- -   @Encrypted@: A Boolean value that, if true, specifies that the file
    --     system is encrypted. If @KmsKeyId@ is specified, @Encrypted@ must be
    --     set to @true@.
    --
    -- -   @KmsKeyId@: Specifies the Amazon Web Services KMS key that is used
    --     to encrypt the restored file system. You can specify a key from
    --     another Amazon Web Services account provided that key it is properly
    --     shared with your account via Amazon Web Services KMS.
    --
    -- -   @PerformanceMode@: Specifies the throughput mode of the file system.
    --
    -- -   @CreationToken@: A user-supplied value that ensures the uniqueness
    --     (idempotency) of the request.
    --
    -- -   @newFileSystem@: A Boolean value that, if true, specifies that the
    --     recovery point is restored to a new Amazon EFS file system.
    --
    -- -   @ItemsToRestore@: An array of one to five strings where each string
    --     is a file path. Use @ItemsToRestore@ to restore specific files or
    --     directories rather than the entire file system. This parameter is
    --     optional. For example, @\"itemsToRestore\":\"[\\\"\/my.test\\\"]\"@.
    StartRestoreJob -> Sensitive (HashMap Text Text)
metadata :: Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (StartRestoreJob -> StartRestoreJob -> Bool
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
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. 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)

-- |
-- Create a value of 'StartRestoreJob' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'iamRoleArn', 'startRestoreJob_iamRoleArn' - The Amazon Resource Name (ARN) of the IAM role that Backup uses to
-- create the target resource; for example:
-- @arn:aws:iam::123456789012:role\/S3Access@.
--
-- 'idempotencyToken', 'startRestoreJob_idempotencyToken' - A customer-chosen string that you can use to distinguish between
-- otherwise identical calls to @StartRestoreJob@. Retrying a successful
-- request with the same idempotency token results in a success message
-- with no action taken.
--
-- 'resourceType', 'startRestoreJob_resourceType' - Starts a job to restore a recovery point for one of the following
-- resources:
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @DocumentDB@ for Amazon DocumentDB (with MongoDB compatibility)
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @FSx@ for Amazon FSx
--
-- -   @Neptune@ for Amazon Neptune
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Storage Gateway@ for Storage Gateway
--
-- -   @S3@ for Amazon S3
--
-- -   @VirtualMachine@ for virtual machines
--
-- 'recoveryPointArn', 'startRestoreJob_recoveryPointArn' - An ARN that uniquely identifies a recovery point; for example,
-- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
--
-- 'metadata', 'startRestoreJob_metadata' - A set of metadata key-value pairs. Contains information, such as a
-- resource name, required to restore a recovery point.
--
-- You can get configuration metadata about a resource at the time it was
-- backed up by calling @GetRecoveryPointRestoreMetadata@. However, values
-- in addition to those provided by @GetRecoveryPointRestoreMetadata@ might
-- be required to restore a resource. For example, you might need to
-- provide a new resource name if the original already exists.
--
-- You need to specify specific metadata to restore an Amazon Elastic File
-- System (Amazon EFS) instance:
--
-- -   @file-system-id@: The ID of the Amazon EFS file system that is
--     backed up by Backup. Returned in @GetRecoveryPointRestoreMetadata@.
--
-- -   @Encrypted@: A Boolean value that, if true, specifies that the file
--     system is encrypted. If @KmsKeyId@ is specified, @Encrypted@ must be
--     set to @true@.
--
-- -   @KmsKeyId@: Specifies the Amazon Web Services KMS key that is used
--     to encrypt the restored file system. You can specify a key from
--     another Amazon Web Services account provided that key it is properly
--     shared with your account via Amazon Web Services KMS.
--
-- -   @PerformanceMode@: Specifies the throughput mode of the file system.
--
-- -   @CreationToken@: A user-supplied value that ensures the uniqueness
--     (idempotency) of the request.
--
-- -   @newFileSystem@: A Boolean value that, if true, specifies that the
--     recovery point is restored to a new Amazon EFS file system.
--
-- -   @ItemsToRestore@: An array of one to five strings where each string
--     is a file path. Use @ItemsToRestore@ to restore specific files or
--     directories rather than the entire file system. This parameter is
--     optional. For example, @\"itemsToRestore\":\"[\\\"\/my.test\\\"]\"@.
newStartRestoreJob ::
  -- | 'recoveryPointArn'
  Prelude.Text ->
  StartRestoreJob
newStartRestoreJob :: Text -> StartRestoreJob
newStartRestoreJob Text
pRecoveryPointArn_ =
  StartRestoreJob'
    { $sel:iamRoleArn:StartRestoreJob' :: Maybe Text
iamRoleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:idempotencyToken:StartRestoreJob' :: Maybe Text
idempotencyToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:StartRestoreJob' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:recoveryPointArn:StartRestoreJob' :: Text
recoveryPointArn = Text
pRecoveryPointArn_,
      $sel:metadata:StartRestoreJob' :: Sensitive (HashMap Text Text)
metadata = forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Resource Name (ARN) of the IAM role that Backup uses to
-- create the target resource; for example:
-- @arn:aws:iam::123456789012:role\/S3Access@.
startRestoreJob_iamRoleArn :: Lens.Lens' StartRestoreJob (Prelude.Maybe Prelude.Text)
startRestoreJob_iamRoleArn :: Lens' StartRestoreJob (Maybe Text)
startRestoreJob_iamRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRestoreJob' {Maybe Text
iamRoleArn :: Maybe Text
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Maybe Text
iamRoleArn} -> Maybe Text
iamRoleArn) (\s :: StartRestoreJob
s@StartRestoreJob' {} Maybe Text
a -> StartRestoreJob
s {$sel:iamRoleArn:StartRestoreJob' :: Maybe Text
iamRoleArn = Maybe Text
a} :: StartRestoreJob)

-- | A customer-chosen string that you can use to distinguish between
-- otherwise identical calls to @StartRestoreJob@. Retrying a successful
-- request with the same idempotency token results in a success message
-- with no action taken.
startRestoreJob_idempotencyToken :: Lens.Lens' StartRestoreJob (Prelude.Maybe Prelude.Text)
startRestoreJob_idempotencyToken :: Lens' StartRestoreJob (Maybe Text)
startRestoreJob_idempotencyToken = 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)

-- | Starts a job to restore a recovery point for one of the following
-- resources:
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @DocumentDB@ for Amazon DocumentDB (with MongoDB compatibility)
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @FSx@ for Amazon FSx
--
-- -   @Neptune@ for Amazon Neptune
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Storage Gateway@ for Storage Gateway
--
-- -   @S3@ for Amazon S3
--
-- -   @VirtualMachine@ for virtual machines
startRestoreJob_resourceType :: Lens.Lens' StartRestoreJob (Prelude.Maybe Prelude.Text)
startRestoreJob_resourceType :: Lens' StartRestoreJob (Maybe Text)
startRestoreJob_resourceType = 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)

-- | An ARN that uniquely identifies a recovery point; for example,
-- @arn:aws:backup:us-east-1:123456789012:recovery-point:1EB3B5E7-9EB0-435A-A80B-108B488B0D45@.
startRestoreJob_recoveryPointArn :: Lens.Lens' StartRestoreJob Prelude.Text
startRestoreJob_recoveryPointArn :: Lens' StartRestoreJob Text
startRestoreJob_recoveryPointArn = 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)

-- | A set of metadata key-value pairs. Contains information, such as a
-- resource name, required to restore a recovery point.
--
-- You can get configuration metadata about a resource at the time it was
-- backed up by calling @GetRecoveryPointRestoreMetadata@. However, values
-- in addition to those provided by @GetRecoveryPointRestoreMetadata@ might
-- be required to restore a resource. For example, you might need to
-- provide a new resource name if the original already exists.
--
-- You need to specify specific metadata to restore an Amazon Elastic File
-- System (Amazon EFS) instance:
--
-- -   @file-system-id@: The ID of the Amazon EFS file system that is
--     backed up by Backup. Returned in @GetRecoveryPointRestoreMetadata@.
--
-- -   @Encrypted@: A Boolean value that, if true, specifies that the file
--     system is encrypted. If @KmsKeyId@ is specified, @Encrypted@ must be
--     set to @true@.
--
-- -   @KmsKeyId@: Specifies the Amazon Web Services KMS key that is used
--     to encrypt the restored file system. You can specify a key from
--     another Amazon Web Services account provided that key it is properly
--     shared with your account via Amazon Web Services KMS.
--
-- -   @PerformanceMode@: Specifies the throughput mode of the file system.
--
-- -   @CreationToken@: A user-supplied value that ensures the uniqueness
--     (idempotency) of the request.
--
-- -   @newFileSystem@: A Boolean value that, if true, specifies that the
--     recovery point is restored to a new Amazon EFS file system.
--
-- -   @ItemsToRestore@: An array of one to five strings where each string
--     is a file path. Use @ItemsToRestore@ to restore specific files or
--     directories rather than the entire file system. This parameter is
--     optional. For example, @\"itemsToRestore\":\"[\\\"\/my.test\\\"]\"@.
startRestoreJob_metadata :: Lens.Lens' StartRestoreJob (Prelude.HashMap Prelude.Text Prelude.Text)
startRestoreJob_metadata :: Lens' StartRestoreJob (HashMap Text Text)
startRestoreJob_metadata = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest StartRestoreJob where
  type
    AWSResponse StartRestoreJob =
      StartRestoreJobResponse
  request :: (Service -> Service) -> StartRestoreJob -> Request StartRestoreJob
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartRestoreJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartRestoreJob)))
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 Text -> Int -> StartRestoreJobResponse
StartRestoreJobResponse'
            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
"RestoreJobId")
            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 StartRestoreJob where
  hashWithSalt :: Int -> StartRestoreJob -> Int
hashWithSalt Int
_salt StartRestoreJob' {Maybe Text
Text
Sensitive (HashMap Text Text)
metadata :: Sensitive (HashMap Text Text)
recoveryPointArn :: Text
resourceType :: Maybe Text
idempotencyToken :: Maybe Text
iamRoleArn :: Maybe 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
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
idempotencyToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
recoveryPointArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (HashMap Text Text)
metadata

instance Prelude.NFData StartRestoreJob where
  rnf :: StartRestoreJob -> ()
rnf StartRestoreJob' {Maybe Text
Text
Sensitive (HashMap Text Text)
metadata :: Sensitive (HashMap Text Text)
recoveryPointArn :: Text
resourceType :: Maybe Text
idempotencyToken :: Maybe Text
iamRoleArn :: Maybe 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
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
idempotencyToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
recoveryPointArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive (HashMap Text Text)
metadata

instance Data.ToHeaders StartRestoreJob where
  toHeaders :: StartRestoreJob -> 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 StartRestoreJob where
  toJSON :: StartRestoreJob -> Value
toJSON StartRestoreJob' {Maybe Text
Text
Sensitive (HashMap Text Text)
metadata :: Sensitive (HashMap Text Text)
recoveryPointArn :: Text
resourceType :: Maybe Text
idempotencyToken :: Maybe Text
iamRoleArn :: Maybe 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
$sel:iamRoleArn:StartRestoreJob' :: StartRestoreJob -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"IamRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
iamRoleArn,
            (Key
"IdempotencyToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
idempotencyToken,
            (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceType,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"RecoveryPointArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
recoveryPointArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"Metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive (HashMap Text Text)
metadata)
          ]
      )

instance Data.ToPath StartRestoreJob where
  toPath :: StartRestoreJob -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/restore-jobs"

instance Data.ToQuery StartRestoreJob where
  toQuery :: StartRestoreJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartRestoreJobResponse' smart constructor.
data StartRestoreJobResponse = StartRestoreJobResponse'
  { -- | Uniquely identifies the job that restores a recovery point.
    StartRestoreJobResponse -> Maybe Text
restoreJobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartRestoreJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartRestoreJobResponse -> StartRestoreJobResponse -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'StartRestoreJobResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'restoreJobId', 'startRestoreJobResponse_restoreJobId' - Uniquely identifies the job that restores a recovery point.
--
-- 'httpStatus', 'startRestoreJobResponse_httpStatus' - The response's http status code.
newStartRestoreJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartRestoreJobResponse
newStartRestoreJobResponse :: Int -> StartRestoreJobResponse
newStartRestoreJobResponse Int
pHttpStatus_ =
  StartRestoreJobResponse'
    { $sel:restoreJobId:StartRestoreJobResponse' :: Maybe Text
restoreJobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartRestoreJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Uniquely identifies the job that restores a recovery point.
startRestoreJobResponse_restoreJobId :: Lens.Lens' StartRestoreJobResponse (Prelude.Maybe Prelude.Text)
startRestoreJobResponse_restoreJobId :: Lens' StartRestoreJobResponse (Maybe Text)
startRestoreJobResponse_restoreJobId = 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)

-- | The response's http status code.
startRestoreJobResponse_httpStatus :: Lens.Lens' StartRestoreJobResponse Prelude.Int
startRestoreJobResponse_httpStatus :: Lens' StartRestoreJobResponse Int
startRestoreJobResponse_httpStatus = 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 where
  rnf :: StartRestoreJobResponse -> ()
rnf StartRestoreJobResponse' {Int
Maybe Text
httpStatus :: Int
restoreJobId :: Maybe Text
$sel:httpStatus:StartRestoreJobResponse' :: StartRestoreJobResponse -> Int
$sel:restoreJobId:StartRestoreJobResponse' :: StartRestoreJobResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
restoreJobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus