{-# 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.IVS.CreateChannel
-- 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 channel and an associated stream key to start streaming.
module Amazonka.IVS.CreateChannel
  ( -- * Creating a Request
    CreateChannel (..),
    newCreateChannel,

    -- * Request Lenses
    createChannel_authorized,
    createChannel_latencyMode,
    createChannel_name,
    createChannel_recordingConfigurationArn,
    createChannel_type,
    createChannel_tags,

    -- * Destructuring the Response
    CreateChannelResponse (..),
    newCreateChannelResponse,

    -- * Response Lenses
    createChannelResponse_channel,
    createChannelResponse_streamKey,
    createChannelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IVS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateChannel' smart constructor.
data CreateChannel = CreateChannel'
  { -- | Whether the channel is private (enabled for playback authorization).
    -- Default: @false@.
    CreateChannel -> Maybe Bool
authorized :: Prelude.Maybe Prelude.Bool,
    -- | Channel latency mode. Use @NORMAL@ to broadcast and deliver live video
    -- up to Full HD. Use @LOW@ for near-real-time interaction with viewers.
    -- (Note: In the Amazon IVS console, @LOW@ and @NORMAL@ correspond to
    -- Ultra-low and Standard, respectively.) Default: @LOW@.
    CreateChannel -> Maybe ChannelLatencyMode
latencyMode :: Prelude.Maybe ChannelLatencyMode,
    -- | Channel name.
    CreateChannel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Recording-configuration ARN. Default: \"\" (empty string, recording is
    -- disabled).
    CreateChannel -> Maybe Text
recordingConfigurationArn :: Prelude.Maybe Prelude.Text,
    -- | Channel type, which determines the allowable resolution and bitrate. /If
    -- you exceed the allowable resolution or bitrate, the stream probably will
    -- disconnect immediately./ Default: @STANDARD@. Valid values:
    --
    -- -   @STANDARD@: Multiple qualities are generated from the original
    --     input, to automatically give viewers the best experience for their
    --     devices and network conditions. Resolution can be up to 1080p and
    --     bitrate can be up to 8.5 Mbps. Audio is transcoded only for
    --     renditions 360p and below; above that, audio is passed through.
    --
    -- -   @BASIC@: Amazon IVS delivers the original input to viewers. The
    --     viewer’s video-quality choice is limited to the original input.
    --     Resolution can be up to 480p and bitrate can be up to 1.5 Mbps.
    CreateChannel -> Maybe ChannelType
type' :: Prelude.Maybe ChannelType,
    -- | Array of 1-50 maps, each of the form @string:string (key:value)@.
    CreateChannel -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateChannel -> CreateChannel -> Bool
(CreateChannel -> CreateChannel -> Bool)
-> (CreateChannel -> CreateChannel -> Bool) -> Eq CreateChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannel -> CreateChannel -> Bool
$c/= :: CreateChannel -> CreateChannel -> Bool
== :: CreateChannel -> CreateChannel -> Bool
$c== :: CreateChannel -> CreateChannel -> Bool
Prelude.Eq, ReadPrec [CreateChannel]
ReadPrec CreateChannel
Int -> ReadS CreateChannel
ReadS [CreateChannel]
(Int -> ReadS CreateChannel)
-> ReadS [CreateChannel]
-> ReadPrec CreateChannel
-> ReadPrec [CreateChannel]
-> Read CreateChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateChannel]
$creadListPrec :: ReadPrec [CreateChannel]
readPrec :: ReadPrec CreateChannel
$creadPrec :: ReadPrec CreateChannel
readList :: ReadS [CreateChannel]
$creadList :: ReadS [CreateChannel]
readsPrec :: Int -> ReadS CreateChannel
$creadsPrec :: Int -> ReadS CreateChannel
Prelude.Read, Int -> CreateChannel -> ShowS
[CreateChannel] -> ShowS
CreateChannel -> String
(Int -> CreateChannel -> ShowS)
-> (CreateChannel -> String)
-> ([CreateChannel] -> ShowS)
-> Show CreateChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannel] -> ShowS
$cshowList :: [CreateChannel] -> ShowS
show :: CreateChannel -> String
$cshow :: CreateChannel -> String
showsPrec :: Int -> CreateChannel -> ShowS
$cshowsPrec :: Int -> CreateChannel -> ShowS
Prelude.Show, (forall x. CreateChannel -> Rep CreateChannel x)
-> (forall x. Rep CreateChannel x -> CreateChannel)
-> Generic CreateChannel
forall x. Rep CreateChannel x -> CreateChannel
forall x. CreateChannel -> Rep CreateChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateChannel x -> CreateChannel
$cfrom :: forall x. CreateChannel -> Rep CreateChannel x
Prelude.Generic)

-- |
-- Create a value of 'CreateChannel' 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:
--
-- 'authorized', 'createChannel_authorized' - Whether the channel is private (enabled for playback authorization).
-- Default: @false@.
--
-- 'latencyMode', 'createChannel_latencyMode' - Channel latency mode. Use @NORMAL@ to broadcast and deliver live video
-- up to Full HD. Use @LOW@ for near-real-time interaction with viewers.
-- (Note: In the Amazon IVS console, @LOW@ and @NORMAL@ correspond to
-- Ultra-low and Standard, respectively.) Default: @LOW@.
--
-- 'name', 'createChannel_name' - Channel name.
--
-- 'recordingConfigurationArn', 'createChannel_recordingConfigurationArn' - Recording-configuration ARN. Default: \"\" (empty string, recording is
-- disabled).
--
-- 'type'', 'createChannel_type' - Channel type, which determines the allowable resolution and bitrate. /If
-- you exceed the allowable resolution or bitrate, the stream probably will
-- disconnect immediately./ Default: @STANDARD@. Valid values:
--
-- -   @STANDARD@: Multiple qualities are generated from the original
--     input, to automatically give viewers the best experience for their
--     devices and network conditions. Resolution can be up to 1080p and
--     bitrate can be up to 8.5 Mbps. Audio is transcoded only for
--     renditions 360p and below; above that, audio is passed through.
--
-- -   @BASIC@: Amazon IVS delivers the original input to viewers. The
--     viewer’s video-quality choice is limited to the original input.
--     Resolution can be up to 480p and bitrate can be up to 1.5 Mbps.
--
-- 'tags', 'createChannel_tags' - Array of 1-50 maps, each of the form @string:string (key:value)@.
newCreateChannel ::
  CreateChannel
newCreateChannel :: CreateChannel
newCreateChannel =
  CreateChannel' :: Maybe Bool
-> Maybe ChannelLatencyMode
-> Maybe Text
-> Maybe Text
-> Maybe ChannelType
-> Maybe (HashMap Text Text)
-> CreateChannel
CreateChannel'
    { $sel:authorized:CreateChannel' :: Maybe Bool
authorized = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:latencyMode:CreateChannel' :: Maybe ChannelLatencyMode
latencyMode = Maybe ChannelLatencyMode
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateChannel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recordingConfigurationArn:CreateChannel' :: Maybe Text
recordingConfigurationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CreateChannel' :: Maybe ChannelType
type' = Maybe ChannelType
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateChannel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether the channel is private (enabled for playback authorization).
-- Default: @false@.
createChannel_authorized :: Lens.Lens' CreateChannel (Prelude.Maybe Prelude.Bool)
createChannel_authorized :: (Maybe Bool -> f (Maybe Bool)) -> CreateChannel -> f CreateChannel
createChannel_authorized = (CreateChannel -> Maybe Bool)
-> (CreateChannel -> Maybe Bool -> CreateChannel)
-> Lens CreateChannel CreateChannel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe Bool
authorized :: Maybe Bool
$sel:authorized:CreateChannel' :: CreateChannel -> Maybe Bool
authorized} -> Maybe Bool
authorized) (\s :: CreateChannel
s@CreateChannel' {} Maybe Bool
a -> CreateChannel
s {$sel:authorized:CreateChannel' :: Maybe Bool
authorized = Maybe Bool
a} :: CreateChannel)

-- | Channel latency mode. Use @NORMAL@ to broadcast and deliver live video
-- up to Full HD. Use @LOW@ for near-real-time interaction with viewers.
-- (Note: In the Amazon IVS console, @LOW@ and @NORMAL@ correspond to
-- Ultra-low and Standard, respectively.) Default: @LOW@.
createChannel_latencyMode :: Lens.Lens' CreateChannel (Prelude.Maybe ChannelLatencyMode)
createChannel_latencyMode :: (Maybe ChannelLatencyMode -> f (Maybe ChannelLatencyMode))
-> CreateChannel -> f CreateChannel
createChannel_latencyMode = (CreateChannel -> Maybe ChannelLatencyMode)
-> (CreateChannel -> Maybe ChannelLatencyMode -> CreateChannel)
-> Lens
     CreateChannel
     CreateChannel
     (Maybe ChannelLatencyMode)
     (Maybe ChannelLatencyMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe ChannelLatencyMode
latencyMode :: Maybe ChannelLatencyMode
$sel:latencyMode:CreateChannel' :: CreateChannel -> Maybe ChannelLatencyMode
latencyMode} -> Maybe ChannelLatencyMode
latencyMode) (\s :: CreateChannel
s@CreateChannel' {} Maybe ChannelLatencyMode
a -> CreateChannel
s {$sel:latencyMode:CreateChannel' :: Maybe ChannelLatencyMode
latencyMode = Maybe ChannelLatencyMode
a} :: CreateChannel)

-- | Channel name.
createChannel_name :: Lens.Lens' CreateChannel (Prelude.Maybe Prelude.Text)
createChannel_name :: (Maybe Text -> f (Maybe Text)) -> CreateChannel -> f CreateChannel
createChannel_name = (CreateChannel -> Maybe Text)
-> (CreateChannel -> Maybe Text -> CreateChannel)
-> Lens CreateChannel CreateChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe Text
name :: Maybe Text
$sel:name:CreateChannel' :: CreateChannel -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateChannel
s@CreateChannel' {} Maybe Text
a -> CreateChannel
s {$sel:name:CreateChannel' :: Maybe Text
name = Maybe Text
a} :: CreateChannel)

-- | Recording-configuration ARN. Default: \"\" (empty string, recording is
-- disabled).
createChannel_recordingConfigurationArn :: Lens.Lens' CreateChannel (Prelude.Maybe Prelude.Text)
createChannel_recordingConfigurationArn :: (Maybe Text -> f (Maybe Text)) -> CreateChannel -> f CreateChannel
createChannel_recordingConfigurationArn = (CreateChannel -> Maybe Text)
-> (CreateChannel -> Maybe Text -> CreateChannel)
-> Lens CreateChannel CreateChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe Text
recordingConfigurationArn :: Maybe Text
$sel:recordingConfigurationArn:CreateChannel' :: CreateChannel -> Maybe Text
recordingConfigurationArn} -> Maybe Text
recordingConfigurationArn) (\s :: CreateChannel
s@CreateChannel' {} Maybe Text
a -> CreateChannel
s {$sel:recordingConfigurationArn:CreateChannel' :: Maybe Text
recordingConfigurationArn = Maybe Text
a} :: CreateChannel)

-- | Channel type, which determines the allowable resolution and bitrate. /If
-- you exceed the allowable resolution or bitrate, the stream probably will
-- disconnect immediately./ Default: @STANDARD@. Valid values:
--
-- -   @STANDARD@: Multiple qualities are generated from the original
--     input, to automatically give viewers the best experience for their
--     devices and network conditions. Resolution can be up to 1080p and
--     bitrate can be up to 8.5 Mbps. Audio is transcoded only for
--     renditions 360p and below; above that, audio is passed through.
--
-- -   @BASIC@: Amazon IVS delivers the original input to viewers. The
--     viewer’s video-quality choice is limited to the original input.
--     Resolution can be up to 480p and bitrate can be up to 1.5 Mbps.
createChannel_type :: Lens.Lens' CreateChannel (Prelude.Maybe ChannelType)
createChannel_type :: (Maybe ChannelType -> f (Maybe ChannelType))
-> CreateChannel -> f CreateChannel
createChannel_type = (CreateChannel -> Maybe ChannelType)
-> (CreateChannel -> Maybe ChannelType -> CreateChannel)
-> Lens
     CreateChannel CreateChannel (Maybe ChannelType) (Maybe ChannelType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe ChannelType
type' :: Maybe ChannelType
$sel:type':CreateChannel' :: CreateChannel -> Maybe ChannelType
type'} -> Maybe ChannelType
type') (\s :: CreateChannel
s@CreateChannel' {} Maybe ChannelType
a -> CreateChannel
s {$sel:type':CreateChannel' :: Maybe ChannelType
type' = Maybe ChannelType
a} :: CreateChannel)

-- | Array of 1-50 maps, each of the form @string:string (key:value)@.
createChannel_tags :: Lens.Lens' CreateChannel (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createChannel_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateChannel -> f CreateChannel
createChannel_tags = (CreateChannel -> Maybe (HashMap Text Text))
-> (CreateChannel -> Maybe (HashMap Text Text) -> CreateChannel)
-> Lens
     CreateChannel
     CreateChannel
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannel' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateChannel' :: CreateChannel -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateChannel
s@CreateChannel' {} Maybe (HashMap Text Text)
a -> CreateChannel
s {$sel:tags:CreateChannel' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateChannel) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateChannel -> f CreateChannel)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateChannel
-> f CreateChannel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateChannel where
  type
    AWSResponse CreateChannel =
      CreateChannelResponse
  request :: CreateChannel -> Request CreateChannel
request = Service -> CreateChannel -> Request CreateChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateChannel))
-> Logger
-> Service
-> Proxy CreateChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateChannel)))
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 Channel -> Maybe StreamKey -> Int -> CreateChannelResponse
CreateChannelResponse'
            (Maybe Channel -> Maybe StreamKey -> Int -> CreateChannelResponse)
-> Either String (Maybe Channel)
-> Either String (Maybe StreamKey -> Int -> CreateChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Channel)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"channel")
            Either String (Maybe StreamKey -> Int -> CreateChannelResponse)
-> Either String (Maybe StreamKey)
-> Either String (Int -> CreateChannelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe StreamKey)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamKey")
            Either String (Int -> CreateChannelResponse)
-> Either String Int -> Either String CreateChannelResponse
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 CreateChannel

instance Prelude.NFData CreateChannel

instance Core.ToHeaders CreateChannel where
  toHeaders :: CreateChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateChannel -> 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 CreateChannel where
  toJSON :: CreateChannel -> Value
toJSON CreateChannel' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe ChannelLatencyMode
Maybe ChannelType
tags :: Maybe (HashMap Text Text)
type' :: Maybe ChannelType
recordingConfigurationArn :: Maybe Text
name :: Maybe Text
latencyMode :: Maybe ChannelLatencyMode
authorized :: Maybe Bool
$sel:tags:CreateChannel' :: CreateChannel -> Maybe (HashMap Text Text)
$sel:type':CreateChannel' :: CreateChannel -> Maybe ChannelType
$sel:recordingConfigurationArn:CreateChannel' :: CreateChannel -> Maybe Text
$sel:name:CreateChannel' :: CreateChannel -> Maybe Text
$sel:latencyMode:CreateChannel' :: CreateChannel -> Maybe ChannelLatencyMode
$sel:authorized:CreateChannel' :: CreateChannel -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"authorized" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
authorized,
            (Text
"latencyMode" Text -> ChannelLatencyMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChannelLatencyMode -> Pair)
-> Maybe ChannelLatencyMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelLatencyMode
latencyMode,
            (Text
"name" 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
name,
            (Text
"recordingConfigurationArn" 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
recordingConfigurationArn,
            (Text
"type" Text -> ChannelType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChannelType -> Pair) -> Maybe ChannelType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelType
type',
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )

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

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

-- | /See:/ 'newCreateChannelResponse' smart constructor.
data CreateChannelResponse = CreateChannelResponse'
  { CreateChannelResponse -> Maybe Channel
channel :: Prelude.Maybe Channel,
    CreateChannelResponse -> Maybe StreamKey
streamKey :: Prelude.Maybe StreamKey,
    -- | The response's http status code.
    CreateChannelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateChannelResponse -> CreateChannelResponse -> Bool
(CreateChannelResponse -> CreateChannelResponse -> Bool)
-> (CreateChannelResponse -> CreateChannelResponse -> Bool)
-> Eq CreateChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateChannelResponse -> CreateChannelResponse -> Bool
$c/= :: CreateChannelResponse -> CreateChannelResponse -> Bool
== :: CreateChannelResponse -> CreateChannelResponse -> Bool
$c== :: CreateChannelResponse -> CreateChannelResponse -> Bool
Prelude.Eq, Int -> CreateChannelResponse -> ShowS
[CreateChannelResponse] -> ShowS
CreateChannelResponse -> String
(Int -> CreateChannelResponse -> ShowS)
-> (CreateChannelResponse -> String)
-> ([CreateChannelResponse] -> ShowS)
-> Show CreateChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateChannelResponse] -> ShowS
$cshowList :: [CreateChannelResponse] -> ShowS
show :: CreateChannelResponse -> String
$cshow :: CreateChannelResponse -> String
showsPrec :: Int -> CreateChannelResponse -> ShowS
$cshowsPrec :: Int -> CreateChannelResponse -> ShowS
Prelude.Show, (forall x. CreateChannelResponse -> Rep CreateChannelResponse x)
-> (forall x. Rep CreateChannelResponse x -> CreateChannelResponse)
-> Generic CreateChannelResponse
forall x. Rep CreateChannelResponse x -> CreateChannelResponse
forall x. CreateChannelResponse -> Rep CreateChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateChannelResponse x -> CreateChannelResponse
$cfrom :: forall x. CreateChannelResponse -> Rep CreateChannelResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateChannelResponse' 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:
--
-- 'channel', 'createChannelResponse_channel' -
--
-- 'streamKey', 'createChannelResponse_streamKey' -
--
-- 'httpStatus', 'createChannelResponse_httpStatus' - The response's http status code.
newCreateChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateChannelResponse
newCreateChannelResponse :: Int -> CreateChannelResponse
newCreateChannelResponse Int
pHttpStatus_ =
  CreateChannelResponse' :: Maybe Channel -> Maybe StreamKey -> Int -> CreateChannelResponse
CreateChannelResponse'
    { $sel:channel:CreateChannelResponse' :: Maybe Channel
channel = Maybe Channel
forall a. Maybe a
Prelude.Nothing,
      $sel:streamKey:CreateChannelResponse' :: Maybe StreamKey
streamKey = Maybe StreamKey
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- |
createChannelResponse_channel :: Lens.Lens' CreateChannelResponse (Prelude.Maybe Channel)
createChannelResponse_channel :: (Maybe Channel -> f (Maybe Channel))
-> CreateChannelResponse -> f CreateChannelResponse
createChannelResponse_channel = (CreateChannelResponse -> Maybe Channel)
-> (CreateChannelResponse
    -> Maybe Channel -> CreateChannelResponse)
-> Lens
     CreateChannelResponse
     CreateChannelResponse
     (Maybe Channel)
     (Maybe Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelResponse' {Maybe Channel
channel :: Maybe Channel
$sel:channel:CreateChannelResponse' :: CreateChannelResponse -> Maybe Channel
channel} -> Maybe Channel
channel) (\s :: CreateChannelResponse
s@CreateChannelResponse' {} Maybe Channel
a -> CreateChannelResponse
s {$sel:channel:CreateChannelResponse' :: Maybe Channel
channel = Maybe Channel
a} :: CreateChannelResponse)

-- |
createChannelResponse_streamKey :: Lens.Lens' CreateChannelResponse (Prelude.Maybe StreamKey)
createChannelResponse_streamKey :: (Maybe StreamKey -> f (Maybe StreamKey))
-> CreateChannelResponse -> f CreateChannelResponse
createChannelResponse_streamKey = (CreateChannelResponse -> Maybe StreamKey)
-> (CreateChannelResponse
    -> Maybe StreamKey -> CreateChannelResponse)
-> Lens
     CreateChannelResponse
     CreateChannelResponse
     (Maybe StreamKey)
     (Maybe StreamKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateChannelResponse' {Maybe StreamKey
streamKey :: Maybe StreamKey
$sel:streamKey:CreateChannelResponse' :: CreateChannelResponse -> Maybe StreamKey
streamKey} -> Maybe StreamKey
streamKey) (\s :: CreateChannelResponse
s@CreateChannelResponse' {} Maybe StreamKey
a -> CreateChannelResponse
s {$sel:streamKey:CreateChannelResponse' :: Maybe StreamKey
streamKey = Maybe StreamKey
a} :: CreateChannelResponse)

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

instance Prelude.NFData CreateChannelResponse