{-# 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.MigrationHub.DeleteProgressUpdateStream
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a progress update stream, including all of its tasks, which was
-- previously created as an AWS resource used for access control. This API
-- has the following traits:
--
-- -   The only parameter needed for @DeleteProgressUpdateStream@ is the
--     stream name (same as a @CreateProgressUpdateStream@ call).
--
-- -   The call will return, and a background process will asynchronously
--     delete the stream and all of its resources (tasks, associated
--     resources, resource attributes, created artifacts).
--
-- -   If the stream takes time to be deleted, it might still show up on a
--     @ListProgressUpdateStreams@ call.
--
-- -   @CreateProgressUpdateStream@, @ImportMigrationTask@,
--     @NotifyMigrationTaskState@, and all Associate[*] APIs related to the
--     tasks belonging to the stream will throw \"InvalidInputException\"
--     if the stream of the same name is in the process of being deleted.
--
-- -   Once the stream and all of its resources are deleted,
--     @CreateProgressUpdateStream@ for a stream of the same name will
--     succeed, and that stream will be an entirely new logical resource
--     (without any resources associated with the old stream).
module Amazonka.MigrationHub.DeleteProgressUpdateStream
  ( -- * Creating a Request
    DeleteProgressUpdateStream (..),
    newDeleteProgressUpdateStream,

    -- * Request Lenses
    deleteProgressUpdateStream_dryRun,
    deleteProgressUpdateStream_progressUpdateStreamName,

    -- * Destructuring the Response
    DeleteProgressUpdateStreamResponse (..),
    newDeleteProgressUpdateStreamResponse,

    -- * Response Lenses
    deleteProgressUpdateStreamResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteProgressUpdateStream' smart constructor.
data DeleteProgressUpdateStream = DeleteProgressUpdateStream'
  { -- | Optional boolean flag to indicate whether any effect should take place.
    -- Used to test if the caller has permission to make the call.
    DeleteProgressUpdateStream -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The name of the ProgressUpdateStream. /Do not store personal data in
    -- this field./
    DeleteProgressUpdateStream -> Text
progressUpdateStreamName :: Prelude.Text
  }
  deriving (DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool
$c/= :: DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool
== :: DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool
$c== :: DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool
Prelude.Eq, ReadPrec [DeleteProgressUpdateStream]
ReadPrec DeleteProgressUpdateStream
Int -> ReadS DeleteProgressUpdateStream
ReadS [DeleteProgressUpdateStream]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProgressUpdateStream]
$creadListPrec :: ReadPrec [DeleteProgressUpdateStream]
readPrec :: ReadPrec DeleteProgressUpdateStream
$creadPrec :: ReadPrec DeleteProgressUpdateStream
readList :: ReadS [DeleteProgressUpdateStream]
$creadList :: ReadS [DeleteProgressUpdateStream]
readsPrec :: Int -> ReadS DeleteProgressUpdateStream
$creadsPrec :: Int -> ReadS DeleteProgressUpdateStream
Prelude.Read, Int -> DeleteProgressUpdateStream -> ShowS
[DeleteProgressUpdateStream] -> ShowS
DeleteProgressUpdateStream -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProgressUpdateStream] -> ShowS
$cshowList :: [DeleteProgressUpdateStream] -> ShowS
show :: DeleteProgressUpdateStream -> String
$cshow :: DeleteProgressUpdateStream -> String
showsPrec :: Int -> DeleteProgressUpdateStream -> ShowS
$cshowsPrec :: Int -> DeleteProgressUpdateStream -> ShowS
Prelude.Show, forall x.
Rep DeleteProgressUpdateStream x -> DeleteProgressUpdateStream
forall x.
DeleteProgressUpdateStream -> Rep DeleteProgressUpdateStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteProgressUpdateStream x -> DeleteProgressUpdateStream
$cfrom :: forall x.
DeleteProgressUpdateStream -> Rep DeleteProgressUpdateStream x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProgressUpdateStream' 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:
--
-- 'dryRun', 'deleteProgressUpdateStream_dryRun' - Optional boolean flag to indicate whether any effect should take place.
-- Used to test if the caller has permission to make the call.
--
-- 'progressUpdateStreamName', 'deleteProgressUpdateStream_progressUpdateStreamName' - The name of the ProgressUpdateStream. /Do not store personal data in
-- this field./
newDeleteProgressUpdateStream ::
  -- | 'progressUpdateStreamName'
  Prelude.Text ->
  DeleteProgressUpdateStream
newDeleteProgressUpdateStream :: Text -> DeleteProgressUpdateStream
newDeleteProgressUpdateStream
  Text
pProgressUpdateStreamName_ =
    DeleteProgressUpdateStream'
      { $sel:dryRun:DeleteProgressUpdateStream' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: Text
progressUpdateStreamName =
          Text
pProgressUpdateStreamName_
      }

-- | Optional boolean flag to indicate whether any effect should take place.
-- Used to test if the caller has permission to make the call.
deleteProgressUpdateStream_dryRun :: Lens.Lens' DeleteProgressUpdateStream (Prelude.Maybe Prelude.Bool)
deleteProgressUpdateStream_dryRun :: Lens' DeleteProgressUpdateStream (Maybe Bool)
deleteProgressUpdateStream_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProgressUpdateStream' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DeleteProgressUpdateStream
s@DeleteProgressUpdateStream' {} Maybe Bool
a -> DeleteProgressUpdateStream
s {$sel:dryRun:DeleteProgressUpdateStream' :: Maybe Bool
dryRun = Maybe Bool
a} :: DeleteProgressUpdateStream)

-- | The name of the ProgressUpdateStream. /Do not store personal data in
-- this field./
deleteProgressUpdateStream_progressUpdateStreamName :: Lens.Lens' DeleteProgressUpdateStream Prelude.Text
deleteProgressUpdateStream_progressUpdateStreamName :: Lens' DeleteProgressUpdateStream Text
deleteProgressUpdateStream_progressUpdateStreamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProgressUpdateStream' {Text
progressUpdateStreamName :: Text
$sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Text
progressUpdateStreamName} -> Text
progressUpdateStreamName) (\s :: DeleteProgressUpdateStream
s@DeleteProgressUpdateStream' {} Text
a -> DeleteProgressUpdateStream
s {$sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: Text
progressUpdateStreamName = Text
a} :: DeleteProgressUpdateStream)

instance Core.AWSRequest DeleteProgressUpdateStream where
  type
    AWSResponse DeleteProgressUpdateStream =
      DeleteProgressUpdateStreamResponse
  request :: (Service -> Service)
-> DeleteProgressUpdateStream -> Request DeleteProgressUpdateStream
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteProgressUpdateStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProgressUpdateStream)))
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 -> DeleteProgressUpdateStreamResponse
DeleteProgressUpdateStreamResponse'
            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 DeleteProgressUpdateStream where
  hashWithSalt :: Int -> DeleteProgressUpdateStream -> Int
hashWithSalt Int
_salt DeleteProgressUpdateStream' {Maybe Bool
Text
progressUpdateStreamName :: Text
dryRun :: Maybe Bool
$sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Text
$sel:dryRun:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
progressUpdateStreamName

instance Prelude.NFData DeleteProgressUpdateStream where
  rnf :: DeleteProgressUpdateStream -> ()
rnf DeleteProgressUpdateStream' {Maybe Bool
Text
progressUpdateStreamName :: Text
dryRun :: Maybe Bool
$sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Text
$sel:dryRun:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Maybe Bool
..} =
    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 Text
progressUpdateStreamName

instance Data.ToHeaders DeleteProgressUpdateStream where
  toHeaders :: DeleteProgressUpdateStream -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSMigrationHub.DeleteProgressUpdateStream" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteProgressUpdateStream where
  toJSON :: DeleteProgressUpdateStream -> Value
toJSON DeleteProgressUpdateStream' {Maybe Bool
Text
progressUpdateStreamName :: Text
dryRun :: Maybe Bool
$sel:progressUpdateStreamName:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Text
$sel:dryRun:DeleteProgressUpdateStream' :: DeleteProgressUpdateStream -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DryRun" 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 Bool
dryRun,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ProgressUpdateStreamName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
progressUpdateStreamName
              )
          ]
      )

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

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

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

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

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

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