{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_availabilityZone,
    createFlow_entitlements,
    createFlow_maintenance,
    createFlow_mediaStreams,
    createFlow_outputs,
    createFlow_source,
    createFlow_sourceFailoverConfig,
    createFlow_sources,
    createFlow_vpcInterfaces,
    createFlow_name,

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

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

-- | 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 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 AddMaintenance
maintenance :: Prelude.Maybe AddMaintenance,
    -- | 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],
    -- | The outputs that you want to add to this flow.
    CreateFlow -> Maybe [AddOutputRequest]
outputs :: Prelude.Maybe [AddOutputRequest],
    CreateFlow -> Maybe SetSourceRequest
source :: Prelude.Maybe SetSourceRequest,
    CreateFlow -> Maybe FailoverConfig
sourceFailoverConfig :: Prelude.Maybe FailoverConfig,
    CreateFlow -> Maybe [SetSourceRequest]
sources :: Prelude.Maybe [SetSourceRequest],
    -- | The VPC interfaces you want on the flow.
    CreateFlow -> Maybe [VpcInterfaceRequest]
vpcInterfaces :: Prelude.Maybe [VpcInterfaceRequest],
    -- | The name of the flow.
    CreateFlow -> Text
name :: Prelude.Text
  }
  deriving (CreateFlow -> CreateFlow -> Bool
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]
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
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. 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:
--
-- '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.
--
-- 'maintenance', 'createFlow_maintenance' - Undocumented member.
--
-- '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.
--
-- 'outputs', 'createFlow_outputs' - The outputs that you want to add to this flow.
--
-- 'source', 'createFlow_source' - Undocumented member.
--
-- 'sourceFailoverConfig', 'createFlow_sourceFailoverConfig' - Undocumented member.
--
-- 'sources', 'createFlow_sources' - Undocumented member.
--
-- 'vpcInterfaces', 'createFlow_vpcInterfaces' - The VPC interfaces you want on the flow.
--
-- 'name', 'createFlow_name' - The name of the flow.
newCreateFlow ::
  -- | 'name'
  Prelude.Text ->
  CreateFlow
newCreateFlow :: Text -> CreateFlow
newCreateFlow Text
pName_ =
  CreateFlow'
    { $sel:availabilityZone:CreateFlow' :: Maybe Text
availabilityZone = forall a. Maybe a
Prelude.Nothing,
      $sel:entitlements:CreateFlow' :: Maybe [GrantEntitlementRequest]
entitlements = forall a. Maybe a
Prelude.Nothing,
      $sel:maintenance:CreateFlow' :: Maybe AddMaintenance
maintenance = forall a. Maybe a
Prelude.Nothing,
      $sel:mediaStreams:CreateFlow' :: Maybe [AddMediaStreamRequest]
mediaStreams = forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:CreateFlow' :: Maybe [AddOutputRequest]
outputs = forall a. Maybe a
Prelude.Nothing,
      $sel:source:CreateFlow' :: Maybe SetSourceRequest
source = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceFailoverConfig:CreateFlow' :: Maybe FailoverConfig
sourceFailoverConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:sources:CreateFlow' :: Maybe [SetSourceRequest]
sources = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcInterfaces:CreateFlow' :: Maybe [VpcInterfaceRequest]
vpcInterfaces = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateFlow' :: Text
name = Text
pName_
    }

-- | 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 :: Lens' CreateFlow (Maybe Text)
createFlow_availabilityZone = 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 :: Lens' CreateFlow (Maybe [GrantEntitlementRequest])
createFlow_entitlements = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
createFlow_maintenance :: Lens.Lens' CreateFlow (Prelude.Maybe AddMaintenance)
createFlow_maintenance :: Lens' CreateFlow (Maybe AddMaintenance)
createFlow_maintenance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFlow' {Maybe AddMaintenance
maintenance :: Maybe AddMaintenance
$sel:maintenance:CreateFlow' :: CreateFlow -> Maybe AddMaintenance
maintenance} -> Maybe AddMaintenance
maintenance) (\s :: CreateFlow
s@CreateFlow' {} Maybe AddMaintenance
a -> CreateFlow
s {$sel:maintenance:CreateFlow' :: Maybe AddMaintenance
maintenance = Maybe AddMaintenance
a} :: 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_mediaStreams :: Lens.Lens' CreateFlow (Prelude.Maybe [AddMediaStreamRequest])
createFlow_mediaStreams :: Lens' CreateFlow (Maybe [AddMediaStreamRequest])
createFlow_mediaStreams = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CreateFlow (Maybe [AddOutputRequest])
createFlow_outputs = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CreateFlow (Maybe SetSourceRequest)
createFlow_source = 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)

-- | Undocumented member.
createFlow_sourceFailoverConfig :: Lens.Lens' CreateFlow (Prelude.Maybe FailoverConfig)
createFlow_sourceFailoverConfig :: Lens' CreateFlow (Maybe FailoverConfig)
createFlow_sourceFailoverConfig = 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)

-- | Undocumented member.
createFlow_sources :: Lens.Lens' CreateFlow (Prelude.Maybe [SetSourceRequest])
createFlow_sources :: Lens' CreateFlow (Maybe [SetSourceRequest])
createFlow_sources = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The name of the flow.
createFlow_name :: Lens.Lens' CreateFlow Prelude.Text
createFlow_name :: Lens' CreateFlow Text
createFlow_name = 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 :: (Service -> Service) -> CreateFlow -> Request CreateFlow
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 CreateFlow
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFlow)))
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 Flow -> Int -> CreateFlowResponse
CreateFlowResponse'
            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
"flow")
            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 CreateFlow where
  hashWithSalt :: Int -> CreateFlow -> Int
hashWithSalt Int
_salt CreateFlow' {Maybe [GrantEntitlementRequest]
Maybe [SetSourceRequest]
Maybe [AddMediaStreamRequest]
Maybe [AddOutputRequest]
Maybe [VpcInterfaceRequest]
Maybe Text
Maybe AddMaintenance
Maybe SetSourceRequest
Maybe FailoverConfig
Text
name :: Text
vpcInterfaces :: Maybe [VpcInterfaceRequest]
sources :: Maybe [SetSourceRequest]
sourceFailoverConfig :: Maybe FailoverConfig
source :: Maybe SetSourceRequest
outputs :: Maybe [AddOutputRequest]
mediaStreams :: Maybe [AddMediaStreamRequest]
maintenance :: Maybe AddMaintenance
entitlements :: Maybe [GrantEntitlementRequest]
availabilityZone :: Maybe Text
$sel:name:CreateFlow' :: CreateFlow -> Text
$sel:vpcInterfaces:CreateFlow' :: CreateFlow -> Maybe [VpcInterfaceRequest]
$sel:sources:CreateFlow' :: CreateFlow -> Maybe [SetSourceRequest]
$sel:sourceFailoverConfig:CreateFlow' :: CreateFlow -> Maybe FailoverConfig
$sel:source:CreateFlow' :: CreateFlow -> Maybe SetSourceRequest
$sel:outputs:CreateFlow' :: CreateFlow -> Maybe [AddOutputRequest]
$sel:mediaStreams:CreateFlow' :: CreateFlow -> Maybe [AddMediaStreamRequest]
$sel:maintenance:CreateFlow' :: CreateFlow -> Maybe AddMaintenance
$sel:entitlements:CreateFlow' :: CreateFlow -> Maybe [GrantEntitlementRequest]
$sel:availabilityZone:CreateFlow' :: CreateFlow -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZone
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GrantEntitlementRequest]
entitlements
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AddMaintenance
maintenance
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AddMediaStreamRequest]
mediaStreams
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AddOutputRequest]
outputs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SetSourceRequest
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FailoverConfig
sourceFailoverConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SetSourceRequest]
sources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [VpcInterfaceRequest]
vpcInterfaces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateFlow where
  rnf :: CreateFlow -> ()
rnf CreateFlow' {Maybe [GrantEntitlementRequest]
Maybe [SetSourceRequest]
Maybe [AddMediaStreamRequest]
Maybe [AddOutputRequest]
Maybe [VpcInterfaceRequest]
Maybe Text
Maybe AddMaintenance
Maybe SetSourceRequest
Maybe FailoverConfig
Text
name :: Text
vpcInterfaces :: Maybe [VpcInterfaceRequest]
sources :: Maybe [SetSourceRequest]
sourceFailoverConfig :: Maybe FailoverConfig
source :: Maybe SetSourceRequest
outputs :: Maybe [AddOutputRequest]
mediaStreams :: Maybe [AddMediaStreamRequest]
maintenance :: Maybe AddMaintenance
entitlements :: Maybe [GrantEntitlementRequest]
availabilityZone :: Maybe Text
$sel:name:CreateFlow' :: CreateFlow -> Text
$sel:vpcInterfaces:CreateFlow' :: CreateFlow -> Maybe [VpcInterfaceRequest]
$sel:sources:CreateFlow' :: CreateFlow -> Maybe [SetSourceRequest]
$sel:sourceFailoverConfig:CreateFlow' :: CreateFlow -> Maybe FailoverConfig
$sel:source:CreateFlow' :: CreateFlow -> Maybe SetSourceRequest
$sel:outputs:CreateFlow' :: CreateFlow -> Maybe [AddOutputRequest]
$sel:mediaStreams:CreateFlow' :: CreateFlow -> Maybe [AddMediaStreamRequest]
$sel:maintenance:CreateFlow' :: CreateFlow -> Maybe AddMaintenance
$sel:entitlements:CreateFlow' :: CreateFlow -> Maybe [GrantEntitlementRequest]
$sel:availabilityZone:CreateFlow' :: CreateFlow -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZone
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [GrantEntitlementRequest]
entitlements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AddMaintenance
maintenance
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AddMediaStreamRequest]
mediaStreams
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AddOutputRequest]
outputs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SetSourceRequest
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FailoverConfig
sourceFailoverConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SetSourceRequest]
sources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [VpcInterfaceRequest]
vpcInterfaces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

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

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

instance Data.ToQuery CreateFlow where
  toQuery :: CreateFlow -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
    { $sel:flow:CreateFlowResponse' :: Maybe Flow
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 :: Lens' CreateFlowResponse (Maybe Flow)
createFlowResponse_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 :: Lens' CreateFlowResponse Int
createFlowResponse_httpStatus = 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 where
  rnf :: CreateFlowResponse -> ()
rnf CreateFlowResponse' {Int
Maybe Flow
httpStatus :: Int
flow :: Maybe Flow
$sel:httpStatus:CreateFlowResponse' :: CreateFlowResponse -> Int
$sel:flow:CreateFlowResponse' :: CreateFlowResponse -> Maybe Flow
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Flow
flow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus