{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaConnect.CreateFlow
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new flow. The request must include one source. The request
-- optionally can include outputs (up to 50) and entitlements (up to 50).
module Amazonka.MediaConnect.CreateFlow
  ( -- * Creating a Request
    CreateFlow (..),
    newCreateFlow,

    -- * Request Lenses
    createFlow_mediaStreams,
    createFlow_sourceFailoverConfig,
    createFlow_vpcInterfaces,
    createFlow_sources,
    createFlow_outputs,
    createFlow_availabilityZone,
    createFlow_entitlements,
    createFlow_source,
    createFlow_name,

    -- * Destructuring the Response
    CreateFlowResponse (..),
    newCreateFlowResponse,

    -- * Response Lenses
    createFlowResponse_flow,
    createFlowResponse_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

-- | Creates a new flow. The request must include one source. The request
-- optionally can include outputs (up to 50) and entitlements (up to 50).
--
-- /See:/ 'newCreateFlow' smart constructor.
data CreateFlow = CreateFlow'
  { -- | The media streams that you want to add to the flow. You can associate
    -- these media streams with sources and outputs on the flow.
    CreateFlow -> Maybe [AddMediaStreamRequest]
mediaStreams :: Prelude.Maybe [AddMediaStreamRequest],
    CreateFlow -> Maybe FailoverConfig
sourceFailoverConfig :: Prelude.Maybe FailoverConfig,
    -- | The VPC interfaces you want on the flow.
    CreateFlow -> Maybe [VpcInterfaceRequest]
vpcInterfaces :: Prelude.Maybe [VpcInterfaceRequest],
    CreateFlow -> Maybe [SetSourceRequest]
sources :: Prelude.Maybe [SetSourceRequest],
    -- | The outputs that you want to add to this flow.
    CreateFlow -> Maybe [AddOutputRequest]
outputs :: Prelude.Maybe [AddOutputRequest],
    -- | The Availability Zone that you want to create the flow in. These options
    -- are limited to the Availability Zones within the current AWS Region.
    CreateFlow -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The entitlements that you want to grant on a flow.
    CreateFlow -> Maybe [GrantEntitlementRequest]
entitlements :: Prelude.Maybe [GrantEntitlementRequest],
    CreateFlow -> Maybe SetSourceRequest
source :: Prelude.Maybe SetSourceRequest,
    -- | The name of the flow.
    CreateFlow -> Text
name :: Prelude.Text
  }
  deriving (CreateFlow -> CreateFlow -> Bool
(CreateFlow -> CreateFlow -> Bool)
-> (CreateFlow -> CreateFlow -> Bool) -> Eq CreateFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFlow -> CreateFlow -> Bool
$c/= :: CreateFlow -> CreateFlow -> Bool
== :: CreateFlow -> CreateFlow -> Bool
$c== :: CreateFlow -> CreateFlow -> Bool
Prelude.Eq, ReadPrec [CreateFlow]
ReadPrec CreateFlow
Int -> ReadS CreateFlow
ReadS [CreateFlow]
(Int -> ReadS CreateFlow)
-> ReadS [CreateFlow]
-> ReadPrec CreateFlow
-> ReadPrec [CreateFlow]
-> Read CreateFlow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFlow]
$creadListPrec :: ReadPrec [CreateFlow]
readPrec :: ReadPrec CreateFlow
$creadPrec :: ReadPrec CreateFlow
readList :: ReadS [CreateFlow]
$creadList :: ReadS [CreateFlow]
readsPrec :: Int -> ReadS CreateFlow
$creadsPrec :: Int -> ReadS CreateFlow
Prelude.Read, Int -> CreateFlow -> ShowS
[CreateFlow] -> ShowS
CreateFlow -> String
(Int -> CreateFlow -> ShowS)
-> (CreateFlow -> String)
-> ([CreateFlow] -> ShowS)
-> Show CreateFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFlow] -> ShowS
$cshowList :: [CreateFlow] -> ShowS
show :: CreateFlow -> String
$cshow :: CreateFlow -> String
showsPrec :: Int -> CreateFlow -> ShowS
$cshowsPrec :: Int -> CreateFlow -> ShowS
Prelude.Show, (forall x. CreateFlow -> Rep CreateFlow x)
-> (forall x. Rep CreateFlow x -> CreateFlow) -> Generic CreateFlow
forall x. Rep CreateFlow x -> CreateFlow
forall x. CreateFlow -> Rep CreateFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFlow x -> CreateFlow
$cfrom :: forall x. CreateFlow -> Rep CreateFlow x
Prelude.Generic)

-- |
-- Create a value of 'CreateFlow' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'mediaStreams', 'createFlow_mediaStreams' - The media streams that you want to add to the flow. You can associate
-- these media streams with sources and outputs on the flow.
--
-- 'sourceFailoverConfig', 'createFlow_sourceFailoverConfig' - Undocumented member.
--
-- 'vpcInterfaces', 'createFlow_vpcInterfaces' - The VPC interfaces you want on the flow.
--
-- 'sources', 'createFlow_sources' - Undocumented member.
--
-- 'outputs', 'createFlow_outputs' - The outputs that you want to add to this flow.
--
-- 'availabilityZone', 'createFlow_availabilityZone' - The Availability Zone that you want to create the flow in. These options
-- are limited to the Availability Zones within the current AWS Region.
--
-- 'entitlements', 'createFlow_entitlements' - The entitlements that you want to grant on a flow.
--
-- 'source', 'createFlow_source' - Undocumented member.
--
-- 'name', 'createFlow_name' - The name of the flow.
newCreateFlow ::
  -- | 'name'
  Prelude.Text ->
  CreateFlow
newCreateFlow :: Text -> CreateFlow
newCreateFlow Text
pName_ =
  CreateFlow' :: Maybe [AddMediaStreamRequest]
-> Maybe FailoverConfig
-> Maybe [VpcInterfaceRequest]
-> Maybe [SetSourceRequest]
-> Maybe [AddOutputRequest]
-> Maybe Text
-> Maybe [GrantEntitlementRequest]
-> Maybe SetSourceRequest
-> Text
-> CreateFlow
CreateFlow'
    { $sel:mediaStreams:CreateFlow' :: Maybe [AddMediaStreamRequest]
mediaStreams = Maybe [AddMediaStreamRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceFailoverConfig:CreateFlow' :: Maybe FailoverConfig
sourceFailoverConfig = Maybe FailoverConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcInterfaces:CreateFlow' :: Maybe [VpcInterfaceRequest]
vpcInterfaces = Maybe [VpcInterfaceRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:sources:CreateFlow' :: Maybe [SetSourceRequest]
sources = Maybe [SetSourceRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:CreateFlow' :: Maybe [AddOutputRequest]
outputs = Maybe [AddOutputRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZone:CreateFlow' :: Maybe Text
availabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entitlements:CreateFlow' :: Maybe [GrantEntitlementRequest]
entitlements = Maybe [GrantEntitlementRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:source:CreateFlow' :: Maybe SetSourceRequest
source = Maybe SetSourceRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateFlow' :: Text
name = Text
pName_
    }

-- | The media streams that you want to add to the flow. You can associate
-- these media streams with sources and outputs on the flow.
createFlow_mediaStreams :: Lens.Lens' CreateFlow (Prelude.Maybe [AddMediaStreamRequest])
createFlow_mediaStreams :: (Maybe [AddMediaStreamRequest]
 -> f (Maybe [AddMediaStreamRequest]))
-> CreateFlow -> f CreateFlow
createFlow_mediaStreams = (CreateFlow -> Maybe [AddMediaStreamRequest])
-> (CreateFlow -> Maybe [AddMediaStreamRequest] -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe [AddMediaStreamRequest])
     (Maybe [AddMediaStreamRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe [AddMediaStreamRequest]
mediaStreams :: Maybe [AddMediaStreamRequest]
$sel:mediaStreams:CreateFlow' :: CreateFlow -> Maybe [AddMediaStreamRequest]
mediaStreams} -> Maybe [AddMediaStreamRequest]
mediaStreams) (\s :: CreateFlow
s@CreateFlow' {} Maybe [AddMediaStreamRequest]
a -> CreateFlow
s {$sel:mediaStreams:CreateFlow' :: Maybe [AddMediaStreamRequest]
mediaStreams = Maybe [AddMediaStreamRequest]
a} :: CreateFlow) ((Maybe [AddMediaStreamRequest]
  -> f (Maybe [AddMediaStreamRequest]))
 -> CreateFlow -> f CreateFlow)
-> ((Maybe [AddMediaStreamRequest]
     -> f (Maybe [AddMediaStreamRequest]))
    -> Maybe [AddMediaStreamRequest]
    -> f (Maybe [AddMediaStreamRequest]))
-> (Maybe [AddMediaStreamRequest]
    -> f (Maybe [AddMediaStreamRequest]))
-> CreateFlow
-> f CreateFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
-> Iso
     (Maybe [AddMediaStreamRequest])
     (Maybe [AddMediaStreamRequest])
     (Maybe [AddMediaStreamRequest])
     (Maybe [AddMediaStreamRequest])
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
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
  [AddMediaStreamRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
createFlow_sourceFailoverConfig :: Lens.Lens' CreateFlow (Prelude.Maybe FailoverConfig)
createFlow_sourceFailoverConfig :: (Maybe FailoverConfig -> f (Maybe FailoverConfig))
-> CreateFlow -> f CreateFlow
createFlow_sourceFailoverConfig = (CreateFlow -> Maybe FailoverConfig)
-> (CreateFlow -> Maybe FailoverConfig -> CreateFlow)
-> Lens
     CreateFlow CreateFlow (Maybe FailoverConfig) (Maybe FailoverConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe FailoverConfig
sourceFailoverConfig :: Maybe FailoverConfig
$sel:sourceFailoverConfig:CreateFlow' :: CreateFlow -> Maybe FailoverConfig
sourceFailoverConfig} -> Maybe FailoverConfig
sourceFailoverConfig) (\s :: CreateFlow
s@CreateFlow' {} Maybe FailoverConfig
a -> CreateFlow
s {$sel:sourceFailoverConfig:CreateFlow' :: Maybe FailoverConfig
sourceFailoverConfig = Maybe FailoverConfig
a} :: CreateFlow)

-- | The VPC interfaces you want on the flow.
createFlow_vpcInterfaces :: Lens.Lens' CreateFlow (Prelude.Maybe [VpcInterfaceRequest])
createFlow_vpcInterfaces :: (Maybe [VpcInterfaceRequest] -> f (Maybe [VpcInterfaceRequest]))
-> CreateFlow -> f CreateFlow
createFlow_vpcInterfaces = (CreateFlow -> Maybe [VpcInterfaceRequest])
-> (CreateFlow -> Maybe [VpcInterfaceRequest] -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe [VpcInterfaceRequest])
     (Maybe [VpcInterfaceRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe [VpcInterfaceRequest]
vpcInterfaces :: Maybe [VpcInterfaceRequest]
$sel:vpcInterfaces:CreateFlow' :: CreateFlow -> Maybe [VpcInterfaceRequest]
vpcInterfaces} -> Maybe [VpcInterfaceRequest]
vpcInterfaces) (\s :: CreateFlow
s@CreateFlow' {} Maybe [VpcInterfaceRequest]
a -> CreateFlow
s {$sel:vpcInterfaces:CreateFlow' :: Maybe [VpcInterfaceRequest]
vpcInterfaces = Maybe [VpcInterfaceRequest]
a} :: CreateFlow) ((Maybe [VpcInterfaceRequest] -> f (Maybe [VpcInterfaceRequest]))
 -> CreateFlow -> f CreateFlow)
-> ((Maybe [VpcInterfaceRequest]
     -> f (Maybe [VpcInterfaceRequest]))
    -> Maybe [VpcInterfaceRequest] -> f (Maybe [VpcInterfaceRequest]))
-> (Maybe [VpcInterfaceRequest] -> f (Maybe [VpcInterfaceRequest]))
-> CreateFlow
-> f CreateFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
-> Iso
     (Maybe [VpcInterfaceRequest])
     (Maybe [VpcInterfaceRequest])
     (Maybe [VpcInterfaceRequest])
     (Maybe [VpcInterfaceRequest])
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
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
  [VpcInterfaceRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
createFlow_sources :: Lens.Lens' CreateFlow (Prelude.Maybe [SetSourceRequest])
createFlow_sources :: (Maybe [SetSourceRequest] -> f (Maybe [SetSourceRequest]))
-> CreateFlow -> f CreateFlow
createFlow_sources = (CreateFlow -> Maybe [SetSourceRequest])
-> (CreateFlow -> Maybe [SetSourceRequest] -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe [SetSourceRequest])
     (Maybe [SetSourceRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe [SetSourceRequest]
sources :: Maybe [SetSourceRequest]
$sel:sources:CreateFlow' :: CreateFlow -> Maybe [SetSourceRequest]
sources} -> Maybe [SetSourceRequest]
sources) (\s :: CreateFlow
s@CreateFlow' {} Maybe [SetSourceRequest]
a -> CreateFlow
s {$sel:sources:CreateFlow' :: Maybe [SetSourceRequest]
sources = Maybe [SetSourceRequest]
a} :: CreateFlow) ((Maybe [SetSourceRequest] -> f (Maybe [SetSourceRequest]))
 -> CreateFlow -> f CreateFlow)
-> ((Maybe [SetSourceRequest] -> f (Maybe [SetSourceRequest]))
    -> Maybe [SetSourceRequest] -> f (Maybe [SetSourceRequest]))
-> (Maybe [SetSourceRequest] -> f (Maybe [SetSourceRequest]))
-> CreateFlow
-> f CreateFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SetSourceRequest]
  [SetSourceRequest]
  [SetSourceRequest]
  [SetSourceRequest]
-> Iso
     (Maybe [SetSourceRequest])
     (Maybe [SetSourceRequest])
     (Maybe [SetSourceRequest])
     (Maybe [SetSourceRequest])
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
  [SetSourceRequest]
  [SetSourceRequest]
  [SetSourceRequest]
  [SetSourceRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The outputs that you want to add to this flow.
createFlow_outputs :: Lens.Lens' CreateFlow (Prelude.Maybe [AddOutputRequest])
createFlow_outputs :: (Maybe [AddOutputRequest] -> f (Maybe [AddOutputRequest]))
-> CreateFlow -> f CreateFlow
createFlow_outputs = (CreateFlow -> Maybe [AddOutputRequest])
-> (CreateFlow -> Maybe [AddOutputRequest] -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe [AddOutputRequest])
     (Maybe [AddOutputRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe [AddOutputRequest]
outputs :: Maybe [AddOutputRequest]
$sel:outputs:CreateFlow' :: CreateFlow -> Maybe [AddOutputRequest]
outputs} -> Maybe [AddOutputRequest]
outputs) (\s :: CreateFlow
s@CreateFlow' {} Maybe [AddOutputRequest]
a -> CreateFlow
s {$sel:outputs:CreateFlow' :: Maybe [AddOutputRequest]
outputs = Maybe [AddOutputRequest]
a} :: CreateFlow) ((Maybe [AddOutputRequest] -> f (Maybe [AddOutputRequest]))
 -> CreateFlow -> f CreateFlow)
-> ((Maybe [AddOutputRequest] -> f (Maybe [AddOutputRequest]))
    -> Maybe [AddOutputRequest] -> f (Maybe [AddOutputRequest]))
-> (Maybe [AddOutputRequest] -> f (Maybe [AddOutputRequest]))
-> CreateFlow
-> f CreateFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AddOutputRequest]
  [AddOutputRequest]
  [AddOutputRequest]
  [AddOutputRequest]
-> Iso
     (Maybe [AddOutputRequest])
     (Maybe [AddOutputRequest])
     (Maybe [AddOutputRequest])
     (Maybe [AddOutputRequest])
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
  [AddOutputRequest]
  [AddOutputRequest]
  [AddOutputRequest]
  [AddOutputRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Availability Zone that you want to create the flow in. These options
-- are limited to the Availability Zones within the current AWS Region.
createFlow_availabilityZone :: Lens.Lens' CreateFlow (Prelude.Maybe Prelude.Text)
createFlow_availabilityZone :: (Maybe Text -> f (Maybe Text)) -> CreateFlow -> f CreateFlow
createFlow_availabilityZone = (CreateFlow -> Maybe Text)
-> (CreateFlow -> Maybe Text -> CreateFlow)
-> Lens CreateFlow CreateFlow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:CreateFlow' :: CreateFlow -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: CreateFlow
s@CreateFlow' {} Maybe Text
a -> CreateFlow
s {$sel:availabilityZone:CreateFlow' :: Maybe Text
availabilityZone = Maybe Text
a} :: CreateFlow)

-- | The entitlements that you want to grant on a flow.
createFlow_entitlements :: Lens.Lens' CreateFlow (Prelude.Maybe [GrantEntitlementRequest])
createFlow_entitlements :: (Maybe [GrantEntitlementRequest]
 -> f (Maybe [GrantEntitlementRequest]))
-> CreateFlow -> f CreateFlow
createFlow_entitlements = (CreateFlow -> Maybe [GrantEntitlementRequest])
-> (CreateFlow -> Maybe [GrantEntitlementRequest] -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe [GrantEntitlementRequest])
     (Maybe [GrantEntitlementRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe [GrantEntitlementRequest]
entitlements :: Maybe [GrantEntitlementRequest]
$sel:entitlements:CreateFlow' :: CreateFlow -> Maybe [GrantEntitlementRequest]
entitlements} -> Maybe [GrantEntitlementRequest]
entitlements) (\s :: CreateFlow
s@CreateFlow' {} Maybe [GrantEntitlementRequest]
a -> CreateFlow
s {$sel:entitlements:CreateFlow' :: Maybe [GrantEntitlementRequest]
entitlements = Maybe [GrantEntitlementRequest]
a} :: CreateFlow) ((Maybe [GrantEntitlementRequest]
  -> f (Maybe [GrantEntitlementRequest]))
 -> CreateFlow -> f CreateFlow)
-> ((Maybe [GrantEntitlementRequest]
     -> f (Maybe [GrantEntitlementRequest]))
    -> Maybe [GrantEntitlementRequest]
    -> f (Maybe [GrantEntitlementRequest]))
-> (Maybe [GrantEntitlementRequest]
    -> f (Maybe [GrantEntitlementRequest]))
-> CreateFlow
-> f CreateFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
-> Iso
     (Maybe [GrantEntitlementRequest])
     (Maybe [GrantEntitlementRequest])
     (Maybe [GrantEntitlementRequest])
     (Maybe [GrantEntitlementRequest])
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
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
  [GrantEntitlementRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
createFlow_source :: Lens.Lens' CreateFlow (Prelude.Maybe SetSourceRequest)
createFlow_source :: (Maybe SetSourceRequest -> f (Maybe SetSourceRequest))
-> CreateFlow -> f CreateFlow
createFlow_source = (CreateFlow -> Maybe SetSourceRequest)
-> (CreateFlow -> Maybe SetSourceRequest -> CreateFlow)
-> Lens
     CreateFlow
     CreateFlow
     (Maybe SetSourceRequest)
     (Maybe SetSourceRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe SetSourceRequest
source :: Maybe SetSourceRequest
$sel:source:CreateFlow' :: CreateFlow -> Maybe SetSourceRequest
source} -> Maybe SetSourceRequest
source) (\s :: CreateFlow
s@CreateFlow' {} Maybe SetSourceRequest
a -> CreateFlow
s {$sel:source:CreateFlow' :: Maybe SetSourceRequest
source = Maybe SetSourceRequest
a} :: CreateFlow)

-- | The name of the flow.
createFlow_name :: Lens.Lens' CreateFlow Prelude.Text
createFlow_name :: (Text -> f Text) -> CreateFlow -> f CreateFlow
createFlow_name = (CreateFlow -> Text)
-> (CreateFlow -> Text -> CreateFlow)
-> Lens CreateFlow CreateFlow Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Text
name :: Text
$sel:name:CreateFlow' :: CreateFlow -> Text
name} -> Text
name) (\s :: CreateFlow
s@CreateFlow' {} Text
a -> CreateFlow
s {$sel:name:CreateFlow' :: Text
name = Text
a} :: CreateFlow)

instance Core.AWSRequest CreateFlow where
  type AWSResponse CreateFlow = CreateFlowResponse
  request :: CreateFlow -> Request CreateFlow
request = Service -> CreateFlow -> Request CreateFlow
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFlow)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFlow))
-> Logger
-> Service
-> Proxy CreateFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFlow)))
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 -> CreateFlowResponse
CreateFlowResponse'
            (Maybe Flow -> Int -> CreateFlowResponse)
-> Either String (Maybe Flow)
-> Either String (Int -> CreateFlowResponse)
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 -> CreateFlowResponse)
-> Either String Int -> Either String CreateFlowResponse
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 CreateFlow

instance Prelude.NFData CreateFlow

instance Core.ToHeaders CreateFlow where
  toHeaders :: CreateFlow -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateFlow -> 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 CreateFlow where
  toJSON :: CreateFlow -> Value
toJSON CreateFlow' {Maybe [GrantEntitlementRequest]
Maybe [SetSourceRequest]
Maybe [AddMediaStreamRequest]
Maybe [AddOutputRequest]
Maybe [VpcInterfaceRequest]
Maybe Text
Maybe SetSourceRequest
Maybe FailoverConfig
Text
name :: Text
source :: Maybe SetSourceRequest
entitlements :: Maybe [GrantEntitlementRequest]
availabilityZone :: Maybe Text
outputs :: Maybe [AddOutputRequest]
sources :: Maybe [SetSourceRequest]
vpcInterfaces :: Maybe [VpcInterfaceRequest]
sourceFailoverConfig :: Maybe FailoverConfig
mediaStreams :: Maybe [AddMediaStreamRequest]
$sel:name:CreateFlow' :: CreateFlow -> Text
$sel:source:CreateFlow' :: CreateFlow -> Maybe SetSourceRequest
$sel:entitlements:CreateFlow' :: CreateFlow -> Maybe [GrantEntitlementRequest]
$sel:availabilityZone:CreateFlow' :: CreateFlow -> Maybe Text
$sel:outputs:CreateFlow' :: CreateFlow -> Maybe [AddOutputRequest]
$sel:sources:CreateFlow' :: CreateFlow -> Maybe [SetSourceRequest]
$sel:vpcInterfaces:CreateFlow' :: CreateFlow -> Maybe [VpcInterfaceRequest]
$sel:sourceFailoverConfig:CreateFlow' :: CreateFlow -> Maybe FailoverConfig
$sel:mediaStreams:CreateFlow' :: CreateFlow -> Maybe [AddMediaStreamRequest]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"mediaStreams" Text -> [AddMediaStreamRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AddMediaStreamRequest] -> Pair)
-> Maybe [AddMediaStreamRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AddMediaStreamRequest]
mediaStreams,
            (Text
"sourceFailoverConfig" Text -> FailoverConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (FailoverConfig -> Pair) -> Maybe FailoverConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FailoverConfig
sourceFailoverConfig,
            (Text
"vpcInterfaces" Text -> [VpcInterfaceRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([VpcInterfaceRequest] -> Pair)
-> Maybe [VpcInterfaceRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [VpcInterfaceRequest]
vpcInterfaces,
            (Text
"sources" Text -> [SetSourceRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SetSourceRequest] -> Pair)
-> Maybe [SetSourceRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SetSourceRequest]
sources,
            (Text
"outputs" Text -> [AddOutputRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AddOutputRequest] -> Pair)
-> Maybe [AddOutputRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AddOutputRequest]
outputs,
            (Text
"availabilityZone" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
availabilityZone,
            (Text
"entitlements" Text -> [GrantEntitlementRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([GrantEntitlementRequest] -> Pair)
-> Maybe [GrantEntitlementRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GrantEntitlementRequest]
entitlements,
            (Text
"source" Text -> SetSourceRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SetSourceRequest -> Pair) -> Maybe SetSourceRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SetSourceRequest
source,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

instance Core.ToPath CreateFlow where
  toPath :: CreateFlow -> ByteString
toPath = ByteString -> CreateFlow -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/flows"

instance Core.ToQuery CreateFlow where
  toQuery :: CreateFlow -> QueryString
toQuery = QueryString -> CreateFlow -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateFlowResponse' smart constructor.
data CreateFlowResponse = CreateFlowResponse'
  { CreateFlowResponse -> Maybe Flow
flow :: Prelude.Maybe Flow,
    -- | The response's http status code.
    CreateFlowResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateFlowResponse -> CreateFlowResponse -> Bool
(CreateFlowResponse -> CreateFlowResponse -> Bool)
-> (CreateFlowResponse -> CreateFlowResponse -> Bool)
-> Eq CreateFlowResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFlowResponse -> CreateFlowResponse -> Bool
$c/= :: CreateFlowResponse -> CreateFlowResponse -> Bool
== :: CreateFlowResponse -> CreateFlowResponse -> Bool
$c== :: CreateFlowResponse -> CreateFlowResponse -> Bool
Prelude.Eq, ReadPrec [CreateFlowResponse]
ReadPrec CreateFlowResponse
Int -> ReadS CreateFlowResponse
ReadS [CreateFlowResponse]
(Int -> ReadS CreateFlowResponse)
-> ReadS [CreateFlowResponse]
-> ReadPrec CreateFlowResponse
-> ReadPrec [CreateFlowResponse]
-> Read CreateFlowResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFlowResponse]
$creadListPrec :: ReadPrec [CreateFlowResponse]
readPrec :: ReadPrec CreateFlowResponse
$creadPrec :: ReadPrec CreateFlowResponse
readList :: ReadS [CreateFlowResponse]
$creadList :: ReadS [CreateFlowResponse]
readsPrec :: Int -> ReadS CreateFlowResponse
$creadsPrec :: Int -> ReadS CreateFlowResponse
Prelude.Read, Int -> CreateFlowResponse -> ShowS
[CreateFlowResponse] -> ShowS
CreateFlowResponse -> String
(Int -> CreateFlowResponse -> ShowS)
-> (CreateFlowResponse -> String)
-> ([CreateFlowResponse] -> ShowS)
-> Show CreateFlowResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFlowResponse] -> ShowS
$cshowList :: [CreateFlowResponse] -> ShowS
show :: CreateFlowResponse -> String
$cshow :: CreateFlowResponse -> String
showsPrec :: Int -> CreateFlowResponse -> ShowS
$cshowsPrec :: Int -> CreateFlowResponse -> ShowS
Prelude.Show, (forall x. CreateFlowResponse -> Rep CreateFlowResponse x)
-> (forall x. Rep CreateFlowResponse x -> CreateFlowResponse)
-> Generic CreateFlowResponse
forall x. Rep CreateFlowResponse x -> CreateFlowResponse
forall x. CreateFlowResponse -> Rep CreateFlowResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFlowResponse x -> CreateFlowResponse
$cfrom :: forall x. CreateFlowResponse -> Rep CreateFlowResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFlowResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'flow', 'createFlowResponse_flow' - Undocumented member.
--
-- 'httpStatus', 'createFlowResponse_httpStatus' - The response's http status code.
newCreateFlowResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFlowResponse
newCreateFlowResponse :: Int -> CreateFlowResponse
newCreateFlowResponse Int
pHttpStatus_ =
  CreateFlowResponse' :: Maybe Flow -> Int -> CreateFlowResponse
CreateFlowResponse'
    { $sel:flow:CreateFlowResponse' :: Maybe Flow
flow = Maybe Flow
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateFlowResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
createFlowResponse_flow :: Lens.Lens' CreateFlowResponse (Prelude.Maybe Flow)
createFlowResponse_flow :: (Maybe Flow -> f (Maybe Flow))
-> CreateFlowResponse -> f CreateFlowResponse
createFlowResponse_flow = (CreateFlowResponse -> Maybe Flow)
-> (CreateFlowResponse -> Maybe Flow -> CreateFlowResponse)
-> Lens
     CreateFlowResponse CreateFlowResponse (Maybe Flow) (Maybe Flow)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlowResponse' {Maybe Flow
flow :: Maybe Flow
$sel:flow:CreateFlowResponse' :: CreateFlowResponse -> Maybe Flow
flow} -> Maybe Flow
flow) (\s :: CreateFlowResponse
s@CreateFlowResponse' {} Maybe Flow
a -> CreateFlowResponse
s {$sel:flow:CreateFlowResponse' :: Maybe Flow
flow = Maybe Flow
a} :: CreateFlowResponse)

-- | The response's http status code.
createFlowResponse_httpStatus :: Lens.Lens' CreateFlowResponse Prelude.Int
createFlowResponse_httpStatus :: (Int -> f Int) -> CreateFlowResponse -> f CreateFlowResponse
createFlowResponse_httpStatus = (CreateFlowResponse -> Int)
-> (CreateFlowResponse -> Int -> CreateFlowResponse)
-> Lens CreateFlowResponse CreateFlowResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlowResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateFlowResponse' :: CreateFlowResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateFlowResponse
s@CreateFlowResponse' {} Int
a -> CreateFlowResponse
s {$sel:httpStatus:CreateFlowResponse' :: Int
httpStatus = Int
a} :: CreateFlowResponse)

instance Prelude.NFData CreateFlowResponse