{-# 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.UpdateFlow
(
UpdateFlow (..),
newUpdateFlow,
updateFlow_sourceFailoverConfig,
updateFlow_flowArn,
UpdateFlowResponse (..),
newUpdateFlowResponse,
updateFlowResponse_flow,
updateFlowResponse_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 UpdateFlow = UpdateFlow'
{ UpdateFlow -> Maybe UpdateFailoverConfig
sourceFailoverConfig :: Prelude.Maybe UpdateFailoverConfig,
UpdateFlow -> Text
flowArn :: Prelude.Text
}
deriving (UpdateFlow -> UpdateFlow -> Bool
(UpdateFlow -> UpdateFlow -> Bool)
-> (UpdateFlow -> UpdateFlow -> Bool) -> Eq UpdateFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFlow -> UpdateFlow -> Bool
$c/= :: UpdateFlow -> UpdateFlow -> Bool
== :: UpdateFlow -> UpdateFlow -> Bool
$c== :: UpdateFlow -> UpdateFlow -> Bool
Prelude.Eq, ReadPrec [UpdateFlow]
ReadPrec UpdateFlow
Int -> ReadS UpdateFlow
ReadS [UpdateFlow]
(Int -> ReadS UpdateFlow)
-> ReadS [UpdateFlow]
-> ReadPrec UpdateFlow
-> ReadPrec [UpdateFlow]
-> Read UpdateFlow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFlow]
$creadListPrec :: ReadPrec [UpdateFlow]
readPrec :: ReadPrec UpdateFlow
$creadPrec :: ReadPrec UpdateFlow
readList :: ReadS [UpdateFlow]
$creadList :: ReadS [UpdateFlow]
readsPrec :: Int -> ReadS UpdateFlow
$creadsPrec :: Int -> ReadS UpdateFlow
Prelude.Read, Int -> UpdateFlow -> ShowS
[UpdateFlow] -> ShowS
UpdateFlow -> String
(Int -> UpdateFlow -> ShowS)
-> (UpdateFlow -> String)
-> ([UpdateFlow] -> ShowS)
-> Show UpdateFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFlow] -> ShowS
$cshowList :: [UpdateFlow] -> ShowS
show :: UpdateFlow -> String
$cshow :: UpdateFlow -> String
showsPrec :: Int -> UpdateFlow -> ShowS
$cshowsPrec :: Int -> UpdateFlow -> ShowS
Prelude.Show, (forall x. UpdateFlow -> Rep UpdateFlow x)
-> (forall x. Rep UpdateFlow x -> UpdateFlow) -> Generic UpdateFlow
forall x. Rep UpdateFlow x -> UpdateFlow
forall x. UpdateFlow -> Rep UpdateFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFlow x -> UpdateFlow
$cfrom :: forall x. UpdateFlow -> Rep UpdateFlow x
Prelude.Generic)
newUpdateFlow ::
Prelude.Text ->
UpdateFlow
newUpdateFlow :: Text -> UpdateFlow
newUpdateFlow Text
pFlowArn_ =
UpdateFlow' :: Maybe UpdateFailoverConfig -> Text -> UpdateFlow
UpdateFlow'
{ $sel:sourceFailoverConfig:UpdateFlow' :: Maybe UpdateFailoverConfig
sourceFailoverConfig = Maybe UpdateFailoverConfig
forall a. Maybe a
Prelude.Nothing,
$sel:flowArn:UpdateFlow' :: Text
flowArn = Text
pFlowArn_
}
updateFlow_sourceFailoverConfig :: Lens.Lens' UpdateFlow (Prelude.Maybe UpdateFailoverConfig)
updateFlow_sourceFailoverConfig :: (Maybe UpdateFailoverConfig -> f (Maybe UpdateFailoverConfig))
-> UpdateFlow -> f UpdateFlow
updateFlow_sourceFailoverConfig = (UpdateFlow -> Maybe UpdateFailoverConfig)
-> (UpdateFlow -> Maybe UpdateFailoverConfig -> UpdateFlow)
-> Lens
UpdateFlow
UpdateFlow
(Maybe UpdateFailoverConfig)
(Maybe UpdateFailoverConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlow' {Maybe UpdateFailoverConfig
sourceFailoverConfig :: Maybe UpdateFailoverConfig
$sel:sourceFailoverConfig:UpdateFlow' :: UpdateFlow -> Maybe UpdateFailoverConfig
sourceFailoverConfig} -> Maybe UpdateFailoverConfig
sourceFailoverConfig) (\s :: UpdateFlow
s@UpdateFlow' {} Maybe UpdateFailoverConfig
a -> UpdateFlow
s {$sel:sourceFailoverConfig:UpdateFlow' :: Maybe UpdateFailoverConfig
sourceFailoverConfig = Maybe UpdateFailoverConfig
a} :: UpdateFlow)
updateFlow_flowArn :: Lens.Lens' UpdateFlow Prelude.Text
updateFlow_flowArn :: (Text -> f Text) -> UpdateFlow -> f UpdateFlow
updateFlow_flowArn = (UpdateFlow -> Text)
-> (UpdateFlow -> Text -> UpdateFlow)
-> Lens UpdateFlow UpdateFlow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlow' {Text
flowArn :: Text
$sel:flowArn:UpdateFlow' :: UpdateFlow -> Text
flowArn} -> Text
flowArn) (\s :: UpdateFlow
s@UpdateFlow' {} Text
a -> UpdateFlow
s {$sel:flowArn:UpdateFlow' :: Text
flowArn = Text
a} :: UpdateFlow)
instance Core.AWSRequest UpdateFlow where
type AWSResponse UpdateFlow = UpdateFlowResponse
request :: UpdateFlow -> Request UpdateFlow
request = Service -> UpdateFlow -> Request UpdateFlow
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFlow)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateFlow))
-> Logger
-> Service
-> Proxy UpdateFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFlow)))
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 -> Int -> UpdateFlowResponse
UpdateFlowResponse'
(Maybe Flow -> Int -> UpdateFlowResponse)
-> Either String (Maybe Flow)
-> Either String (Int -> UpdateFlowResponse)
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 (Int -> UpdateFlowResponse)
-> Either String Int -> Either String UpdateFlowResponse
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 UpdateFlow
instance Prelude.NFData UpdateFlow
instance Core.ToHeaders UpdateFlow where
toHeaders :: UpdateFlow -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateFlow -> 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.ToJSON UpdateFlow where
toJSON :: UpdateFlow -> Value
toJSON UpdateFlow' {Maybe UpdateFailoverConfig
Text
flowArn :: Text
sourceFailoverConfig :: Maybe UpdateFailoverConfig
$sel:flowArn:UpdateFlow' :: UpdateFlow -> Text
$sel:sourceFailoverConfig:UpdateFlow' :: UpdateFlow -> Maybe UpdateFailoverConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"sourceFailoverConfig" Text -> UpdateFailoverConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(UpdateFailoverConfig -> Pair)
-> Maybe UpdateFailoverConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateFailoverConfig
sourceFailoverConfig
]
)
instance Core.ToPath UpdateFlow where
toPath :: UpdateFlow -> ByteString
toPath UpdateFlow' {Maybe UpdateFailoverConfig
Text
flowArn :: Text
sourceFailoverConfig :: Maybe UpdateFailoverConfig
$sel:flowArn:UpdateFlow' :: UpdateFlow -> Text
$sel:sourceFailoverConfig:UpdateFlow' :: UpdateFlow -> Maybe UpdateFailoverConfig
..} =
[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 UpdateFlow where
toQuery :: UpdateFlow -> QueryString
toQuery = QueryString -> UpdateFlow -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFlowResponse = UpdateFlowResponse'
{ UpdateFlowResponse -> Maybe Flow
flow :: Prelude.Maybe Flow,
UpdateFlowResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFlowResponse -> UpdateFlowResponse -> Bool
(UpdateFlowResponse -> UpdateFlowResponse -> Bool)
-> (UpdateFlowResponse -> UpdateFlowResponse -> Bool)
-> Eq UpdateFlowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFlowResponse -> UpdateFlowResponse -> Bool
$c/= :: UpdateFlowResponse -> UpdateFlowResponse -> Bool
== :: UpdateFlowResponse -> UpdateFlowResponse -> Bool
$c== :: UpdateFlowResponse -> UpdateFlowResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFlowResponse]
ReadPrec UpdateFlowResponse
Int -> ReadS UpdateFlowResponse
ReadS [UpdateFlowResponse]
(Int -> ReadS UpdateFlowResponse)
-> ReadS [UpdateFlowResponse]
-> ReadPrec UpdateFlowResponse
-> ReadPrec [UpdateFlowResponse]
-> Read UpdateFlowResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFlowResponse]
$creadListPrec :: ReadPrec [UpdateFlowResponse]
readPrec :: ReadPrec UpdateFlowResponse
$creadPrec :: ReadPrec UpdateFlowResponse
readList :: ReadS [UpdateFlowResponse]
$creadList :: ReadS [UpdateFlowResponse]
readsPrec :: Int -> ReadS UpdateFlowResponse
$creadsPrec :: Int -> ReadS UpdateFlowResponse
Prelude.Read, Int -> UpdateFlowResponse -> ShowS
[UpdateFlowResponse] -> ShowS
UpdateFlowResponse -> String
(Int -> UpdateFlowResponse -> ShowS)
-> (UpdateFlowResponse -> String)
-> ([UpdateFlowResponse] -> ShowS)
-> Show UpdateFlowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFlowResponse] -> ShowS
$cshowList :: [UpdateFlowResponse] -> ShowS
show :: UpdateFlowResponse -> String
$cshow :: UpdateFlowResponse -> String
showsPrec :: Int -> UpdateFlowResponse -> ShowS
$cshowsPrec :: Int -> UpdateFlowResponse -> ShowS
Prelude.Show, (forall x. UpdateFlowResponse -> Rep UpdateFlowResponse x)
-> (forall x. Rep UpdateFlowResponse x -> UpdateFlowResponse)
-> Generic UpdateFlowResponse
forall x. Rep UpdateFlowResponse x -> UpdateFlowResponse
forall x. UpdateFlowResponse -> Rep UpdateFlowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFlowResponse x -> UpdateFlowResponse
$cfrom :: forall x. UpdateFlowResponse -> Rep UpdateFlowResponse x
Prelude.Generic)
newUpdateFlowResponse ::
Prelude.Int ->
UpdateFlowResponse
newUpdateFlowResponse :: Int -> UpdateFlowResponse
newUpdateFlowResponse Int
pHttpStatus_ =
UpdateFlowResponse' :: Maybe Flow -> Int -> UpdateFlowResponse
UpdateFlowResponse'
{ $sel:flow:UpdateFlowResponse' :: Maybe Flow
flow = Maybe Flow
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateFlowResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateFlowResponse_flow :: Lens.Lens' UpdateFlowResponse (Prelude.Maybe Flow)
updateFlowResponse_flow :: (Maybe Flow -> f (Maybe Flow))
-> UpdateFlowResponse -> f UpdateFlowResponse
updateFlowResponse_flow = (UpdateFlowResponse -> Maybe Flow)
-> (UpdateFlowResponse -> Maybe Flow -> UpdateFlowResponse)
-> Lens
UpdateFlowResponse UpdateFlowResponse (Maybe Flow) (Maybe Flow)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowResponse' {Maybe Flow
flow :: Maybe Flow
$sel:flow:UpdateFlowResponse' :: UpdateFlowResponse -> Maybe Flow
flow} -> Maybe Flow
flow) (\s :: UpdateFlowResponse
s@UpdateFlowResponse' {} Maybe Flow
a -> UpdateFlowResponse
s {$sel:flow:UpdateFlowResponse' :: Maybe Flow
flow = Maybe Flow
a} :: UpdateFlowResponse)
updateFlowResponse_httpStatus :: Lens.Lens' UpdateFlowResponse Prelude.Int
updateFlowResponse_httpStatus :: (Int -> f Int) -> UpdateFlowResponse -> f UpdateFlowResponse
updateFlowResponse_httpStatus = (UpdateFlowResponse -> Int)
-> (UpdateFlowResponse -> Int -> UpdateFlowResponse)
-> Lens UpdateFlowResponse UpdateFlowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFlowResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFlowResponse' :: UpdateFlowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFlowResponse
s@UpdateFlowResponse' {} Int
a -> UpdateFlowResponse
s {$sel:httpStatus:UpdateFlowResponse' :: Int
httpStatus = Int
a} :: UpdateFlowResponse)
instance Prelude.NFData UpdateFlowResponse