{-# 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.GetEventStream
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about the event stream settings for an
-- application.
module Amazonka.Pinpoint.GetEventStream
  ( -- * Creating a Request
    GetEventStream (..),
    newGetEventStream,

    -- * Request Lenses
    getEventStream_applicationId,

    -- * Destructuring the Response
    GetEventStreamResponse (..),
    newGetEventStreamResponse,

    -- * Response Lenses
    getEventStreamResponse_httpStatus,
    getEventStreamResponse_eventStream,
  )
where

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

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

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

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

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

instance Prelude.Hashable GetEventStream where
  hashWithSalt :: Int -> GetEventStream -> Int
hashWithSalt Int
_salt GetEventStream' {Text
applicationId :: Text
$sel:applicationId:GetEventStream' :: GetEventStream -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

instance Prelude.NFData GetEventStream where
  rnf :: GetEventStream -> ()
rnf GetEventStream' {Text
applicationId :: Text
$sel:applicationId:GetEventStream' :: GetEventStream -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId

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

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

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

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

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

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

instance Prelude.NFData GetEventStreamResponse where
  rnf :: GetEventStreamResponse -> ()
rnf GetEventStreamResponse' {Int
EventStream
eventStream :: EventStream
httpStatus :: Int
$sel:eventStream:GetEventStreamResponse' :: GetEventStreamResponse -> EventStream
$sel:httpStatus:GetEventStreamResponse' :: GetEventStreamResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EventStream
eventStream