{-# 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.IoTAnalytics.DescribePipeline
-- 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)
--
-- Retrieves information about a pipeline.
module Amazonka.IoTAnalytics.DescribePipeline
  ( -- * Creating a Request
    DescribePipeline (..),
    newDescribePipeline,

    -- * Request Lenses
    describePipeline_pipelineName,

    -- * Destructuring the Response
    DescribePipelineResponse (..),
    newDescribePipelineResponse,

    -- * Response Lenses
    describePipelineResponse_pipeline,
    describePipelineResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.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:/ 'newDescribePipeline' smart constructor.
data DescribePipeline = DescribePipeline'
  { -- | The name of the pipeline whose information is retrieved.
    DescribePipeline -> Text
pipelineName :: Prelude.Text
  }
  deriving (DescribePipeline -> DescribePipeline -> Bool
(DescribePipeline -> DescribePipeline -> Bool)
-> (DescribePipeline -> DescribePipeline -> Bool)
-> Eq DescribePipeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePipeline -> DescribePipeline -> Bool
$c/= :: DescribePipeline -> DescribePipeline -> Bool
== :: DescribePipeline -> DescribePipeline -> Bool
$c== :: DescribePipeline -> DescribePipeline -> Bool
Prelude.Eq, ReadPrec [DescribePipeline]
ReadPrec DescribePipeline
Int -> ReadS DescribePipeline
ReadS [DescribePipeline]
(Int -> ReadS DescribePipeline)
-> ReadS [DescribePipeline]
-> ReadPrec DescribePipeline
-> ReadPrec [DescribePipeline]
-> Read DescribePipeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePipeline]
$creadListPrec :: ReadPrec [DescribePipeline]
readPrec :: ReadPrec DescribePipeline
$creadPrec :: ReadPrec DescribePipeline
readList :: ReadS [DescribePipeline]
$creadList :: ReadS [DescribePipeline]
readsPrec :: Int -> ReadS DescribePipeline
$creadsPrec :: Int -> ReadS DescribePipeline
Prelude.Read, Int -> DescribePipeline -> ShowS
[DescribePipeline] -> ShowS
DescribePipeline -> String
(Int -> DescribePipeline -> ShowS)
-> (DescribePipeline -> String)
-> ([DescribePipeline] -> ShowS)
-> Show DescribePipeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePipeline] -> ShowS
$cshowList :: [DescribePipeline] -> ShowS
show :: DescribePipeline -> String
$cshow :: DescribePipeline -> String
showsPrec :: Int -> DescribePipeline -> ShowS
$cshowsPrec :: Int -> DescribePipeline -> ShowS
Prelude.Show, (forall x. DescribePipeline -> Rep DescribePipeline x)
-> (forall x. Rep DescribePipeline x -> DescribePipeline)
-> Generic DescribePipeline
forall x. Rep DescribePipeline x -> DescribePipeline
forall x. DescribePipeline -> Rep DescribePipeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePipeline x -> DescribePipeline
$cfrom :: forall x. DescribePipeline -> Rep DescribePipeline x
Prelude.Generic)

-- |
-- Create a value of 'DescribePipeline' 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:
--
-- 'pipelineName', 'describePipeline_pipelineName' - The name of the pipeline whose information is retrieved.
newDescribePipeline ::
  -- | 'pipelineName'
  Prelude.Text ->
  DescribePipeline
newDescribePipeline :: Text -> DescribePipeline
newDescribePipeline Text
pPipelineName_ =
  DescribePipeline' :: Text -> DescribePipeline
DescribePipeline' {$sel:pipelineName:DescribePipeline' :: Text
pipelineName = Text
pPipelineName_}

-- | The name of the pipeline whose information is retrieved.
describePipeline_pipelineName :: Lens.Lens' DescribePipeline Prelude.Text
describePipeline_pipelineName :: (Text -> f Text) -> DescribePipeline -> f DescribePipeline
describePipeline_pipelineName = (DescribePipeline -> Text)
-> (DescribePipeline -> Text -> DescribePipeline)
-> Lens DescribePipeline DescribePipeline Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePipeline' {Text
pipelineName :: Text
$sel:pipelineName:DescribePipeline' :: DescribePipeline -> Text
pipelineName} -> Text
pipelineName) (\s :: DescribePipeline
s@DescribePipeline' {} Text
a -> DescribePipeline
s {$sel:pipelineName:DescribePipeline' :: Text
pipelineName = Text
a} :: DescribePipeline)

instance Core.AWSRequest DescribePipeline where
  type
    AWSResponse DescribePipeline =
      DescribePipelineResponse
  request :: DescribePipeline -> Request DescribePipeline
request = Service -> DescribePipeline -> Request DescribePipeline
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribePipeline)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribePipeline))
-> Logger
-> Service
-> Proxy DescribePipeline
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribePipeline)))
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 ->
          Maybe Pipeline -> Int -> DescribePipelineResponse
DescribePipelineResponse'
            (Maybe Pipeline -> Int -> DescribePipelineResponse)
-> Either String (Maybe Pipeline)
-> Either String (Int -> DescribePipelineResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Pipeline)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"pipeline")
            Either String (Int -> DescribePipelineResponse)
-> Either String Int -> Either String DescribePipelineResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribePipeline

instance Prelude.NFData DescribePipeline

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

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

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

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

-- |
-- Create a value of 'DescribePipelineResponse' 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:
--
-- 'pipeline', 'describePipelineResponse_pipeline' - A @Pipeline@ object that contains information about the pipeline.
--
-- 'httpStatus', 'describePipelineResponse_httpStatus' - The response's http status code.
newDescribePipelineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePipelineResponse
newDescribePipelineResponse :: Int -> DescribePipelineResponse
newDescribePipelineResponse Int
pHttpStatus_ =
  DescribePipelineResponse' :: Maybe Pipeline -> Int -> DescribePipelineResponse
DescribePipelineResponse'
    { $sel:pipeline:DescribePipelineResponse' :: Maybe Pipeline
pipeline =
        Maybe Pipeline
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A @Pipeline@ object that contains information about the pipeline.
describePipelineResponse_pipeline :: Lens.Lens' DescribePipelineResponse (Prelude.Maybe Pipeline)
describePipelineResponse_pipeline :: (Maybe Pipeline -> f (Maybe Pipeline))
-> DescribePipelineResponse -> f DescribePipelineResponse
describePipelineResponse_pipeline = (DescribePipelineResponse -> Maybe Pipeline)
-> (DescribePipelineResponse
    -> Maybe Pipeline -> DescribePipelineResponse)
-> Lens
     DescribePipelineResponse
     DescribePipelineResponse
     (Maybe Pipeline)
     (Maybe Pipeline)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePipelineResponse' {Maybe Pipeline
pipeline :: Maybe Pipeline
$sel:pipeline:DescribePipelineResponse' :: DescribePipelineResponse -> Maybe Pipeline
pipeline} -> Maybe Pipeline
pipeline) (\s :: DescribePipelineResponse
s@DescribePipelineResponse' {} Maybe Pipeline
a -> DescribePipelineResponse
s {$sel:pipeline:DescribePipelineResponse' :: Maybe Pipeline
pipeline = Maybe Pipeline
a} :: DescribePipelineResponse)

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

instance Prelude.NFData DescribePipelineResponse