{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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
(DeleteProgressUpdateStream -> DeleteProgressUpdateStream -> Bool)
-> (DeleteProgressUpdateStream
    -> DeleteProgressUpdateStream -> Bool)
-> Eq DeleteProgressUpdateStream
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]
(Int -> ReadS DeleteProgressUpdateStream)
-> ReadS [DeleteProgressUpdateStream]
-> ReadPrec DeleteProgressUpdateStream
-> ReadPrec [DeleteProgressUpdateStream]
-> Read 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
(Int -> DeleteProgressUpdateStream -> ShowS)
-> (DeleteProgressUpdateStream -> String)
-> ([DeleteProgressUpdateStream] -> ShowS)
-> Show DeleteProgressUpdateStream
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.
 DeleteProgressUpdateStream -> Rep DeleteProgressUpdateStream x)
-> (forall x.
    Rep DeleteProgressUpdateStream x -> DeleteProgressUpdateStream)
-> Generic DeleteProgressUpdateStream
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' :: Maybe Bool -> Text -> DeleteProgressUpdateStream
DeleteProgressUpdateStream'
      { $sel:dryRun:DeleteProgressUpdateStream' :: Maybe Bool
dryRun =
          Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool))
-> DeleteProgressUpdateStream -> f DeleteProgressUpdateStream
deleteProgressUpdateStream_dryRun = (DeleteProgressUpdateStream -> Maybe Bool)
-> (DeleteProgressUpdateStream
    -> Maybe Bool -> DeleteProgressUpdateStream)
-> Lens
     DeleteProgressUpdateStream
     DeleteProgressUpdateStream
     (Maybe Bool)
     (Maybe Bool)
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 :: (Text -> f Text)
-> DeleteProgressUpdateStream -> f DeleteProgressUpdateStream
deleteProgressUpdateStream_progressUpdateStreamName = (DeleteProgressUpdateStream -> Text)
-> (DeleteProgressUpdateStream
    -> Text -> DeleteProgressUpdateStream)
-> Lens
     DeleteProgressUpdateStream DeleteProgressUpdateStream Text Text
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 :: DeleteProgressUpdateStream -> Request DeleteProgressUpdateStream
request = Service
-> DeleteProgressUpdateStream -> Request DeleteProgressUpdateStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteProgressUpdateStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProgressUpdateStream)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteProgressUpdateStream))
-> Logger
-> Service
-> Proxy DeleteProgressUpdateStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProgressUpdateStream)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteProgressUpdateStreamResponse
DeleteProgressUpdateStreamResponse'
            (Int -> DeleteProgressUpdateStreamResponse)
-> Either String Int
-> Either String DeleteProgressUpdateStreamResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteProgressUpdateStream

instance Prelude.NFData DeleteProgressUpdateStream

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

instance Core.ToJSON 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ProgressUpdateStreamName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
progressUpdateStreamName
              )
          ]
      )

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

instance Core.ToQuery DeleteProgressUpdateStream where
  toQuery :: DeleteProgressUpdateStream -> QueryString
toQuery = QueryString -> DeleteProgressUpdateStream -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteProgressUpdateStreamResponse
 -> DeleteProgressUpdateStreamResponse -> Bool)
-> (DeleteProgressUpdateStreamResponse
    -> DeleteProgressUpdateStreamResponse -> Bool)
-> Eq DeleteProgressUpdateStreamResponse
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]
(Int -> ReadS DeleteProgressUpdateStreamResponse)
-> ReadS [DeleteProgressUpdateStreamResponse]
-> ReadPrec DeleteProgressUpdateStreamResponse
-> ReadPrec [DeleteProgressUpdateStreamResponse]
-> Read 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
(Int -> DeleteProgressUpdateStreamResponse -> ShowS)
-> (DeleteProgressUpdateStreamResponse -> String)
-> ([DeleteProgressUpdateStreamResponse] -> ShowS)
-> Show DeleteProgressUpdateStreamResponse
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.
 DeleteProgressUpdateStreamResponse
 -> Rep DeleteProgressUpdateStreamResponse x)
-> (forall x.
    Rep DeleteProgressUpdateStreamResponse x
    -> DeleteProgressUpdateStreamResponse)
-> Generic DeleteProgressUpdateStreamResponse
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' :: Int -> DeleteProgressUpdateStreamResponse
DeleteProgressUpdateStreamResponse'
    { $sel:httpStatus:DeleteProgressUpdateStreamResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteProgressUpdateStreamResponse_httpStatus :: Lens.Lens' DeleteProgressUpdateStreamResponse Prelude.Int
deleteProgressUpdateStreamResponse_httpStatus :: (Int -> f Int)
-> DeleteProgressUpdateStreamResponse
-> f DeleteProgressUpdateStreamResponse
deleteProgressUpdateStreamResponse_httpStatus = (DeleteProgressUpdateStreamResponse -> Int)
-> (DeleteProgressUpdateStreamResponse
    -> Int -> DeleteProgressUpdateStreamResponse)
-> Lens
     DeleteProgressUpdateStreamResponse
     DeleteProgressUpdateStreamResponse
     Int
     Int
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