{-# 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.MigrationHubOrchestrator.DeleteWorkflowStep
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete a step in a migration workflow. Pause the workflow to delete a
-- running step.
module Amazonka.MigrationHubOrchestrator.DeleteWorkflowStep
  ( -- * Creating a Request
    DeleteWorkflowStep (..),
    newDeleteWorkflowStep,

    -- * Request Lenses
    deleteWorkflowStep_id,
    deleteWorkflowStep_stepGroupId,
    deleteWorkflowStep_workflowId,

    -- * Destructuring the Response
    DeleteWorkflowStepResponse (..),
    newDeleteWorkflowStepResponse,

    -- * Response Lenses
    deleteWorkflowStepResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteWorkflowStep' smart constructor.
data DeleteWorkflowStep = DeleteWorkflowStep'
  { -- | The ID of the step you want to delete.
    DeleteWorkflowStep -> Text
id :: Prelude.Text,
    -- | The ID of the step group that contains the step you want to delete.
    DeleteWorkflowStep -> Text
stepGroupId :: Prelude.Text,
    -- | The ID of the migration workflow.
    DeleteWorkflowStep -> Text
workflowId :: Prelude.Text
  }
  deriving (DeleteWorkflowStep -> DeleteWorkflowStep -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteWorkflowStep -> DeleteWorkflowStep -> Bool
$c/= :: DeleteWorkflowStep -> DeleteWorkflowStep -> Bool
== :: DeleteWorkflowStep -> DeleteWorkflowStep -> Bool
$c== :: DeleteWorkflowStep -> DeleteWorkflowStep -> Bool
Prelude.Eq, ReadPrec [DeleteWorkflowStep]
ReadPrec DeleteWorkflowStep
Int -> ReadS DeleteWorkflowStep
ReadS [DeleteWorkflowStep]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteWorkflowStep]
$creadListPrec :: ReadPrec [DeleteWorkflowStep]
readPrec :: ReadPrec DeleteWorkflowStep
$creadPrec :: ReadPrec DeleteWorkflowStep
readList :: ReadS [DeleteWorkflowStep]
$creadList :: ReadS [DeleteWorkflowStep]
readsPrec :: Int -> ReadS DeleteWorkflowStep
$creadsPrec :: Int -> ReadS DeleteWorkflowStep
Prelude.Read, Int -> DeleteWorkflowStep -> ShowS
[DeleteWorkflowStep] -> ShowS
DeleteWorkflowStep -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteWorkflowStep] -> ShowS
$cshowList :: [DeleteWorkflowStep] -> ShowS
show :: DeleteWorkflowStep -> String
$cshow :: DeleteWorkflowStep -> String
showsPrec :: Int -> DeleteWorkflowStep -> ShowS
$cshowsPrec :: Int -> DeleteWorkflowStep -> ShowS
Prelude.Show, forall x. Rep DeleteWorkflowStep x -> DeleteWorkflowStep
forall x. DeleteWorkflowStep -> Rep DeleteWorkflowStep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteWorkflowStep x -> DeleteWorkflowStep
$cfrom :: forall x. DeleteWorkflowStep -> Rep DeleteWorkflowStep x
Prelude.Generic)

-- |
-- Create a value of 'DeleteWorkflowStep' 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:
--
-- 'id', 'deleteWorkflowStep_id' - The ID of the step you want to delete.
--
-- 'stepGroupId', 'deleteWorkflowStep_stepGroupId' - The ID of the step group that contains the step you want to delete.
--
-- 'workflowId', 'deleteWorkflowStep_workflowId' - The ID of the migration workflow.
newDeleteWorkflowStep ::
  -- | 'id'
  Prelude.Text ->
  -- | 'stepGroupId'
  Prelude.Text ->
  -- | 'workflowId'
  Prelude.Text ->
  DeleteWorkflowStep
newDeleteWorkflowStep :: Text -> Text -> Text -> DeleteWorkflowStep
newDeleteWorkflowStep Text
pId_ Text
pStepGroupId_ Text
pWorkflowId_ =
  DeleteWorkflowStep'
    { $sel:id:DeleteWorkflowStep' :: Text
id = Text
pId_,
      $sel:stepGroupId:DeleteWorkflowStep' :: Text
stepGroupId = Text
pStepGroupId_,
      $sel:workflowId:DeleteWorkflowStep' :: Text
workflowId = Text
pWorkflowId_
    }

-- | The ID of the step you want to delete.
deleteWorkflowStep_id :: Lens.Lens' DeleteWorkflowStep Prelude.Text
deleteWorkflowStep_id :: Lens' DeleteWorkflowStep Text
deleteWorkflowStep_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkflowStep' {Text
id :: Text
$sel:id:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
id} -> Text
id) (\s :: DeleteWorkflowStep
s@DeleteWorkflowStep' {} Text
a -> DeleteWorkflowStep
s {$sel:id:DeleteWorkflowStep' :: Text
id = Text
a} :: DeleteWorkflowStep)

-- | The ID of the step group that contains the step you want to delete.
deleteWorkflowStep_stepGroupId :: Lens.Lens' DeleteWorkflowStep Prelude.Text
deleteWorkflowStep_stepGroupId :: Lens' DeleteWorkflowStep Text
deleteWorkflowStep_stepGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkflowStep' {Text
stepGroupId :: Text
$sel:stepGroupId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
stepGroupId} -> Text
stepGroupId) (\s :: DeleteWorkflowStep
s@DeleteWorkflowStep' {} Text
a -> DeleteWorkflowStep
s {$sel:stepGroupId:DeleteWorkflowStep' :: Text
stepGroupId = Text
a} :: DeleteWorkflowStep)

-- | The ID of the migration workflow.
deleteWorkflowStep_workflowId :: Lens.Lens' DeleteWorkflowStep Prelude.Text
deleteWorkflowStep_workflowId :: Lens' DeleteWorkflowStep Text
deleteWorkflowStep_workflowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkflowStep' {Text
workflowId :: Text
$sel:workflowId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
workflowId} -> Text
workflowId) (\s :: DeleteWorkflowStep
s@DeleteWorkflowStep' {} Text
a -> DeleteWorkflowStep
s {$sel:workflowId:DeleteWorkflowStep' :: Text
workflowId = Text
a} :: DeleteWorkflowStep)

instance Core.AWSRequest DeleteWorkflowStep where
  type
    AWSResponse DeleteWorkflowStep =
      DeleteWorkflowStepResponse
  request :: (Service -> Service)
-> DeleteWorkflowStep -> Request DeleteWorkflowStep
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteWorkflowStep
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteWorkflowStep)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteWorkflowStepResponse
DeleteWorkflowStepResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteWorkflowStep where
  hashWithSalt :: Int -> DeleteWorkflowStep -> Int
hashWithSalt Int
_salt DeleteWorkflowStep' {Text
workflowId :: Text
stepGroupId :: Text
id :: Text
$sel:workflowId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:stepGroupId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:id:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stepGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workflowId

instance Prelude.NFData DeleteWorkflowStep where
  rnf :: DeleteWorkflowStep -> ()
rnf DeleteWorkflowStep' {Text
workflowId :: Text
stepGroupId :: Text
id :: Text
$sel:workflowId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:stepGroupId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:id:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stepGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workflowId

instance Data.ToHeaders DeleteWorkflowStep where
  toHeaders :: DeleteWorkflowStep -> 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.ToPath DeleteWorkflowStep where
  toPath :: DeleteWorkflowStep -> ByteString
toPath DeleteWorkflowStep' {Text
workflowId :: Text
stepGroupId :: Text
id :: Text
$sel:workflowId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:stepGroupId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:id:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/workflowstep/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]

instance Data.ToQuery DeleteWorkflowStep where
  toQuery :: DeleteWorkflowStep -> QueryString
toQuery DeleteWorkflowStep' {Text
workflowId :: Text
stepGroupId :: Text
id :: Text
$sel:workflowId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:stepGroupId:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
$sel:id:DeleteWorkflowStep' :: DeleteWorkflowStep -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"stepGroupId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
stepGroupId,
        ByteString
"workflowId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
workflowId
      ]

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

-- |
-- Create a value of 'DeleteWorkflowStepResponse' 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:
--
-- 'httpStatus', 'deleteWorkflowStepResponse_httpStatus' - The response's http status code.
newDeleteWorkflowStepResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteWorkflowStepResponse
newDeleteWorkflowStepResponse :: Int -> DeleteWorkflowStepResponse
newDeleteWorkflowStepResponse Int
pHttpStatus_ =
  DeleteWorkflowStepResponse'
    { $sel:httpStatus:DeleteWorkflowStepResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteWorkflowStepResponse where
  rnf :: DeleteWorkflowStepResponse -> ()
rnf DeleteWorkflowStepResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteWorkflowStepResponse' :: DeleteWorkflowStepResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus