{-# 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.ElasticTranscoder.ReadPipeline
-- 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)
--
-- The ReadPipeline operation gets detailed information about a pipeline.
module Amazonka.ElasticTranscoder.ReadPipeline
  ( -- * Creating a Request
    ReadPipeline (..),
    newReadPipeline,

    -- * Request Lenses
    readPipeline_id,

    -- * Destructuring the Response
    ReadPipelineResponse (..),
    newReadPipelineResponse,

    -- * Response Lenses
    readPipelineResponse_warnings,
    readPipelineResponse_pipeline,
    readPipelineResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.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

-- | The @ReadPipelineRequest@ structure.
--
-- /See:/ 'newReadPipeline' smart constructor.
data ReadPipeline = ReadPipeline'
  { -- | The identifier of the pipeline to read.
    ReadPipeline -> Text
id :: Prelude.Text
  }
  deriving (ReadPipeline -> ReadPipeline -> Bool
(ReadPipeline -> ReadPipeline -> Bool)
-> (ReadPipeline -> ReadPipeline -> Bool) -> Eq ReadPipeline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReadPipeline -> ReadPipeline -> Bool
$c/= :: ReadPipeline -> ReadPipeline -> Bool
== :: ReadPipeline -> ReadPipeline -> Bool
$c== :: ReadPipeline -> ReadPipeline -> Bool
Prelude.Eq, ReadPrec [ReadPipeline]
ReadPrec ReadPipeline
Int -> ReadS ReadPipeline
ReadS [ReadPipeline]
(Int -> ReadS ReadPipeline)
-> ReadS [ReadPipeline]
-> ReadPrec ReadPipeline
-> ReadPrec [ReadPipeline]
-> Read ReadPipeline
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReadPipeline]
$creadListPrec :: ReadPrec [ReadPipeline]
readPrec :: ReadPrec ReadPipeline
$creadPrec :: ReadPrec ReadPipeline
readList :: ReadS [ReadPipeline]
$creadList :: ReadS [ReadPipeline]
readsPrec :: Int -> ReadS ReadPipeline
$creadsPrec :: Int -> ReadS ReadPipeline
Prelude.Read, Int -> ReadPipeline -> ShowS
[ReadPipeline] -> ShowS
ReadPipeline -> String
(Int -> ReadPipeline -> ShowS)
-> (ReadPipeline -> String)
-> ([ReadPipeline] -> ShowS)
-> Show ReadPipeline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReadPipeline] -> ShowS
$cshowList :: [ReadPipeline] -> ShowS
show :: ReadPipeline -> String
$cshow :: ReadPipeline -> String
showsPrec :: Int -> ReadPipeline -> ShowS
$cshowsPrec :: Int -> ReadPipeline -> ShowS
Prelude.Show, (forall x. ReadPipeline -> Rep ReadPipeline x)
-> (forall x. Rep ReadPipeline x -> ReadPipeline)
-> Generic ReadPipeline
forall x. Rep ReadPipeline x -> ReadPipeline
forall x. ReadPipeline -> Rep ReadPipeline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReadPipeline x -> ReadPipeline
$cfrom :: forall x. ReadPipeline -> Rep ReadPipeline x
Prelude.Generic)

-- |
-- Create a value of 'ReadPipeline' 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:
--
-- 'id', 'readPipeline_id' - The identifier of the pipeline to read.
newReadPipeline ::
  -- | 'id'
  Prelude.Text ->
  ReadPipeline
newReadPipeline :: Text -> ReadPipeline
newReadPipeline Text
pId_ = ReadPipeline' :: Text -> ReadPipeline
ReadPipeline' {$sel:id:ReadPipeline' :: Text
id = Text
pId_}

-- | The identifier of the pipeline to read.
readPipeline_id :: Lens.Lens' ReadPipeline Prelude.Text
readPipeline_id :: (Text -> f Text) -> ReadPipeline -> f ReadPipeline
readPipeline_id = (ReadPipeline -> Text)
-> (ReadPipeline -> Text -> ReadPipeline)
-> Lens ReadPipeline ReadPipeline Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPipeline' {Text
id :: Text
$sel:id:ReadPipeline' :: ReadPipeline -> Text
id} -> Text
id) (\s :: ReadPipeline
s@ReadPipeline' {} Text
a -> ReadPipeline
s {$sel:id:ReadPipeline' :: Text
id = Text
a} :: ReadPipeline)

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

instance Prelude.NFData ReadPipeline

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

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

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

-- | The @ReadPipelineResponse@ structure.
--
-- /See:/ 'newReadPipelineResponse' smart constructor.
data ReadPipelineResponse = ReadPipelineResponse'
  { -- | Elastic Transcoder returns a warning if the resources used by your
    -- pipeline are not in the same region as the pipeline.
    --
    -- Using resources in the same region, such as your Amazon S3 buckets,
    -- Amazon SNS notification topics, and AWS KMS key, reduces processing time
    -- and prevents cross-regional charges.
    ReadPipelineResponse -> Maybe [Warning]
warnings :: Prelude.Maybe [Warning],
    -- | A section of the response body that provides information about the
    -- pipeline.
    ReadPipelineResponse -> Maybe Pipeline
pipeline :: Prelude.Maybe Pipeline,
    -- | The response's http status code.
    ReadPipelineResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ReadPipelineResponse -> ReadPipelineResponse -> Bool
(ReadPipelineResponse -> ReadPipelineResponse -> Bool)
-> (ReadPipelineResponse -> ReadPipelineResponse -> Bool)
-> Eq ReadPipelineResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReadPipelineResponse -> ReadPipelineResponse -> Bool
$c/= :: ReadPipelineResponse -> ReadPipelineResponse -> Bool
== :: ReadPipelineResponse -> ReadPipelineResponse -> Bool
$c== :: ReadPipelineResponse -> ReadPipelineResponse -> Bool
Prelude.Eq, ReadPrec [ReadPipelineResponse]
ReadPrec ReadPipelineResponse
Int -> ReadS ReadPipelineResponse
ReadS [ReadPipelineResponse]
(Int -> ReadS ReadPipelineResponse)
-> ReadS [ReadPipelineResponse]
-> ReadPrec ReadPipelineResponse
-> ReadPrec [ReadPipelineResponse]
-> Read ReadPipelineResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReadPipelineResponse]
$creadListPrec :: ReadPrec [ReadPipelineResponse]
readPrec :: ReadPrec ReadPipelineResponse
$creadPrec :: ReadPrec ReadPipelineResponse
readList :: ReadS [ReadPipelineResponse]
$creadList :: ReadS [ReadPipelineResponse]
readsPrec :: Int -> ReadS ReadPipelineResponse
$creadsPrec :: Int -> ReadS ReadPipelineResponse
Prelude.Read, Int -> ReadPipelineResponse -> ShowS
[ReadPipelineResponse] -> ShowS
ReadPipelineResponse -> String
(Int -> ReadPipelineResponse -> ShowS)
-> (ReadPipelineResponse -> String)
-> ([ReadPipelineResponse] -> ShowS)
-> Show ReadPipelineResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReadPipelineResponse] -> ShowS
$cshowList :: [ReadPipelineResponse] -> ShowS
show :: ReadPipelineResponse -> String
$cshow :: ReadPipelineResponse -> String
showsPrec :: Int -> ReadPipelineResponse -> ShowS
$cshowsPrec :: Int -> ReadPipelineResponse -> ShowS
Prelude.Show, (forall x. ReadPipelineResponse -> Rep ReadPipelineResponse x)
-> (forall x. Rep ReadPipelineResponse x -> ReadPipelineResponse)
-> Generic ReadPipelineResponse
forall x. Rep ReadPipelineResponse x -> ReadPipelineResponse
forall x. ReadPipelineResponse -> Rep ReadPipelineResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReadPipelineResponse x -> ReadPipelineResponse
$cfrom :: forall x. ReadPipelineResponse -> Rep ReadPipelineResponse x
Prelude.Generic)

-- |
-- Create a value of 'ReadPipelineResponse' 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:
--
-- 'warnings', 'readPipelineResponse_warnings' - Elastic Transcoder returns a warning if the resources used by your
-- pipeline are not in the same region as the pipeline.
--
-- Using resources in the same region, such as your Amazon S3 buckets,
-- Amazon SNS notification topics, and AWS KMS key, reduces processing time
-- and prevents cross-regional charges.
--
-- 'pipeline', 'readPipelineResponse_pipeline' - A section of the response body that provides information about the
-- pipeline.
--
-- 'httpStatus', 'readPipelineResponse_httpStatus' - The response's http status code.
newReadPipelineResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ReadPipelineResponse
newReadPipelineResponse :: Int -> ReadPipelineResponse
newReadPipelineResponse Int
pHttpStatus_ =
  ReadPipelineResponse' :: Maybe [Warning] -> Maybe Pipeline -> Int -> ReadPipelineResponse
ReadPipelineResponse'
    { $sel:warnings:ReadPipelineResponse' :: Maybe [Warning]
warnings = Maybe [Warning]
forall a. Maybe a
Prelude.Nothing,
      $sel:pipeline:ReadPipelineResponse' :: Maybe Pipeline
pipeline = Maybe Pipeline
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ReadPipelineResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Elastic Transcoder returns a warning if the resources used by your
-- pipeline are not in the same region as the pipeline.
--
-- Using resources in the same region, such as your Amazon S3 buckets,
-- Amazon SNS notification topics, and AWS KMS key, reduces processing time
-- and prevents cross-regional charges.
readPipelineResponse_warnings :: Lens.Lens' ReadPipelineResponse (Prelude.Maybe [Warning])
readPipelineResponse_warnings :: (Maybe [Warning] -> f (Maybe [Warning]))
-> ReadPipelineResponse -> f ReadPipelineResponse
readPipelineResponse_warnings = (ReadPipelineResponse -> Maybe [Warning])
-> (ReadPipelineResponse
    -> Maybe [Warning] -> ReadPipelineResponse)
-> Lens
     ReadPipelineResponse
     ReadPipelineResponse
     (Maybe [Warning])
     (Maybe [Warning])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPipelineResponse' {Maybe [Warning]
warnings :: Maybe [Warning]
$sel:warnings:ReadPipelineResponse' :: ReadPipelineResponse -> Maybe [Warning]
warnings} -> Maybe [Warning]
warnings) (\s :: ReadPipelineResponse
s@ReadPipelineResponse' {} Maybe [Warning]
a -> ReadPipelineResponse
s {$sel:warnings:ReadPipelineResponse' :: Maybe [Warning]
warnings = Maybe [Warning]
a} :: ReadPipelineResponse) ((Maybe [Warning] -> f (Maybe [Warning]))
 -> ReadPipelineResponse -> f ReadPipelineResponse)
-> ((Maybe [Warning] -> f (Maybe [Warning]))
    -> Maybe [Warning] -> f (Maybe [Warning]))
-> (Maybe [Warning] -> f (Maybe [Warning]))
-> ReadPipelineResponse
-> f ReadPipelineResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Warning] [Warning] [Warning] [Warning]
-> Iso
     (Maybe [Warning])
     (Maybe [Warning])
     (Maybe [Warning])
     (Maybe [Warning])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Warning] [Warning] [Warning] [Warning]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A section of the response body that provides information about the
-- pipeline.
readPipelineResponse_pipeline :: Lens.Lens' ReadPipelineResponse (Prelude.Maybe Pipeline)
readPipelineResponse_pipeline :: (Maybe Pipeline -> f (Maybe Pipeline))
-> ReadPipelineResponse -> f ReadPipelineResponse
readPipelineResponse_pipeline = (ReadPipelineResponse -> Maybe Pipeline)
-> (ReadPipelineResponse -> Maybe Pipeline -> ReadPipelineResponse)
-> Lens
     ReadPipelineResponse
     ReadPipelineResponse
     (Maybe Pipeline)
     (Maybe Pipeline)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReadPipelineResponse' {Maybe Pipeline
pipeline :: Maybe Pipeline
$sel:pipeline:ReadPipelineResponse' :: ReadPipelineResponse -> Maybe Pipeline
pipeline} -> Maybe Pipeline
pipeline) (\s :: ReadPipelineResponse
s@ReadPipelineResponse' {} Maybe Pipeline
a -> ReadPipelineResponse
s {$sel:pipeline:ReadPipelineResponse' :: Maybe Pipeline
pipeline = Maybe Pipeline
a} :: ReadPipelineResponse)

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

instance Prelude.NFData ReadPipelineResponse