{-# 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.StartFlow
(
StartFlow (..),
newStartFlow,
startFlow_flowArn,
StartFlowResponse (..),
newStartFlowResponse,
startFlowResponse_flowArn,
startFlowResponse_status,
startFlowResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartFlow = StartFlow'
{
StartFlow -> Text
flowArn :: Prelude.Text
}
deriving (StartFlow -> StartFlow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFlow -> StartFlow -> Bool
$c/= :: StartFlow -> StartFlow -> Bool
== :: StartFlow -> StartFlow -> Bool
$c== :: StartFlow -> StartFlow -> Bool
Prelude.Eq, ReadPrec [StartFlow]
ReadPrec StartFlow
Int -> ReadS StartFlow
ReadS [StartFlow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartFlow]
$creadListPrec :: ReadPrec [StartFlow]
readPrec :: ReadPrec StartFlow
$creadPrec :: ReadPrec StartFlow
readList :: ReadS [StartFlow]
$creadList :: ReadS [StartFlow]
readsPrec :: Int -> ReadS StartFlow
$creadsPrec :: Int -> ReadS StartFlow
Prelude.Read, Int -> StartFlow -> ShowS
[StartFlow] -> ShowS
StartFlow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFlow] -> ShowS
$cshowList :: [StartFlow] -> ShowS
show :: StartFlow -> String
$cshow :: StartFlow -> String
showsPrec :: Int -> StartFlow -> ShowS
$cshowsPrec :: Int -> StartFlow -> ShowS
Prelude.Show, forall x. Rep StartFlow x -> StartFlow
forall x. StartFlow -> Rep StartFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartFlow x -> StartFlow
$cfrom :: forall x. StartFlow -> Rep StartFlow x
Prelude.Generic)
newStartFlow ::
Prelude.Text ->
StartFlow
newStartFlow :: Text -> StartFlow
newStartFlow Text
pFlowArn_ =
StartFlow' {$sel:flowArn:StartFlow' :: Text
flowArn = Text
pFlowArn_}
startFlow_flowArn :: Lens.Lens' StartFlow Prelude.Text
startFlow_flowArn :: Lens' StartFlow Text
startFlow_flowArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFlow' {Text
flowArn :: Text
$sel:flowArn:StartFlow' :: StartFlow -> Text
flowArn} -> Text
flowArn) (\s :: StartFlow
s@StartFlow' {} Text
a -> StartFlow
s {$sel:flowArn:StartFlow' :: Text
flowArn = Text
a} :: StartFlow)
instance Core.AWSRequest StartFlow where
type AWSResponse StartFlow = StartFlowResponse
request :: (Service -> Service) -> StartFlow -> Request StartFlow
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartFlow)))
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 ->
Maybe Text -> Maybe Status -> Int -> StartFlowResponse
StartFlowResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"flowArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"status")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable StartFlow where
hashWithSalt :: Int -> StartFlow -> Int
hashWithSalt Int
_salt StartFlow' {Text
flowArn :: Text
$sel:flowArn:StartFlow' :: StartFlow -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
flowArn
instance Prelude.NFData StartFlow where
rnf :: StartFlow -> ()
rnf StartFlow' {Text
flowArn :: Text
$sel:flowArn:StartFlow' :: StartFlow -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
flowArn
instance Data.ToHeaders StartFlow where
toHeaders :: StartFlow -> 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.ToJSON StartFlow where
toJSON :: StartFlow -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)
instance Data.ToPath StartFlow where
toPath :: StartFlow -> ByteString
toPath StartFlow' {Text
flowArn :: Text
$sel:flowArn:StartFlow' :: StartFlow -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/flows/start/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
flowArn]
instance Data.ToQuery StartFlow where
toQuery :: StartFlow -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartFlowResponse = StartFlowResponse'
{
StartFlowResponse -> Maybe Text
flowArn :: Prelude.Maybe Prelude.Text,
StartFlowResponse -> Maybe Status
status :: Prelude.Maybe Status,
StartFlowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartFlowResponse -> StartFlowResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFlowResponse -> StartFlowResponse -> Bool
$c/= :: StartFlowResponse -> StartFlowResponse -> Bool
== :: StartFlowResponse -> StartFlowResponse -> Bool
$c== :: StartFlowResponse -> StartFlowResponse -> Bool
Prelude.Eq, ReadPrec [StartFlowResponse]
ReadPrec StartFlowResponse
Int -> ReadS StartFlowResponse
ReadS [StartFlowResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartFlowResponse]
$creadListPrec :: ReadPrec [StartFlowResponse]
readPrec :: ReadPrec StartFlowResponse
$creadPrec :: ReadPrec StartFlowResponse
readList :: ReadS [StartFlowResponse]
$creadList :: ReadS [StartFlowResponse]
readsPrec :: Int -> ReadS StartFlowResponse
$creadsPrec :: Int -> ReadS StartFlowResponse
Prelude.Read, Int -> StartFlowResponse -> ShowS
[StartFlowResponse] -> ShowS
StartFlowResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFlowResponse] -> ShowS
$cshowList :: [StartFlowResponse] -> ShowS
show :: StartFlowResponse -> String
$cshow :: StartFlowResponse -> String
showsPrec :: Int -> StartFlowResponse -> ShowS
$cshowsPrec :: Int -> StartFlowResponse -> ShowS
Prelude.Show, forall x. Rep StartFlowResponse x -> StartFlowResponse
forall x. StartFlowResponse -> Rep StartFlowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartFlowResponse x -> StartFlowResponse
$cfrom :: forall x. StartFlowResponse -> Rep StartFlowResponse x
Prelude.Generic)
newStartFlowResponse ::
Prelude.Int ->
StartFlowResponse
newStartFlowResponse :: Int -> StartFlowResponse
newStartFlowResponse Int
pHttpStatus_ =
StartFlowResponse'
{ $sel:flowArn:StartFlowResponse' :: Maybe Text
flowArn = forall a. Maybe a
Prelude.Nothing,
$sel:status:StartFlowResponse' :: Maybe Status
status = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartFlowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startFlowResponse_flowArn :: Lens.Lens' StartFlowResponse (Prelude.Maybe Prelude.Text)
startFlowResponse_flowArn :: Lens' StartFlowResponse (Maybe Text)
startFlowResponse_flowArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFlowResponse' {Maybe Text
flowArn :: Maybe Text
$sel:flowArn:StartFlowResponse' :: StartFlowResponse -> Maybe Text
flowArn} -> Maybe Text
flowArn) (\s :: StartFlowResponse
s@StartFlowResponse' {} Maybe Text
a -> StartFlowResponse
s {$sel:flowArn:StartFlowResponse' :: Maybe Text
flowArn = Maybe Text
a} :: StartFlowResponse)
startFlowResponse_status :: Lens.Lens' StartFlowResponse (Prelude.Maybe Status)
startFlowResponse_status :: Lens' StartFlowResponse (Maybe Status)
startFlowResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFlowResponse' {Maybe Status
status :: Maybe Status
$sel:status:StartFlowResponse' :: StartFlowResponse -> Maybe Status
status} -> Maybe Status
status) (\s :: StartFlowResponse
s@StartFlowResponse' {} Maybe Status
a -> StartFlowResponse
s {$sel:status:StartFlowResponse' :: Maybe Status
status = Maybe Status
a} :: StartFlowResponse)
startFlowResponse_httpStatus :: Lens.Lens' StartFlowResponse Prelude.Int
startFlowResponse_httpStatus :: Lens' StartFlowResponse Int
startFlowResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFlowResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartFlowResponse' :: StartFlowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartFlowResponse
s@StartFlowResponse' {} Int
a -> StartFlowResponse
s {$sel:httpStatus:StartFlowResponse' :: Int
httpStatus = Int
a} :: StartFlowResponse)
instance Prelude.NFData StartFlowResponse where
rnf :: StartFlowResponse -> ()
rnf StartFlowResponse' {Int
Maybe Text
Maybe Status
httpStatus :: Int
status :: Maybe Status
flowArn :: Maybe Text
$sel:httpStatus:StartFlowResponse' :: StartFlowResponse -> Int
$sel:status:StartFlowResponse' :: StartFlowResponse -> Maybe Status
$sel:flowArn:StartFlowResponse' :: StartFlowResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
flowArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Status
status
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus