{-# 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.IoT.DeleteStream
-- 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 stream.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteStream>
-- action.
module Amazonka.IoT.DeleteStream
  ( -- * Creating a Request
    DeleteStream (..),
    newDeleteStream,

    -- * Request Lenses
    deleteStream_streamId,

    -- * Destructuring the Response
    DeleteStreamResponse (..),
    newDeleteStreamResponse,

    -- * Response Lenses
    deleteStreamResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteStream' smart constructor.
data DeleteStream = DeleteStream'
  { -- | The stream ID.
    DeleteStream -> Text
streamId :: Prelude.Text
  }
  deriving (DeleteStream -> DeleteStream -> Bool
(DeleteStream -> DeleteStream -> Bool)
-> (DeleteStream -> DeleteStream -> Bool) -> Eq DeleteStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStream -> DeleteStream -> Bool
$c/= :: DeleteStream -> DeleteStream -> Bool
== :: DeleteStream -> DeleteStream -> Bool
$c== :: DeleteStream -> DeleteStream -> Bool
Prelude.Eq, ReadPrec [DeleteStream]
ReadPrec DeleteStream
Int -> ReadS DeleteStream
ReadS [DeleteStream]
(Int -> ReadS DeleteStream)
-> ReadS [DeleteStream]
-> ReadPrec DeleteStream
-> ReadPrec [DeleteStream]
-> Read DeleteStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStream]
$creadListPrec :: ReadPrec [DeleteStream]
readPrec :: ReadPrec DeleteStream
$creadPrec :: ReadPrec DeleteStream
readList :: ReadS [DeleteStream]
$creadList :: ReadS [DeleteStream]
readsPrec :: Int -> ReadS DeleteStream
$creadsPrec :: Int -> ReadS DeleteStream
Prelude.Read, Int -> DeleteStream -> ShowS
[DeleteStream] -> ShowS
DeleteStream -> String
(Int -> DeleteStream -> ShowS)
-> (DeleteStream -> String)
-> ([DeleteStream] -> ShowS)
-> Show DeleteStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStream] -> ShowS
$cshowList :: [DeleteStream] -> ShowS
show :: DeleteStream -> String
$cshow :: DeleteStream -> String
showsPrec :: Int -> DeleteStream -> ShowS
$cshowsPrec :: Int -> DeleteStream -> ShowS
Prelude.Show, (forall x. DeleteStream -> Rep DeleteStream x)
-> (forall x. Rep DeleteStream x -> DeleteStream)
-> Generic DeleteStream
forall x. Rep DeleteStream x -> DeleteStream
forall x. DeleteStream -> Rep DeleteStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStream x -> DeleteStream
$cfrom :: forall x. DeleteStream -> Rep DeleteStream x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStream' 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:
--
-- 'streamId', 'deleteStream_streamId' - The stream ID.
newDeleteStream ::
  -- | 'streamId'
  Prelude.Text ->
  DeleteStream
newDeleteStream :: Text -> DeleteStream
newDeleteStream Text
pStreamId_ =
  DeleteStream' :: Text -> DeleteStream
DeleteStream' {$sel:streamId:DeleteStream' :: Text
streamId = Text
pStreamId_}

-- | The stream ID.
deleteStream_streamId :: Lens.Lens' DeleteStream Prelude.Text
deleteStream_streamId :: (Text -> f Text) -> DeleteStream -> f DeleteStream
deleteStream_streamId = (DeleteStream -> Text)
-> (DeleteStream -> Text -> DeleteStream)
-> Lens DeleteStream DeleteStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStream' {Text
streamId :: Text
$sel:streamId:DeleteStream' :: DeleteStream -> Text
streamId} -> Text
streamId) (\s :: DeleteStream
s@DeleteStream' {} Text
a -> DeleteStream
s {$sel:streamId:DeleteStream' :: Text
streamId = Text
a} :: DeleteStream)

instance Core.AWSRequest DeleteStream where
  type AWSResponse DeleteStream = DeleteStreamResponse
  request :: DeleteStream -> Request DeleteStream
request = Service -> DeleteStream -> Request DeleteStream
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteStream)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteStream))
-> Logger
-> Service
-> Proxy DeleteStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteStream)))
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 -> DeleteStreamResponse
DeleteStreamResponse'
            (Int -> DeleteStreamResponse)
-> Either String Int -> Either String DeleteStreamResponse
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 DeleteStream

instance Prelude.NFData DeleteStream

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

instance Core.ToPath DeleteStream where
  toPath :: DeleteStream -> ByteString
toPath DeleteStream' {Text
streamId :: Text
$sel:streamId:DeleteStream' :: DeleteStream -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/streams/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
streamId]

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

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

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

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

instance Prelude.NFData DeleteStreamResponse