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