{-# 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.AddFlowOutputs
(
AddFlowOutputs (..),
newAddFlowOutputs,
addFlowOutputs_flowArn,
addFlowOutputs_outputs,
AddFlowOutputsResponse (..),
newAddFlowOutputsResponse,
addFlowOutputsResponse_flowArn,
addFlowOutputsResponse_outputs,
addFlowOutputsResponse_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 AddFlowOutputs = AddFlowOutputs'
{
AddFlowOutputs -> Text
flowArn :: Prelude.Text,
AddFlowOutputs -> [AddOutputRequest]
outputs :: [AddOutputRequest]
}
deriving (AddFlowOutputs -> AddFlowOutputs -> Bool
(AddFlowOutputs -> AddFlowOutputs -> Bool)
-> (AddFlowOutputs -> AddFlowOutputs -> Bool) -> Eq AddFlowOutputs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddFlowOutputs -> AddFlowOutputs -> Bool
$c/= :: AddFlowOutputs -> AddFlowOutputs -> Bool
== :: AddFlowOutputs -> AddFlowOutputs -> Bool
$c== :: AddFlowOutputs -> AddFlowOutputs -> Bool
Prelude.Eq, ReadPrec [AddFlowOutputs]
ReadPrec AddFlowOutputs
Int -> ReadS AddFlowOutputs
ReadS [AddFlowOutputs]
(Int -> ReadS AddFlowOutputs)
-> ReadS [AddFlowOutputs]
-> ReadPrec AddFlowOutputs
-> ReadPrec [AddFlowOutputs]
-> Read AddFlowOutputs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddFlowOutputs]
$creadListPrec :: ReadPrec [AddFlowOutputs]
readPrec :: ReadPrec AddFlowOutputs
$creadPrec :: ReadPrec AddFlowOutputs
readList :: ReadS [AddFlowOutputs]
$creadList :: ReadS [AddFlowOutputs]
readsPrec :: Int -> ReadS AddFlowOutputs
$creadsPrec :: Int -> ReadS AddFlowOutputs
Prelude.Read, Int -> AddFlowOutputs -> ShowS
[AddFlowOutputs] -> ShowS
AddFlowOutputs -> String
(Int -> AddFlowOutputs -> ShowS)
-> (AddFlowOutputs -> String)
-> ([AddFlowOutputs] -> ShowS)
-> Show AddFlowOutputs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddFlowOutputs] -> ShowS
$cshowList :: [AddFlowOutputs] -> ShowS
show :: AddFlowOutputs -> String
$cshow :: AddFlowOutputs -> String
showsPrec :: Int -> AddFlowOutputs -> ShowS
$cshowsPrec :: Int -> AddFlowOutputs -> ShowS
Prelude.Show, (forall x. AddFlowOutputs -> Rep AddFlowOutputs x)
-> (forall x. Rep AddFlowOutputs x -> AddFlowOutputs)
-> Generic AddFlowOutputs
forall x. Rep AddFlowOutputs x -> AddFlowOutputs
forall x. AddFlowOutputs -> Rep AddFlowOutputs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddFlowOutputs x -> AddFlowOutputs
$cfrom :: forall x. AddFlowOutputs -> Rep AddFlowOutputs x
Prelude.Generic)
newAddFlowOutputs ::
Prelude.Text ->
AddFlowOutputs
newAddFlowOutputs :: Text -> AddFlowOutputs
newAddFlowOutputs Text
pFlowArn_ =
AddFlowOutputs' :: Text -> [AddOutputRequest] -> AddFlowOutputs
AddFlowOutputs'
{ $sel:flowArn:AddFlowOutputs' :: Text
flowArn = Text
pFlowArn_,
$sel:outputs:AddFlowOutputs' :: [AddOutputRequest]
outputs = [AddOutputRequest]
forall a. Monoid a => a
Prelude.mempty
}
addFlowOutputs_flowArn :: Lens.Lens' AddFlowOutputs Prelude.Text
addFlowOutputs_flowArn :: (Text -> f Text) -> AddFlowOutputs -> f AddFlowOutputs
addFlowOutputs_flowArn = (AddFlowOutputs -> Text)
-> (AddFlowOutputs -> Text -> AddFlowOutputs)
-> Lens AddFlowOutputs AddFlowOutputs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFlowOutputs' {Text
flowArn :: Text
$sel:flowArn:AddFlowOutputs' :: AddFlowOutputs -> Text
flowArn} -> Text
flowArn) (\s :: AddFlowOutputs
s@AddFlowOutputs' {} Text
a -> AddFlowOutputs
s {$sel:flowArn:AddFlowOutputs' :: Text
flowArn = Text
a} :: AddFlowOutputs)
addFlowOutputs_outputs :: Lens.Lens' AddFlowOutputs [AddOutputRequest]
addFlowOutputs_outputs :: ([AddOutputRequest] -> f [AddOutputRequest])
-> AddFlowOutputs -> f AddFlowOutputs
addFlowOutputs_outputs = (AddFlowOutputs -> [AddOutputRequest])
-> (AddFlowOutputs -> [AddOutputRequest] -> AddFlowOutputs)
-> Lens
AddFlowOutputs AddFlowOutputs [AddOutputRequest] [AddOutputRequest]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFlowOutputs' {[AddOutputRequest]
outputs :: [AddOutputRequest]
$sel:outputs:AddFlowOutputs' :: AddFlowOutputs -> [AddOutputRequest]
outputs} -> [AddOutputRequest]
outputs) (\s :: AddFlowOutputs
s@AddFlowOutputs' {} [AddOutputRequest]
a -> AddFlowOutputs
s {$sel:outputs:AddFlowOutputs' :: [AddOutputRequest]
outputs = [AddOutputRequest]
a} :: AddFlowOutputs) (([AddOutputRequest] -> f [AddOutputRequest])
-> AddFlowOutputs -> f AddFlowOutputs)
-> (([AddOutputRequest] -> f [AddOutputRequest])
-> [AddOutputRequest] -> f [AddOutputRequest])
-> ([AddOutputRequest] -> f [AddOutputRequest])
-> AddFlowOutputs
-> f AddFlowOutputs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AddOutputRequest] -> f [AddOutputRequest])
-> [AddOutputRequest] -> f [AddOutputRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddFlowOutputs where
type
AWSResponse AddFlowOutputs =
AddFlowOutputsResponse
request :: AddFlowOutputs -> Request AddFlowOutputs
request = Service -> AddFlowOutputs -> Request AddFlowOutputs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddFlowOutputs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddFlowOutputs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddFlowOutputs))
-> Logger
-> Service
-> Proxy AddFlowOutputs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddFlowOutputs)))
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 Text -> Maybe [Output] -> Int -> AddFlowOutputsResponse
AddFlowOutputsResponse'
(Maybe Text -> Maybe [Output] -> Int -> AddFlowOutputsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Output] -> Int -> AddFlowOutputsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"flowArn")
Either String (Maybe [Output] -> Int -> AddFlowOutputsResponse)
-> Either String (Maybe [Output])
-> Either String (Int -> AddFlowOutputsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Output]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"outputs" Either String (Maybe (Maybe [Output]))
-> Maybe [Output] -> Either String (Maybe [Output])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Output]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> AddFlowOutputsResponse)
-> Either String Int -> Either String AddFlowOutputsResponse
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 AddFlowOutputs
instance Prelude.NFData AddFlowOutputs
instance Core.ToHeaders AddFlowOutputs where
toHeaders :: AddFlowOutputs -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddFlowOutputs -> 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 AddFlowOutputs where
toJSON :: AddFlowOutputs -> Value
toJSON AddFlowOutputs' {[AddOutputRequest]
Text
outputs :: [AddOutputRequest]
flowArn :: Text
$sel:outputs:AddFlowOutputs' :: AddFlowOutputs -> [AddOutputRequest]
$sel:flowArn:AddFlowOutputs' :: AddFlowOutputs -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"outputs" Text -> [AddOutputRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AddOutputRequest]
outputs)]
)
instance Core.ToPath AddFlowOutputs where
toPath :: AddFlowOutputs -> ByteString
toPath AddFlowOutputs' {[AddOutputRequest]
Text
outputs :: [AddOutputRequest]
flowArn :: Text
$sel:outputs:AddFlowOutputs' :: AddFlowOutputs -> [AddOutputRequest]
$sel:flowArn:AddFlowOutputs' :: AddFlowOutputs -> 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, ByteString
"/outputs"]
instance Core.ToQuery AddFlowOutputs where
toQuery :: AddFlowOutputs -> QueryString
toQuery = QueryString -> AddFlowOutputs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddFlowOutputsResponse = AddFlowOutputsResponse'
{
AddFlowOutputsResponse -> Maybe Text
flowArn :: Prelude.Maybe Prelude.Text,
AddFlowOutputsResponse -> Maybe [Output]
outputs :: Prelude.Maybe [Output],
AddFlowOutputsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool
(AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool)
-> (AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool)
-> Eq AddFlowOutputsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool
$c/= :: AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool
== :: AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool
$c== :: AddFlowOutputsResponse -> AddFlowOutputsResponse -> Bool
Prelude.Eq, ReadPrec [AddFlowOutputsResponse]
ReadPrec AddFlowOutputsResponse
Int -> ReadS AddFlowOutputsResponse
ReadS [AddFlowOutputsResponse]
(Int -> ReadS AddFlowOutputsResponse)
-> ReadS [AddFlowOutputsResponse]
-> ReadPrec AddFlowOutputsResponse
-> ReadPrec [AddFlowOutputsResponse]
-> Read AddFlowOutputsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddFlowOutputsResponse]
$creadListPrec :: ReadPrec [AddFlowOutputsResponse]
readPrec :: ReadPrec AddFlowOutputsResponse
$creadPrec :: ReadPrec AddFlowOutputsResponse
readList :: ReadS [AddFlowOutputsResponse]
$creadList :: ReadS [AddFlowOutputsResponse]
readsPrec :: Int -> ReadS AddFlowOutputsResponse
$creadsPrec :: Int -> ReadS AddFlowOutputsResponse
Prelude.Read, Int -> AddFlowOutputsResponse -> ShowS
[AddFlowOutputsResponse] -> ShowS
AddFlowOutputsResponse -> String
(Int -> AddFlowOutputsResponse -> ShowS)
-> (AddFlowOutputsResponse -> String)
-> ([AddFlowOutputsResponse] -> ShowS)
-> Show AddFlowOutputsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddFlowOutputsResponse] -> ShowS
$cshowList :: [AddFlowOutputsResponse] -> ShowS
show :: AddFlowOutputsResponse -> String
$cshow :: AddFlowOutputsResponse -> String
showsPrec :: Int -> AddFlowOutputsResponse -> ShowS
$cshowsPrec :: Int -> AddFlowOutputsResponse -> ShowS
Prelude.Show, (forall x. AddFlowOutputsResponse -> Rep AddFlowOutputsResponse x)
-> (forall x.
Rep AddFlowOutputsResponse x -> AddFlowOutputsResponse)
-> Generic AddFlowOutputsResponse
forall x. Rep AddFlowOutputsResponse x -> AddFlowOutputsResponse
forall x. AddFlowOutputsResponse -> Rep AddFlowOutputsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddFlowOutputsResponse x -> AddFlowOutputsResponse
$cfrom :: forall x. AddFlowOutputsResponse -> Rep AddFlowOutputsResponse x
Prelude.Generic)
newAddFlowOutputsResponse ::
Prelude.Int ->
AddFlowOutputsResponse
newAddFlowOutputsResponse :: Int -> AddFlowOutputsResponse
newAddFlowOutputsResponse Int
pHttpStatus_ =
AddFlowOutputsResponse' :: Maybe Text -> Maybe [Output] -> Int -> AddFlowOutputsResponse
AddFlowOutputsResponse'
{ $sel:flowArn:AddFlowOutputsResponse' :: Maybe Text
flowArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:outputs:AddFlowOutputsResponse' :: Maybe [Output]
outputs = Maybe [Output]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddFlowOutputsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addFlowOutputsResponse_flowArn :: Lens.Lens' AddFlowOutputsResponse (Prelude.Maybe Prelude.Text)
addFlowOutputsResponse_flowArn :: (Maybe Text -> f (Maybe Text))
-> AddFlowOutputsResponse -> f AddFlowOutputsResponse
addFlowOutputsResponse_flowArn = (AddFlowOutputsResponse -> Maybe Text)
-> (AddFlowOutputsResponse -> Maybe Text -> AddFlowOutputsResponse)
-> Lens
AddFlowOutputsResponse
AddFlowOutputsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFlowOutputsResponse' {Maybe Text
flowArn :: Maybe Text
$sel:flowArn:AddFlowOutputsResponse' :: AddFlowOutputsResponse -> Maybe Text
flowArn} -> Maybe Text
flowArn) (\s :: AddFlowOutputsResponse
s@AddFlowOutputsResponse' {} Maybe Text
a -> AddFlowOutputsResponse
s {$sel:flowArn:AddFlowOutputsResponse' :: Maybe Text
flowArn = Maybe Text
a} :: AddFlowOutputsResponse)
addFlowOutputsResponse_outputs :: Lens.Lens' AddFlowOutputsResponse (Prelude.Maybe [Output])
addFlowOutputsResponse_outputs :: (Maybe [Output] -> f (Maybe [Output]))
-> AddFlowOutputsResponse -> f AddFlowOutputsResponse
addFlowOutputsResponse_outputs = (AddFlowOutputsResponse -> Maybe [Output])
-> (AddFlowOutputsResponse
-> Maybe [Output] -> AddFlowOutputsResponse)
-> Lens
AddFlowOutputsResponse
AddFlowOutputsResponse
(Maybe [Output])
(Maybe [Output])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFlowOutputsResponse' {Maybe [Output]
outputs :: Maybe [Output]
$sel:outputs:AddFlowOutputsResponse' :: AddFlowOutputsResponse -> Maybe [Output]
outputs} -> Maybe [Output]
outputs) (\s :: AddFlowOutputsResponse
s@AddFlowOutputsResponse' {} Maybe [Output]
a -> AddFlowOutputsResponse
s {$sel:outputs:AddFlowOutputsResponse' :: Maybe [Output]
outputs = Maybe [Output]
a} :: AddFlowOutputsResponse) ((Maybe [Output] -> f (Maybe [Output]))
-> AddFlowOutputsResponse -> f AddFlowOutputsResponse)
-> ((Maybe [Output] -> f (Maybe [Output]))
-> Maybe [Output] -> f (Maybe [Output]))
-> (Maybe [Output] -> f (Maybe [Output]))
-> AddFlowOutputsResponse
-> f AddFlowOutputsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Output] [Output] [Output] [Output]
-> Iso
(Maybe [Output]) (Maybe [Output]) (Maybe [Output]) (Maybe [Output])
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 [Output] [Output] [Output] [Output]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addFlowOutputsResponse_httpStatus :: Lens.Lens' AddFlowOutputsResponse Prelude.Int
addFlowOutputsResponse_httpStatus :: (Int -> f Int)
-> AddFlowOutputsResponse -> f AddFlowOutputsResponse
addFlowOutputsResponse_httpStatus = (AddFlowOutputsResponse -> Int)
-> (AddFlowOutputsResponse -> Int -> AddFlowOutputsResponse)
-> Lens AddFlowOutputsResponse AddFlowOutputsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddFlowOutputsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddFlowOutputsResponse' :: AddFlowOutputsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddFlowOutputsResponse
s@AddFlowOutputsResponse' {} Int
a -> AddFlowOutputsResponse
s {$sel:httpStatus:AddFlowOutputsResponse' :: Int
httpStatus = Int
a} :: AddFlowOutputsResponse)
instance Prelude.NFData AddFlowOutputsResponse