{-# 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 #-}
module Amazonka.MediaConnect.DescribeFlow
(
DescribeFlow (..),
newDescribeFlow,
describeFlow_flowArn,
DescribeFlowResponse (..),
newDescribeFlowResponse,
describeFlowResponse_flow,
describeFlowResponse_messages,
describeFlowResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeFlow = DescribeFlow'
{
DescribeFlow -> Text
flowArn :: Prelude.Text
}
deriving (DescribeFlow -> DescribeFlow -> Bool
(DescribeFlow -> DescribeFlow -> Bool)
-> (DescribeFlow -> DescribeFlow -> Bool) -> Eq DescribeFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFlow -> DescribeFlow -> Bool
$c/= :: DescribeFlow -> DescribeFlow -> Bool
== :: DescribeFlow -> DescribeFlow -> Bool
$c== :: DescribeFlow -> DescribeFlow -> Bool
Prelude.Eq, ReadPrec [DescribeFlow]
ReadPrec DescribeFlow
Int -> ReadS DescribeFlow
ReadS [DescribeFlow]
(Int -> ReadS DescribeFlow)
-> ReadS [DescribeFlow]
-> ReadPrec DescribeFlow
-> ReadPrec [DescribeFlow]
-> Read DescribeFlow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFlow]
$creadListPrec :: ReadPrec [DescribeFlow]
readPrec :: ReadPrec DescribeFlow
$creadPrec :: ReadPrec DescribeFlow
readList :: ReadS [DescribeFlow]
$creadList :: ReadS [DescribeFlow]
readsPrec :: Int -> ReadS DescribeFlow
$creadsPrec :: Int -> ReadS DescribeFlow
Prelude.Read, Int -> DescribeFlow -> ShowS
[DescribeFlow] -> ShowS
DescribeFlow -> String
(Int -> DescribeFlow -> ShowS)
-> (DescribeFlow -> String)
-> ([DescribeFlow] -> ShowS)
-> Show DescribeFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFlow] -> ShowS
$cshowList :: [DescribeFlow] -> ShowS
show :: DescribeFlow -> String
$cshow :: DescribeFlow -> String
showsPrec :: Int -> DescribeFlow -> ShowS
$cshowsPrec :: Int -> DescribeFlow -> ShowS
Prelude.Show, (forall x. DescribeFlow -> Rep DescribeFlow x)
-> (forall x. Rep DescribeFlow x -> DescribeFlow)
-> Generic DescribeFlow
forall x. Rep DescribeFlow x -> DescribeFlow
forall x. DescribeFlow -> Rep DescribeFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFlow x -> DescribeFlow
$cfrom :: forall x. DescribeFlow -> Rep DescribeFlow x
Prelude.Generic)
newDescribeFlow ::
Prelude.Text ->
DescribeFlow
newDescribeFlow :: Text -> DescribeFlow
newDescribeFlow Text
pFlowArn_ =
DescribeFlow' :: Text -> DescribeFlow
DescribeFlow' {$sel:flowArn:DescribeFlow' :: Text
flowArn = Text
pFlowArn_}
describeFlow_flowArn :: Lens.Lens' DescribeFlow Prelude.Text
describeFlow_flowArn :: (Text -> f Text) -> DescribeFlow -> f DescribeFlow
describeFlow_flowArn = (DescribeFlow -> Text)
-> (DescribeFlow -> Text -> DescribeFlow)
-> Lens DescribeFlow DescribeFlow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlow' {Text
flowArn :: Text
$sel:flowArn:DescribeFlow' :: DescribeFlow -> Text
flowArn} -> Text
flowArn) (\s :: DescribeFlow
s@DescribeFlow' {} Text
a -> DescribeFlow
s {$sel:flowArn:DescribeFlow' :: Text
flowArn = Text
a} :: DescribeFlow)
instance Core.AWSRequest DescribeFlow where
type AWSResponse DescribeFlow = DescribeFlowResponse
request :: DescribeFlow -> Request DescribeFlow
request = Service -> DescribeFlow -> Request DescribeFlow
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFlow)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeFlow))
-> Logger
-> Service
-> Proxy DescribeFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFlow)))
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 Flow -> Maybe Messages -> Int -> DescribeFlowResponse
DescribeFlowResponse'
(Maybe Flow -> Maybe Messages -> Int -> DescribeFlowResponse)
-> Either String (Maybe Flow)
-> Either String (Maybe Messages -> Int -> DescribeFlowResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Flow)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"flow")
Either String (Maybe Messages -> Int -> DescribeFlowResponse)
-> Either String (Maybe Messages)
-> Either String (Int -> DescribeFlowResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Messages)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"messages")
Either String (Int -> DescribeFlowResponse)
-> Either String Int -> Either String DescribeFlowResponse
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 DescribeFlow
instance Prelude.NFData DescribeFlow
instance Core.ToHeaders DescribeFlow where
toHeaders :: DescribeFlow -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeFlow -> 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 DescribeFlow where
toPath :: DescribeFlow -> ByteString
toPath DescribeFlow' {Text
flowArn :: Text
$sel:flowArn:DescribeFlow' :: DescribeFlow -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/flows/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
flowArn]
instance Core.ToQuery DescribeFlow where
toQuery :: DescribeFlow -> QueryString
toQuery = QueryString -> DescribeFlow -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeFlowResponse = DescribeFlowResponse'
{ DescribeFlowResponse -> Maybe Flow
flow :: Prelude.Maybe Flow,
DescribeFlowResponse -> Maybe Messages
messages :: Prelude.Maybe Messages,
DescribeFlowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeFlowResponse -> DescribeFlowResponse -> Bool
(DescribeFlowResponse -> DescribeFlowResponse -> Bool)
-> (DescribeFlowResponse -> DescribeFlowResponse -> Bool)
-> Eq DescribeFlowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFlowResponse -> DescribeFlowResponse -> Bool
$c/= :: DescribeFlowResponse -> DescribeFlowResponse -> Bool
== :: DescribeFlowResponse -> DescribeFlowResponse -> Bool
$c== :: DescribeFlowResponse -> DescribeFlowResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFlowResponse]
ReadPrec DescribeFlowResponse
Int -> ReadS DescribeFlowResponse
ReadS [DescribeFlowResponse]
(Int -> ReadS DescribeFlowResponse)
-> ReadS [DescribeFlowResponse]
-> ReadPrec DescribeFlowResponse
-> ReadPrec [DescribeFlowResponse]
-> Read DescribeFlowResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFlowResponse]
$creadListPrec :: ReadPrec [DescribeFlowResponse]
readPrec :: ReadPrec DescribeFlowResponse
$creadPrec :: ReadPrec DescribeFlowResponse
readList :: ReadS [DescribeFlowResponse]
$creadList :: ReadS [DescribeFlowResponse]
readsPrec :: Int -> ReadS DescribeFlowResponse
$creadsPrec :: Int -> ReadS DescribeFlowResponse
Prelude.Read, Int -> DescribeFlowResponse -> ShowS
[DescribeFlowResponse] -> ShowS
DescribeFlowResponse -> String
(Int -> DescribeFlowResponse -> ShowS)
-> (DescribeFlowResponse -> String)
-> ([DescribeFlowResponse] -> ShowS)
-> Show DescribeFlowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFlowResponse] -> ShowS
$cshowList :: [DescribeFlowResponse] -> ShowS
show :: DescribeFlowResponse -> String
$cshow :: DescribeFlowResponse -> String
showsPrec :: Int -> DescribeFlowResponse -> ShowS
$cshowsPrec :: Int -> DescribeFlowResponse -> ShowS
Prelude.Show, (forall x. DescribeFlowResponse -> Rep DescribeFlowResponse x)
-> (forall x. Rep DescribeFlowResponse x -> DescribeFlowResponse)
-> Generic DescribeFlowResponse
forall x. Rep DescribeFlowResponse x -> DescribeFlowResponse
forall x. DescribeFlowResponse -> Rep DescribeFlowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFlowResponse x -> DescribeFlowResponse
$cfrom :: forall x. DescribeFlowResponse -> Rep DescribeFlowResponse x
Prelude.Generic)
newDescribeFlowResponse ::
Prelude.Int ->
DescribeFlowResponse
newDescribeFlowResponse :: Int -> DescribeFlowResponse
newDescribeFlowResponse Int
pHttpStatus_ =
DescribeFlowResponse' :: Maybe Flow -> Maybe Messages -> Int -> DescribeFlowResponse
DescribeFlowResponse'
{ $sel:flow:DescribeFlowResponse' :: Maybe Flow
flow = Maybe Flow
forall a. Maybe a
Prelude.Nothing,
$sel:messages:DescribeFlowResponse' :: Maybe Messages
messages = Maybe Messages
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeFlowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeFlowResponse_flow :: Lens.Lens' DescribeFlowResponse (Prelude.Maybe Flow)
describeFlowResponse_flow :: (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
describeFlowResponse_flow = (DescribeFlowResponse -> Maybe Flow)
-> (DescribeFlowResponse -> Maybe Flow -> DescribeFlowResponse)
-> Lens
DescribeFlowResponse DescribeFlowResponse (Maybe Flow) (Maybe Flow)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowResponse' {Maybe Flow
flow :: Maybe Flow
$sel:flow:DescribeFlowResponse' :: DescribeFlowResponse -> Maybe Flow
flow} -> Maybe Flow
flow) (\s :: DescribeFlowResponse
s@DescribeFlowResponse' {} Maybe Flow
a -> DescribeFlowResponse
s {$sel:flow:DescribeFlowResponse' :: Maybe Flow
flow = Maybe Flow
a} :: DescribeFlowResponse)
describeFlowResponse_messages :: Lens.Lens' DescribeFlowResponse (Prelude.Maybe Messages)
describeFlowResponse_messages :: (Maybe Messages -> f (Maybe Messages))
-> DescribeFlowResponse -> f DescribeFlowResponse
describeFlowResponse_messages = (DescribeFlowResponse -> Maybe Messages)
-> (DescribeFlowResponse -> Maybe Messages -> DescribeFlowResponse)
-> Lens
DescribeFlowResponse
DescribeFlowResponse
(Maybe Messages)
(Maybe Messages)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowResponse' {Maybe Messages
messages :: Maybe Messages
$sel:messages:DescribeFlowResponse' :: DescribeFlowResponse -> Maybe Messages
messages} -> Maybe Messages
messages) (\s :: DescribeFlowResponse
s@DescribeFlowResponse' {} Maybe Messages
a -> DescribeFlowResponse
s {$sel:messages:DescribeFlowResponse' :: Maybe Messages
messages = Maybe Messages
a} :: DescribeFlowResponse)
describeFlowResponse_httpStatus :: Lens.Lens' DescribeFlowResponse Prelude.Int
describeFlowResponse_httpStatus :: (Int -> f Int) -> DescribeFlowResponse -> f DescribeFlowResponse
describeFlowResponse_httpStatus = (DescribeFlowResponse -> Int)
-> (DescribeFlowResponse -> Int -> DescribeFlowResponse)
-> Lens DescribeFlowResponse DescribeFlowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeFlowResponse' :: DescribeFlowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeFlowResponse
s@DescribeFlowResponse' {} Int
a -> DescribeFlowResponse
s {$sel:httpStatus:DescribeFlowResponse' :: Int
httpStatus = Int
a} :: DescribeFlowResponse)
instance Prelude.NFData DescribeFlowResponse