{-# 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.EC2.CreateReplaceRootVolumeTask
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Replaces the EBS-backed root volume for a @running@ instance with a new
-- volume that is restored to the original root volume\'s launch state,
-- that is restored to a specific snapshot taken from the original root
-- volume, or that is restored from an AMI that has the same key
-- characteristics as that of the instance.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/replace-root.html Replace a root volume>
-- in the /Amazon Elastic Compute Cloud User Guide/.
module Amazonka.EC2.CreateReplaceRootVolumeTask
  ( -- * Creating a Request
    CreateReplaceRootVolumeTask (..),
    newCreateReplaceRootVolumeTask,

    -- * Request Lenses
    createReplaceRootVolumeTask_clientToken,
    createReplaceRootVolumeTask_deleteReplacedRootVolume,
    createReplaceRootVolumeTask_dryRun,
    createReplaceRootVolumeTask_imageId,
    createReplaceRootVolumeTask_snapshotId,
    createReplaceRootVolumeTask_tagSpecifications,
    createReplaceRootVolumeTask_instanceId,

    -- * Destructuring the Response
    CreateReplaceRootVolumeTaskResponse (..),
    newCreateReplaceRootVolumeTaskResponse,

    -- * Response Lenses
    createReplaceRootVolumeTaskResponse_replaceRootVolumeTask,
    createReplaceRootVolumeTaskResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateReplaceRootVolumeTask' smart constructor.
data CreateReplaceRootVolumeTask = CreateReplaceRootVolumeTask'
  { -- | Unique, case-sensitive identifier you provide to ensure the idempotency
    -- of the request. If you do not specify a client token, a randomly
    -- generated token is used for the request to ensure idempotency. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensuring idempotency>.
    CreateReplaceRootVolumeTask -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether to automatically delete the original root volume after
    -- the root volume replacement task completes. To delete the original root
    -- volume, specify @true@. If you choose to keep the original root volume
    -- after the replacement task completes, you must manually delete it when
    -- you no longer need it.
    CreateReplaceRootVolumeTask -> Maybe Bool
deleteReplacedRootVolume :: Prelude.Maybe Prelude.Bool,
    -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    CreateReplaceRootVolumeTask -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the AMI to use to restore the root volume. The specified AMI
    -- must have the same product code, billing information, architecture type,
    -- and virtualization type as that of the instance.
    --
    -- If you want to restore the replacement volume from a specific snapshot,
    -- or if you want to restore it to its launch state, omit this parameter.
    CreateReplaceRootVolumeTask -> Maybe Text
imageId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the snapshot from which to restore the replacement root
    -- volume. The specified snapshot must be a snapshot that you previously
    -- created from the original root volume.
    --
    -- If you want to restore the replacement root volume to the initial launch
    -- state, or if you want to restore the replacement root volume from an
    -- AMI, omit this parameter.
    CreateReplaceRootVolumeTask -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text,
    -- | The tags to apply to the root volume replacement task.
    CreateReplaceRootVolumeTask -> Maybe [TagSpecification]
tagSpecifications :: Prelude.Maybe [TagSpecification],
    -- | The ID of the instance for which to replace the root volume.
    CreateReplaceRootVolumeTask -> Text
instanceId :: Prelude.Text
  }
  deriving (CreateReplaceRootVolumeTask -> CreateReplaceRootVolumeTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReplaceRootVolumeTask -> CreateReplaceRootVolumeTask -> Bool
$c/= :: CreateReplaceRootVolumeTask -> CreateReplaceRootVolumeTask -> Bool
== :: CreateReplaceRootVolumeTask -> CreateReplaceRootVolumeTask -> Bool
$c== :: CreateReplaceRootVolumeTask -> CreateReplaceRootVolumeTask -> Bool
Prelude.Eq, ReadPrec [CreateReplaceRootVolumeTask]
ReadPrec CreateReplaceRootVolumeTask
Int -> ReadS CreateReplaceRootVolumeTask
ReadS [CreateReplaceRootVolumeTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReplaceRootVolumeTask]
$creadListPrec :: ReadPrec [CreateReplaceRootVolumeTask]
readPrec :: ReadPrec CreateReplaceRootVolumeTask
$creadPrec :: ReadPrec CreateReplaceRootVolumeTask
readList :: ReadS [CreateReplaceRootVolumeTask]
$creadList :: ReadS [CreateReplaceRootVolumeTask]
readsPrec :: Int -> ReadS CreateReplaceRootVolumeTask
$creadsPrec :: Int -> ReadS CreateReplaceRootVolumeTask
Prelude.Read, Int -> CreateReplaceRootVolumeTask -> ShowS
[CreateReplaceRootVolumeTask] -> ShowS
CreateReplaceRootVolumeTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReplaceRootVolumeTask] -> ShowS
$cshowList :: [CreateReplaceRootVolumeTask] -> ShowS
show :: CreateReplaceRootVolumeTask -> String
$cshow :: CreateReplaceRootVolumeTask -> String
showsPrec :: Int -> CreateReplaceRootVolumeTask -> ShowS
$cshowsPrec :: Int -> CreateReplaceRootVolumeTask -> ShowS
Prelude.Show, forall x.
Rep CreateReplaceRootVolumeTask x -> CreateReplaceRootVolumeTask
forall x.
CreateReplaceRootVolumeTask -> Rep CreateReplaceRootVolumeTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReplaceRootVolumeTask x -> CreateReplaceRootVolumeTask
$cfrom :: forall x.
CreateReplaceRootVolumeTask -> Rep CreateReplaceRootVolumeTask x
Prelude.Generic)

-- |
-- Create a value of 'CreateReplaceRootVolumeTask' 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:
--
-- 'clientToken', 'createReplaceRootVolumeTask_clientToken' - Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request. If you do not specify a client token, a randomly
-- generated token is used for the request to ensure idempotency. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensuring idempotency>.
--
-- 'deleteReplacedRootVolume', 'createReplaceRootVolumeTask_deleteReplacedRootVolume' - Indicates whether to automatically delete the original root volume after
-- the root volume replacement task completes. To delete the original root
-- volume, specify @true@. If you choose to keep the original root volume
-- after the replacement task completes, you must manually delete it when
-- you no longer need it.
--
-- 'dryRun', 'createReplaceRootVolumeTask_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'imageId', 'createReplaceRootVolumeTask_imageId' - The ID of the AMI to use to restore the root volume. The specified AMI
-- must have the same product code, billing information, architecture type,
-- and virtualization type as that of the instance.
--
-- If you want to restore the replacement volume from a specific snapshot,
-- or if you want to restore it to its launch state, omit this parameter.
--
-- 'snapshotId', 'createReplaceRootVolumeTask_snapshotId' - The ID of the snapshot from which to restore the replacement root
-- volume. The specified snapshot must be a snapshot that you previously
-- created from the original root volume.
--
-- If you want to restore the replacement root volume to the initial launch
-- state, or if you want to restore the replacement root volume from an
-- AMI, omit this parameter.
--
-- 'tagSpecifications', 'createReplaceRootVolumeTask_tagSpecifications' - The tags to apply to the root volume replacement task.
--
-- 'instanceId', 'createReplaceRootVolumeTask_instanceId' - The ID of the instance for which to replace the root volume.
newCreateReplaceRootVolumeTask ::
  -- | 'instanceId'
  Prelude.Text ->
  CreateReplaceRootVolumeTask
newCreateReplaceRootVolumeTask :: Text -> CreateReplaceRootVolumeTask
newCreateReplaceRootVolumeTask Text
pInstanceId_ =
  CreateReplaceRootVolumeTask'
    { $sel:clientToken:CreateReplaceRootVolumeTask' :: Maybe Text
clientToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: Maybe Bool
deleteReplacedRootVolume = forall a. Maybe a
Prelude.Nothing,
      $sel:dryRun:CreateReplaceRootVolumeTask' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:imageId:CreateReplaceRootVolumeTask' :: Maybe Text
imageId = forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotId:CreateReplaceRootVolumeTask' :: Maybe Text
snapshotId = forall a. Maybe a
Prelude.Nothing,
      $sel:tagSpecifications:CreateReplaceRootVolumeTask' :: Maybe [TagSpecification]
tagSpecifications = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:CreateReplaceRootVolumeTask' :: Text
instanceId = Text
pInstanceId_
    }

-- | Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request. If you do not specify a client token, a randomly
-- generated token is used for the request to ensure idempotency. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensuring idempotency>.
createReplaceRootVolumeTask_clientToken :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe Prelude.Text)
createReplaceRootVolumeTask_clientToken :: Lens' CreateReplaceRootVolumeTask (Maybe Text)
createReplaceRootVolumeTask_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe Text
a -> CreateReplaceRootVolumeTask
s {$sel:clientToken:CreateReplaceRootVolumeTask' :: Maybe Text
clientToken = Maybe Text
a} :: CreateReplaceRootVolumeTask)

-- | Indicates whether to automatically delete the original root volume after
-- the root volume replacement task completes. To delete the original root
-- volume, specify @true@. If you choose to keep the original root volume
-- after the replacement task completes, you must manually delete it when
-- you no longer need it.
createReplaceRootVolumeTask_deleteReplacedRootVolume :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe Prelude.Bool)
createReplaceRootVolumeTask_deleteReplacedRootVolume :: Lens' CreateReplaceRootVolumeTask (Maybe Bool)
createReplaceRootVolumeTask_deleteReplacedRootVolume = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe Bool
deleteReplacedRootVolume :: Maybe Bool
$sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
deleteReplacedRootVolume} -> Maybe Bool
deleteReplacedRootVolume) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe Bool
a -> CreateReplaceRootVolumeTask
s {$sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: Maybe Bool
deleteReplacedRootVolume = Maybe Bool
a} :: CreateReplaceRootVolumeTask)

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
createReplaceRootVolumeTask_dryRun :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe Prelude.Bool)
createReplaceRootVolumeTask_dryRun :: Lens' CreateReplaceRootVolumeTask (Maybe Bool)
createReplaceRootVolumeTask_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe Bool
a -> CreateReplaceRootVolumeTask
s {$sel:dryRun:CreateReplaceRootVolumeTask' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateReplaceRootVolumeTask)

-- | The ID of the AMI to use to restore the root volume. The specified AMI
-- must have the same product code, billing information, architecture type,
-- and virtualization type as that of the instance.
--
-- If you want to restore the replacement volume from a specific snapshot,
-- or if you want to restore it to its launch state, omit this parameter.
createReplaceRootVolumeTask_imageId :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe Prelude.Text)
createReplaceRootVolumeTask_imageId :: Lens' CreateReplaceRootVolumeTask (Maybe Text)
createReplaceRootVolumeTask_imageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe Text
imageId :: Maybe Text
$sel:imageId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
imageId} -> Maybe Text
imageId) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe Text
a -> CreateReplaceRootVolumeTask
s {$sel:imageId:CreateReplaceRootVolumeTask' :: Maybe Text
imageId = Maybe Text
a} :: CreateReplaceRootVolumeTask)

-- | The ID of the snapshot from which to restore the replacement root
-- volume. The specified snapshot must be a snapshot that you previously
-- created from the original root volume.
--
-- If you want to restore the replacement root volume to the initial launch
-- state, or if you want to restore the replacement root volume from an
-- AMI, omit this parameter.
createReplaceRootVolumeTask_snapshotId :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe Prelude.Text)
createReplaceRootVolumeTask_snapshotId :: Lens' CreateReplaceRootVolumeTask (Maybe Text)
createReplaceRootVolumeTask_snapshotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe Text
a -> CreateReplaceRootVolumeTask
s {$sel:snapshotId:CreateReplaceRootVolumeTask' :: Maybe Text
snapshotId = Maybe Text
a} :: CreateReplaceRootVolumeTask)

-- | The tags to apply to the root volume replacement task.
createReplaceRootVolumeTask_tagSpecifications :: Lens.Lens' CreateReplaceRootVolumeTask (Prelude.Maybe [TagSpecification])
createReplaceRootVolumeTask_tagSpecifications :: Lens' CreateReplaceRootVolumeTask (Maybe [TagSpecification])
createReplaceRootVolumeTask_tagSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Maybe [TagSpecification]
tagSpecifications :: Maybe [TagSpecification]
$sel:tagSpecifications:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe [TagSpecification]
tagSpecifications} -> Maybe [TagSpecification]
tagSpecifications) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Maybe [TagSpecification]
a -> CreateReplaceRootVolumeTask
s {$sel:tagSpecifications:CreateReplaceRootVolumeTask' :: Maybe [TagSpecification]
tagSpecifications = Maybe [TagSpecification]
a} :: CreateReplaceRootVolumeTask) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the instance for which to replace the root volume.
createReplaceRootVolumeTask_instanceId :: Lens.Lens' CreateReplaceRootVolumeTask Prelude.Text
createReplaceRootVolumeTask_instanceId :: Lens' CreateReplaceRootVolumeTask Text
createReplaceRootVolumeTask_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTask' {Text
instanceId :: Text
$sel:instanceId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Text
instanceId} -> Text
instanceId) (\s :: CreateReplaceRootVolumeTask
s@CreateReplaceRootVolumeTask' {} Text
a -> CreateReplaceRootVolumeTask
s {$sel:instanceId:CreateReplaceRootVolumeTask' :: Text
instanceId = Text
a} :: CreateReplaceRootVolumeTask)

instance Core.AWSRequest CreateReplaceRootVolumeTask where
  type
    AWSResponse CreateReplaceRootVolumeTask =
      CreateReplaceRootVolumeTaskResponse
  request :: (Service -> Service)
-> CreateReplaceRootVolumeTask
-> Request CreateReplaceRootVolumeTask
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateReplaceRootVolumeTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateReplaceRootVolumeTask)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ReplaceRootVolumeTask
-> Int -> CreateReplaceRootVolumeTaskResponse
CreateReplaceRootVolumeTaskResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"replaceRootVolumeTask")
            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 CreateReplaceRootVolumeTask where
  hashWithSalt :: Int -> CreateReplaceRootVolumeTask -> Int
hashWithSalt Int
_salt CreateReplaceRootVolumeTask' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Text
instanceId :: Text
tagSpecifications :: Maybe [TagSpecification]
snapshotId :: Maybe Text
imageId :: Maybe Text
dryRun :: Maybe Bool
deleteReplacedRootVolume :: Maybe Bool
clientToken :: Maybe Text
$sel:instanceId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Text
$sel:tagSpecifications:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe [TagSpecification]
$sel:snapshotId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:imageId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:dryRun:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:clientToken:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
deleteReplacedRootVolume
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
imageId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snapshotId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagSpecification]
tagSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData CreateReplaceRootVolumeTask where
  rnf :: CreateReplaceRootVolumeTask -> ()
rnf CreateReplaceRootVolumeTask' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Text
instanceId :: Text
tagSpecifications :: Maybe [TagSpecification]
snapshotId :: Maybe Text
imageId :: Maybe Text
dryRun :: Maybe Bool
deleteReplacedRootVolume :: Maybe Bool
clientToken :: Maybe Text
$sel:instanceId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Text
$sel:tagSpecifications:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe [TagSpecification]
$sel:snapshotId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:imageId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:dryRun:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:clientToken:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
deleteReplacedRootVolume
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
imageId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snapshotId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagSpecification]
tagSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

instance Data.ToHeaders CreateReplaceRootVolumeTask where
  toHeaders :: CreateReplaceRootVolumeTask -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery CreateReplaceRootVolumeTask where
  toQuery :: CreateReplaceRootVolumeTask -> QueryString
toQuery CreateReplaceRootVolumeTask' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Text
instanceId :: Text
tagSpecifications :: Maybe [TagSpecification]
snapshotId :: Maybe Text
imageId :: Maybe Text
dryRun :: Maybe Bool
deleteReplacedRootVolume :: Maybe Bool
clientToken :: Maybe Text
$sel:instanceId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Text
$sel:tagSpecifications:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe [TagSpecification]
$sel:snapshotId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:imageId:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
$sel:dryRun:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:deleteReplacedRootVolume:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Bool
$sel:clientToken:CreateReplaceRootVolumeTask' :: CreateReplaceRootVolumeTask -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"CreateReplaceRootVolumeTask" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"ClientToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
clientToken,
        ByteString
"DeleteReplacedRootVolume"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
deleteReplacedRootVolume,
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"ImageId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
imageId,
        ByteString
"SnapshotId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
snapshotId,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagSpecification"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagSpecification]
tagSpecifications
          ),
        ByteString
"InstanceId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
instanceId
      ]

-- | /See:/ 'newCreateReplaceRootVolumeTaskResponse' smart constructor.
data CreateReplaceRootVolumeTaskResponse = CreateReplaceRootVolumeTaskResponse'
  { -- | Information about the root volume replacement task.
    CreateReplaceRootVolumeTaskResponse -> Maybe ReplaceRootVolumeTask
replaceRootVolumeTask :: Prelude.Maybe ReplaceRootVolumeTask,
    -- | The response's http status code.
    CreateReplaceRootVolumeTaskResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateReplaceRootVolumeTaskResponse
-> CreateReplaceRootVolumeTaskResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReplaceRootVolumeTaskResponse
-> CreateReplaceRootVolumeTaskResponse -> Bool
$c/= :: CreateReplaceRootVolumeTaskResponse
-> CreateReplaceRootVolumeTaskResponse -> Bool
== :: CreateReplaceRootVolumeTaskResponse
-> CreateReplaceRootVolumeTaskResponse -> Bool
$c== :: CreateReplaceRootVolumeTaskResponse
-> CreateReplaceRootVolumeTaskResponse -> Bool
Prelude.Eq, ReadPrec [CreateReplaceRootVolumeTaskResponse]
ReadPrec CreateReplaceRootVolumeTaskResponse
Int -> ReadS CreateReplaceRootVolumeTaskResponse
ReadS [CreateReplaceRootVolumeTaskResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReplaceRootVolumeTaskResponse]
$creadListPrec :: ReadPrec [CreateReplaceRootVolumeTaskResponse]
readPrec :: ReadPrec CreateReplaceRootVolumeTaskResponse
$creadPrec :: ReadPrec CreateReplaceRootVolumeTaskResponse
readList :: ReadS [CreateReplaceRootVolumeTaskResponse]
$creadList :: ReadS [CreateReplaceRootVolumeTaskResponse]
readsPrec :: Int -> ReadS CreateReplaceRootVolumeTaskResponse
$creadsPrec :: Int -> ReadS CreateReplaceRootVolumeTaskResponse
Prelude.Read, Int -> CreateReplaceRootVolumeTaskResponse -> ShowS
[CreateReplaceRootVolumeTaskResponse] -> ShowS
CreateReplaceRootVolumeTaskResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReplaceRootVolumeTaskResponse] -> ShowS
$cshowList :: [CreateReplaceRootVolumeTaskResponse] -> ShowS
show :: CreateReplaceRootVolumeTaskResponse -> String
$cshow :: CreateReplaceRootVolumeTaskResponse -> String
showsPrec :: Int -> CreateReplaceRootVolumeTaskResponse -> ShowS
$cshowsPrec :: Int -> CreateReplaceRootVolumeTaskResponse -> ShowS
Prelude.Show, forall x.
Rep CreateReplaceRootVolumeTaskResponse x
-> CreateReplaceRootVolumeTaskResponse
forall x.
CreateReplaceRootVolumeTaskResponse
-> Rep CreateReplaceRootVolumeTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReplaceRootVolumeTaskResponse x
-> CreateReplaceRootVolumeTaskResponse
$cfrom :: forall x.
CreateReplaceRootVolumeTaskResponse
-> Rep CreateReplaceRootVolumeTaskResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateReplaceRootVolumeTaskResponse' 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:
--
-- 'replaceRootVolumeTask', 'createReplaceRootVolumeTaskResponse_replaceRootVolumeTask' - Information about the root volume replacement task.
--
-- 'httpStatus', 'createReplaceRootVolumeTaskResponse_httpStatus' - The response's http status code.
newCreateReplaceRootVolumeTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateReplaceRootVolumeTaskResponse
newCreateReplaceRootVolumeTaskResponse :: Int -> CreateReplaceRootVolumeTaskResponse
newCreateReplaceRootVolumeTaskResponse Int
pHttpStatus_ =
  CreateReplaceRootVolumeTaskResponse'
    { $sel:replaceRootVolumeTask:CreateReplaceRootVolumeTaskResponse' :: Maybe ReplaceRootVolumeTask
replaceRootVolumeTask =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateReplaceRootVolumeTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the root volume replacement task.
createReplaceRootVolumeTaskResponse_replaceRootVolumeTask :: Lens.Lens' CreateReplaceRootVolumeTaskResponse (Prelude.Maybe ReplaceRootVolumeTask)
createReplaceRootVolumeTaskResponse_replaceRootVolumeTask :: Lens'
  CreateReplaceRootVolumeTaskResponse (Maybe ReplaceRootVolumeTask)
createReplaceRootVolumeTaskResponse_replaceRootVolumeTask = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTaskResponse' {Maybe ReplaceRootVolumeTask
replaceRootVolumeTask :: Maybe ReplaceRootVolumeTask
$sel:replaceRootVolumeTask:CreateReplaceRootVolumeTaskResponse' :: CreateReplaceRootVolumeTaskResponse -> Maybe ReplaceRootVolumeTask
replaceRootVolumeTask} -> Maybe ReplaceRootVolumeTask
replaceRootVolumeTask) (\s :: CreateReplaceRootVolumeTaskResponse
s@CreateReplaceRootVolumeTaskResponse' {} Maybe ReplaceRootVolumeTask
a -> CreateReplaceRootVolumeTaskResponse
s {$sel:replaceRootVolumeTask:CreateReplaceRootVolumeTaskResponse' :: Maybe ReplaceRootVolumeTask
replaceRootVolumeTask = Maybe ReplaceRootVolumeTask
a} :: CreateReplaceRootVolumeTaskResponse)

-- | The response's http status code.
createReplaceRootVolumeTaskResponse_httpStatus :: Lens.Lens' CreateReplaceRootVolumeTaskResponse Prelude.Int
createReplaceRootVolumeTaskResponse_httpStatus :: Lens' CreateReplaceRootVolumeTaskResponse Int
createReplaceRootVolumeTaskResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplaceRootVolumeTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateReplaceRootVolumeTaskResponse' :: CreateReplaceRootVolumeTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateReplaceRootVolumeTaskResponse
s@CreateReplaceRootVolumeTaskResponse' {} Int
a -> CreateReplaceRootVolumeTaskResponse
s {$sel:httpStatus:CreateReplaceRootVolumeTaskResponse' :: Int
httpStatus = Int
a} :: CreateReplaceRootVolumeTaskResponse)

instance
  Prelude.NFData
    CreateReplaceRootVolumeTaskResponse
  where
  rnf :: CreateReplaceRootVolumeTaskResponse -> ()
rnf CreateReplaceRootVolumeTaskResponse' {Int
Maybe ReplaceRootVolumeTask
httpStatus :: Int
replaceRootVolumeTask :: Maybe ReplaceRootVolumeTask
$sel:httpStatus:CreateReplaceRootVolumeTaskResponse' :: CreateReplaceRootVolumeTaskResponse -> Int
$sel:replaceRootVolumeTask:CreateReplaceRootVolumeTaskResponse' :: CreateReplaceRootVolumeTaskResponse -> Maybe ReplaceRootVolumeTask
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplaceRootVolumeTask
replaceRootVolumeTask
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus