{-# 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.Pinpoint.DeleteEventStream
-- 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 the event stream for an application.
module Amazonka.Pinpoint.DeleteEventStream
  ( -- * Creating a Request
    DeleteEventStream (..),
    newDeleteEventStream,

    -- * Request Lenses
    deleteEventStream_applicationId,

    -- * Destructuring the Response
    DeleteEventStreamResponse (..),
    newDeleteEventStreamResponse,

    -- * Response Lenses
    deleteEventStreamResponse_httpStatus,
    deleteEventStreamResponse_eventStream,
  )
where

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

-- | /See:/ 'newDeleteEventStream' smart constructor.
data DeleteEventStream = DeleteEventStream'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    DeleteEventStream -> Text
applicationId :: Prelude.Text
  }
  deriving (DeleteEventStream -> DeleteEventStream -> Bool
(DeleteEventStream -> DeleteEventStream -> Bool)
-> (DeleteEventStream -> DeleteEventStream -> Bool)
-> Eq DeleteEventStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventStream -> DeleteEventStream -> Bool
$c/= :: DeleteEventStream -> DeleteEventStream -> Bool
== :: DeleteEventStream -> DeleteEventStream -> Bool
$c== :: DeleteEventStream -> DeleteEventStream -> Bool
Prelude.Eq, ReadPrec [DeleteEventStream]
ReadPrec DeleteEventStream
Int -> ReadS DeleteEventStream
ReadS [DeleteEventStream]
(Int -> ReadS DeleteEventStream)
-> ReadS [DeleteEventStream]
-> ReadPrec DeleteEventStream
-> ReadPrec [DeleteEventStream]
-> Read DeleteEventStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventStream]
$creadListPrec :: ReadPrec [DeleteEventStream]
readPrec :: ReadPrec DeleteEventStream
$creadPrec :: ReadPrec DeleteEventStream
readList :: ReadS [DeleteEventStream]
$creadList :: ReadS [DeleteEventStream]
readsPrec :: Int -> ReadS DeleteEventStream
$creadsPrec :: Int -> ReadS DeleteEventStream
Prelude.Read, Int -> DeleteEventStream -> ShowS
[DeleteEventStream] -> ShowS
DeleteEventStream -> String
(Int -> DeleteEventStream -> ShowS)
-> (DeleteEventStream -> String)
-> ([DeleteEventStream] -> ShowS)
-> Show DeleteEventStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventStream] -> ShowS
$cshowList :: [DeleteEventStream] -> ShowS
show :: DeleteEventStream -> String
$cshow :: DeleteEventStream -> String
showsPrec :: Int -> DeleteEventStream -> ShowS
$cshowsPrec :: Int -> DeleteEventStream -> ShowS
Prelude.Show, (forall x. DeleteEventStream -> Rep DeleteEventStream x)
-> (forall x. Rep DeleteEventStream x -> DeleteEventStream)
-> Generic DeleteEventStream
forall x. Rep DeleteEventStream x -> DeleteEventStream
forall x. DeleteEventStream -> Rep DeleteEventStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEventStream x -> DeleteEventStream
$cfrom :: forall x. DeleteEventStream -> Rep DeleteEventStream x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventStream' 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:
--
-- 'applicationId', 'deleteEventStream_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
newDeleteEventStream ::
  -- | 'applicationId'
  Prelude.Text ->
  DeleteEventStream
newDeleteEventStream :: Text -> DeleteEventStream
newDeleteEventStream Text
pApplicationId_ =
  DeleteEventStream' :: Text -> DeleteEventStream
DeleteEventStream' {$sel:applicationId:DeleteEventStream' :: Text
applicationId = Text
pApplicationId_}

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
deleteEventStream_applicationId :: Lens.Lens' DeleteEventStream Prelude.Text
deleteEventStream_applicationId :: (Text -> f Text) -> DeleteEventStream -> f DeleteEventStream
deleteEventStream_applicationId = (DeleteEventStream -> Text)
-> (DeleteEventStream -> Text -> DeleteEventStream)
-> Lens DeleteEventStream DeleteEventStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventStream' {Text
applicationId :: Text
$sel:applicationId:DeleteEventStream' :: DeleteEventStream -> Text
applicationId} -> Text
applicationId) (\s :: DeleteEventStream
s@DeleteEventStream' {} Text
a -> DeleteEventStream
s {$sel:applicationId:DeleteEventStream' :: Text
applicationId = Text
a} :: DeleteEventStream)

instance Core.AWSRequest DeleteEventStream where
  type
    AWSResponse DeleteEventStream =
      DeleteEventStreamResponse
  request :: DeleteEventStream -> Request DeleteEventStream
request = Service -> DeleteEventStream -> Request DeleteEventStream
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEventStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEventStream)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteEventStream))
-> Logger
-> Service
-> Proxy DeleteEventStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEventStream)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> EventStream -> DeleteEventStreamResponse
DeleteEventStreamResponse'
            (Int -> EventStream -> DeleteEventStreamResponse)
-> Either String Int
-> Either String (EventStream -> DeleteEventStreamResponse)
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))
            Either String (EventStream -> DeleteEventStreamResponse)
-> Either String EventStream
-> Either String DeleteEventStreamResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String EventStream
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteEventStream

instance Prelude.NFData DeleteEventStream

instance Core.ToHeaders DeleteEventStream where
  toHeaders :: DeleteEventStream -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEventStream -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteEventStream where
  toPath :: DeleteEventStream -> ByteString
toPath DeleteEventStream' {Text
applicationId :: Text
$sel:applicationId:DeleteEventStream' :: DeleteEventStream -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/eventstream"
      ]

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

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

-- |
-- Create a value of 'DeleteEventStreamResponse' 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', 'deleteEventStreamResponse_httpStatus' - The response's http status code.
--
-- 'eventStream', 'deleteEventStreamResponse_eventStream' - Undocumented member.
newDeleteEventStreamResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'eventStream'
  EventStream ->
  DeleteEventStreamResponse
newDeleteEventStreamResponse :: Int -> EventStream -> DeleteEventStreamResponse
newDeleteEventStreamResponse
  Int
pHttpStatus_
  EventStream
pEventStream_ =
    DeleteEventStreamResponse' :: Int -> EventStream -> DeleteEventStreamResponse
DeleteEventStreamResponse'
      { $sel:httpStatus:DeleteEventStreamResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:eventStream:DeleteEventStreamResponse' :: EventStream
eventStream = EventStream
pEventStream_
      }

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

-- | Undocumented member.
deleteEventStreamResponse_eventStream :: Lens.Lens' DeleteEventStreamResponse EventStream
deleteEventStreamResponse_eventStream :: (EventStream -> f EventStream)
-> DeleteEventStreamResponse -> f DeleteEventStreamResponse
deleteEventStreamResponse_eventStream = (DeleteEventStreamResponse -> EventStream)
-> (DeleteEventStreamResponse
    -> EventStream -> DeleteEventStreamResponse)
-> Lens
     DeleteEventStreamResponse
     DeleteEventStreamResponse
     EventStream
     EventStream
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventStreamResponse' {EventStream
eventStream :: EventStream
$sel:eventStream:DeleteEventStreamResponse' :: DeleteEventStreamResponse -> EventStream
eventStream} -> EventStream
eventStream) (\s :: DeleteEventStreamResponse
s@DeleteEventStreamResponse' {} EventStream
a -> DeleteEventStreamResponse
s {$sel:eventStream:DeleteEventStreamResponse' :: EventStream
eventStream = EventStream
a} :: DeleteEventStreamResponse)

instance Prelude.NFData DeleteEventStreamResponse