{-# 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.MediaLive.UpdateChannel
-- 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)
--
-- Updates a channel.
module Amazonka.MediaLive.UpdateChannel
  ( -- * Creating a Request
    UpdateChannel' (..),
    newUpdateChannel',

    -- * Request Lenses
    updateChannel'_logLevel,
    updateChannel'_inputSpecification,
    updateChannel'_inputAttachments,
    updateChannel'_destinations,
    updateChannel'_name,
    updateChannel'_cdiInputSpecification,
    updateChannel'_encoderSettings,
    updateChannel'_roleArn,
    updateChannel'_channelId,

    -- * Destructuring the Response
    UpdateChannelResponse (..),
    newUpdateChannelResponse,

    -- * Response Lenses
    updateChannelResponse_channel,
    updateChannelResponse_httpStatus,
  )
where

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

-- | A request to update a channel.
--
-- /See:/ 'newUpdateChannel'' smart constructor.
data UpdateChannel' = UpdateChannel''
  { -- | The log level to write to CloudWatch Logs.
    UpdateChannel' -> Maybe LogLevel
logLevel :: Prelude.Maybe LogLevel,
    -- | Specification of network and file inputs for this channel
    UpdateChannel' -> Maybe InputSpecification
inputSpecification :: Prelude.Maybe InputSpecification,
    UpdateChannel' -> Maybe [InputAttachment]
inputAttachments :: Prelude.Maybe [InputAttachment],
    -- | A list of output destinations for this channel.
    UpdateChannel' -> Maybe [OutputDestination]
destinations :: Prelude.Maybe [OutputDestination],
    -- | The name of the channel.
    UpdateChannel' -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Specification of CDI inputs for this channel
    UpdateChannel' -> Maybe CdiInputSpecification
cdiInputSpecification :: Prelude.Maybe CdiInputSpecification,
    -- | The encoder settings for this channel.
    UpdateChannel' -> Maybe EncoderSettings
encoderSettings :: Prelude.Maybe EncoderSettings,
    -- | An optional Amazon Resource Name (ARN) of the role to assume when
    -- running the Channel. If you do not specify this on an update call but
    -- the role was previously set that role will be removed.
    UpdateChannel' -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | channel ID
    UpdateChannel' -> Text
channelId :: Prelude.Text
  }
  deriving (UpdateChannel' -> UpdateChannel' -> Bool
(UpdateChannel' -> UpdateChannel' -> Bool)
-> (UpdateChannel' -> UpdateChannel' -> Bool) -> Eq UpdateChannel'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateChannel' -> UpdateChannel' -> Bool
$c/= :: UpdateChannel' -> UpdateChannel' -> Bool
== :: UpdateChannel' -> UpdateChannel' -> Bool
$c== :: UpdateChannel' -> UpdateChannel' -> Bool
Prelude.Eq, ReadPrec [UpdateChannel']
ReadPrec UpdateChannel'
Int -> ReadS UpdateChannel'
ReadS [UpdateChannel']
(Int -> ReadS UpdateChannel')
-> ReadS [UpdateChannel']
-> ReadPrec UpdateChannel'
-> ReadPrec [UpdateChannel']
-> Read UpdateChannel'
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateChannel']
$creadListPrec :: ReadPrec [UpdateChannel']
readPrec :: ReadPrec UpdateChannel'
$creadPrec :: ReadPrec UpdateChannel'
readList :: ReadS [UpdateChannel']
$creadList :: ReadS [UpdateChannel']
readsPrec :: Int -> ReadS UpdateChannel'
$creadsPrec :: Int -> ReadS UpdateChannel'
Prelude.Read, Int -> UpdateChannel' -> ShowS
[UpdateChannel'] -> ShowS
UpdateChannel' -> String
(Int -> UpdateChannel' -> ShowS)
-> (UpdateChannel' -> String)
-> ([UpdateChannel'] -> ShowS)
-> Show UpdateChannel'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateChannel'] -> ShowS
$cshowList :: [UpdateChannel'] -> ShowS
show :: UpdateChannel' -> String
$cshow :: UpdateChannel' -> String
showsPrec :: Int -> UpdateChannel' -> ShowS
$cshowsPrec :: Int -> UpdateChannel' -> ShowS
Prelude.Show, (forall x. UpdateChannel' -> Rep UpdateChannel' x)
-> (forall x. Rep UpdateChannel' x -> UpdateChannel')
-> Generic UpdateChannel'
forall x. Rep UpdateChannel' x -> UpdateChannel'
forall x. UpdateChannel' -> Rep UpdateChannel' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateChannel' x -> UpdateChannel'
$cfrom :: forall x. UpdateChannel' -> Rep UpdateChannel' x
Prelude.Generic)

-- |
-- Create a value of 'UpdateChannel'' 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:
--
-- 'logLevel', 'updateChannel'_logLevel' - The log level to write to CloudWatch Logs.
--
-- 'inputSpecification', 'updateChannel'_inputSpecification' - Specification of network and file inputs for this channel
--
-- 'inputAttachments', 'updateChannel'_inputAttachments' - Undocumented member.
--
-- 'destinations', 'updateChannel'_destinations' - A list of output destinations for this channel.
--
-- 'name', 'updateChannel'_name' - The name of the channel.
--
-- 'cdiInputSpecification', 'updateChannel'_cdiInputSpecification' - Specification of CDI inputs for this channel
--
-- 'encoderSettings', 'updateChannel'_encoderSettings' - The encoder settings for this channel.
--
-- 'roleArn', 'updateChannel'_roleArn' - An optional Amazon Resource Name (ARN) of the role to assume when
-- running the Channel. If you do not specify this on an update call but
-- the role was previously set that role will be removed.
--
-- 'channelId', 'updateChannel'_channelId' - channel ID
newUpdateChannel' ::
  -- | 'channelId'
  Prelude.Text ->
  UpdateChannel'
newUpdateChannel' :: Text -> UpdateChannel'
newUpdateChannel' Text
pChannelId_ =
  UpdateChannel'' :: Maybe LogLevel
-> Maybe InputSpecification
-> Maybe [InputAttachment]
-> Maybe [OutputDestination]
-> Maybe Text
-> Maybe CdiInputSpecification
-> Maybe EncoderSettings
-> Maybe Text
-> Text
-> UpdateChannel'
UpdateChannel''
    { $sel:logLevel:UpdateChannel'' :: Maybe LogLevel
logLevel = Maybe LogLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:inputSpecification:UpdateChannel'' :: Maybe InputSpecification
inputSpecification = Maybe InputSpecification
forall a. Maybe a
Prelude.Nothing,
      $sel:inputAttachments:UpdateChannel'' :: Maybe [InputAttachment]
inputAttachments = Maybe [InputAttachment]
forall a. Maybe a
Prelude.Nothing,
      $sel:destinations:UpdateChannel'' :: Maybe [OutputDestination]
destinations = Maybe [OutputDestination]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateChannel'' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cdiInputSpecification:UpdateChannel'' :: Maybe CdiInputSpecification
cdiInputSpecification = Maybe CdiInputSpecification
forall a. Maybe a
Prelude.Nothing,
      $sel:encoderSettings:UpdateChannel'' :: Maybe EncoderSettings
encoderSettings = Maybe EncoderSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:UpdateChannel'' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelId:UpdateChannel'' :: Text
channelId = Text
pChannelId_
    }

-- | The log level to write to CloudWatch Logs.
updateChannel'_logLevel :: Lens.Lens' UpdateChannel' (Prelude.Maybe LogLevel)
updateChannel'_logLevel :: (Maybe LogLevel -> f (Maybe LogLevel))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_logLevel = (UpdateChannel' -> Maybe LogLevel)
-> (UpdateChannel' -> Maybe LogLevel -> UpdateChannel')
-> Lens
     UpdateChannel' UpdateChannel' (Maybe LogLevel) (Maybe LogLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe LogLevel
logLevel :: Maybe LogLevel
$sel:logLevel:UpdateChannel'' :: UpdateChannel' -> Maybe LogLevel
logLevel} -> Maybe LogLevel
logLevel) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe LogLevel
a -> UpdateChannel'
s {$sel:logLevel:UpdateChannel'' :: Maybe LogLevel
logLevel = Maybe LogLevel
a} :: UpdateChannel')

-- | Specification of network and file inputs for this channel
updateChannel'_inputSpecification :: Lens.Lens' UpdateChannel' (Prelude.Maybe InputSpecification)
updateChannel'_inputSpecification :: (Maybe InputSpecification -> f (Maybe InputSpecification))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_inputSpecification = (UpdateChannel' -> Maybe InputSpecification)
-> (UpdateChannel' -> Maybe InputSpecification -> UpdateChannel')
-> Lens
     UpdateChannel'
     UpdateChannel'
     (Maybe InputSpecification)
     (Maybe InputSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe InputSpecification
inputSpecification :: Maybe InputSpecification
$sel:inputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe InputSpecification
inputSpecification} -> Maybe InputSpecification
inputSpecification) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe InputSpecification
a -> UpdateChannel'
s {$sel:inputSpecification:UpdateChannel'' :: Maybe InputSpecification
inputSpecification = Maybe InputSpecification
a} :: UpdateChannel')

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

-- | A list of output destinations for this channel.
updateChannel'_destinations :: Lens.Lens' UpdateChannel' (Prelude.Maybe [OutputDestination])
updateChannel'_destinations :: (Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_destinations = (UpdateChannel' -> Maybe [OutputDestination])
-> (UpdateChannel' -> Maybe [OutputDestination] -> UpdateChannel')
-> Lens
     UpdateChannel'
     UpdateChannel'
     (Maybe [OutputDestination])
     (Maybe [OutputDestination])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe [OutputDestination]
destinations :: Maybe [OutputDestination]
$sel:destinations:UpdateChannel'' :: UpdateChannel' -> Maybe [OutputDestination]
destinations} -> Maybe [OutputDestination]
destinations) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe [OutputDestination]
a -> UpdateChannel'
s {$sel:destinations:UpdateChannel'' :: Maybe [OutputDestination]
destinations = Maybe [OutputDestination]
a} :: UpdateChannel') ((Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
 -> UpdateChannel' -> f UpdateChannel')
-> ((Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
    -> Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> (Maybe [OutputDestination] -> f (Maybe [OutputDestination]))
-> UpdateChannel'
-> f UpdateChannel'
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OutputDestination]
  [OutputDestination]
  [OutputDestination]
  [OutputDestination]
-> Iso
     (Maybe [OutputDestination])
     (Maybe [OutputDestination])
     (Maybe [OutputDestination])
     (Maybe [OutputDestination])
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
  [OutputDestination]
  [OutputDestination]
  [OutputDestination]
  [OutputDestination]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the channel.
updateChannel'_name :: Lens.Lens' UpdateChannel' (Prelude.Maybe Prelude.Text)
updateChannel'_name :: (Maybe Text -> f (Maybe Text))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_name = (UpdateChannel' -> Maybe Text)
-> (UpdateChannel' -> Maybe Text -> UpdateChannel')
-> Lens UpdateChannel' UpdateChannel' (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe Text
name :: Maybe Text
$sel:name:UpdateChannel'' :: UpdateChannel' -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe Text
a -> UpdateChannel'
s {$sel:name:UpdateChannel'' :: Maybe Text
name = Maybe Text
a} :: UpdateChannel')

-- | Specification of CDI inputs for this channel
updateChannel'_cdiInputSpecification :: Lens.Lens' UpdateChannel' (Prelude.Maybe CdiInputSpecification)
updateChannel'_cdiInputSpecification :: (Maybe CdiInputSpecification -> f (Maybe CdiInputSpecification))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_cdiInputSpecification = (UpdateChannel' -> Maybe CdiInputSpecification)
-> (UpdateChannel'
    -> Maybe CdiInputSpecification -> UpdateChannel')
-> Lens
     UpdateChannel'
     UpdateChannel'
     (Maybe CdiInputSpecification)
     (Maybe CdiInputSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe CdiInputSpecification
cdiInputSpecification :: Maybe CdiInputSpecification
$sel:cdiInputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe CdiInputSpecification
cdiInputSpecification} -> Maybe CdiInputSpecification
cdiInputSpecification) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe CdiInputSpecification
a -> UpdateChannel'
s {$sel:cdiInputSpecification:UpdateChannel'' :: Maybe CdiInputSpecification
cdiInputSpecification = Maybe CdiInputSpecification
a} :: UpdateChannel')

-- | The encoder settings for this channel.
updateChannel'_encoderSettings :: Lens.Lens' UpdateChannel' (Prelude.Maybe EncoderSettings)
updateChannel'_encoderSettings :: (Maybe EncoderSettings -> f (Maybe EncoderSettings))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_encoderSettings = (UpdateChannel' -> Maybe EncoderSettings)
-> (UpdateChannel' -> Maybe EncoderSettings -> UpdateChannel')
-> Lens
     UpdateChannel'
     UpdateChannel'
     (Maybe EncoderSettings)
     (Maybe EncoderSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe EncoderSettings
encoderSettings :: Maybe EncoderSettings
$sel:encoderSettings:UpdateChannel'' :: UpdateChannel' -> Maybe EncoderSettings
encoderSettings} -> Maybe EncoderSettings
encoderSettings) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe EncoderSettings
a -> UpdateChannel'
s {$sel:encoderSettings:UpdateChannel'' :: Maybe EncoderSettings
encoderSettings = Maybe EncoderSettings
a} :: UpdateChannel')

-- | An optional Amazon Resource Name (ARN) of the role to assume when
-- running the Channel. If you do not specify this on an update call but
-- the role was previously set that role will be removed.
updateChannel'_roleArn :: Lens.Lens' UpdateChannel' (Prelude.Maybe Prelude.Text)
updateChannel'_roleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateChannel' -> f UpdateChannel'
updateChannel'_roleArn = (UpdateChannel' -> Maybe Text)
-> (UpdateChannel' -> Maybe Text -> UpdateChannel')
-> Lens UpdateChannel' UpdateChannel' (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:UpdateChannel'' :: UpdateChannel' -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: UpdateChannel'
s@UpdateChannel'' {} Maybe Text
a -> UpdateChannel'
s {$sel:roleArn:UpdateChannel'' :: Maybe Text
roleArn = Maybe Text
a} :: UpdateChannel')

-- | channel ID
updateChannel'_channelId :: Lens.Lens' UpdateChannel' Prelude.Text
updateChannel'_channelId :: (Text -> f Text) -> UpdateChannel' -> f UpdateChannel'
updateChannel'_channelId = (UpdateChannel' -> Text)
-> (UpdateChannel' -> Text -> UpdateChannel')
-> Lens UpdateChannel' UpdateChannel' Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateChannel'' {Text
channelId :: Text
$sel:channelId:UpdateChannel'' :: UpdateChannel' -> Text
channelId} -> Text
channelId) (\s :: UpdateChannel'
s@UpdateChannel'' {} Text
a -> UpdateChannel'
s {$sel:channelId:UpdateChannel'' :: Text
channelId = Text
a} :: UpdateChannel')

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

instance Prelude.NFData UpdateChannel'

instance Core.ToHeaders UpdateChannel' where
  toHeaders :: UpdateChannel' -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateChannel' -> 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 UpdateChannel' where
  toJSON :: UpdateChannel' -> Value
toJSON UpdateChannel'' {Maybe [OutputDestination]
Maybe [InputAttachment]
Maybe Text
Maybe CdiInputSpecification
Maybe InputSpecification
Maybe LogLevel
Maybe EncoderSettings
Text
channelId :: Text
roleArn :: Maybe Text
encoderSettings :: Maybe EncoderSettings
cdiInputSpecification :: Maybe CdiInputSpecification
name :: Maybe Text
destinations :: Maybe [OutputDestination]
inputAttachments :: Maybe [InputAttachment]
inputSpecification :: Maybe InputSpecification
logLevel :: Maybe LogLevel
$sel:channelId:UpdateChannel'' :: UpdateChannel' -> Text
$sel:roleArn:UpdateChannel'' :: UpdateChannel' -> Maybe Text
$sel:encoderSettings:UpdateChannel'' :: UpdateChannel' -> Maybe EncoderSettings
$sel:cdiInputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe CdiInputSpecification
$sel:name:UpdateChannel'' :: UpdateChannel' -> Maybe Text
$sel:destinations:UpdateChannel'' :: UpdateChannel' -> Maybe [OutputDestination]
$sel:inputAttachments:UpdateChannel'' :: UpdateChannel' -> Maybe [InputAttachment]
$sel:inputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe InputSpecification
$sel:logLevel:UpdateChannel'' :: UpdateChannel' -> Maybe LogLevel
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"logLevel" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LogLevel -> Pair) -> Maybe LogLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LogLevel
logLevel,
            (Text
"inputSpecification" Text -> InputSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputSpecification -> Pair)
-> Maybe InputSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputSpecification
inputSpecification,
            (Text
"inputAttachments" Text -> [InputAttachment] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([InputAttachment] -> Pair)
-> Maybe [InputAttachment] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InputAttachment]
inputAttachments,
            (Text
"destinations" Text -> [OutputDestination] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OutputDestination] -> Pair)
-> Maybe [OutputDestination] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OutputDestination]
destinations,
            (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
"cdiInputSpecification" Text -> CdiInputSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CdiInputSpecification -> Pair)
-> Maybe CdiInputSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CdiInputSpecification
cdiInputSpecification,
            (Text
"encoderSettings" Text -> EncoderSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncoderSettings -> Pair) -> Maybe EncoderSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncoderSettings
encoderSettings,
            (Text
"roleArn" 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
roleArn
          ]
      )

instance Core.ToPath UpdateChannel' where
  toPath :: UpdateChannel' -> ByteString
toPath UpdateChannel'' {Maybe [OutputDestination]
Maybe [InputAttachment]
Maybe Text
Maybe CdiInputSpecification
Maybe InputSpecification
Maybe LogLevel
Maybe EncoderSettings
Text
channelId :: Text
roleArn :: Maybe Text
encoderSettings :: Maybe EncoderSettings
cdiInputSpecification :: Maybe CdiInputSpecification
name :: Maybe Text
destinations :: Maybe [OutputDestination]
inputAttachments :: Maybe [InputAttachment]
inputSpecification :: Maybe InputSpecification
logLevel :: Maybe LogLevel
$sel:channelId:UpdateChannel'' :: UpdateChannel' -> Text
$sel:roleArn:UpdateChannel'' :: UpdateChannel' -> Maybe Text
$sel:encoderSettings:UpdateChannel'' :: UpdateChannel' -> Maybe EncoderSettings
$sel:cdiInputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe CdiInputSpecification
$sel:name:UpdateChannel'' :: UpdateChannel' -> Maybe Text
$sel:destinations:UpdateChannel'' :: UpdateChannel' -> Maybe [OutputDestination]
$sel:inputAttachments:UpdateChannel'' :: UpdateChannel' -> Maybe [InputAttachment]
$sel:inputSpecification:UpdateChannel'' :: UpdateChannel' -> Maybe InputSpecification
$sel:logLevel:UpdateChannel'' :: UpdateChannel' -> Maybe LogLevel
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/prod/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelId]

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

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

-- |
-- Create a value of 'UpdateChannelResponse' 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', 'updateChannelResponse_channel' - Undocumented member.
--
-- 'httpStatus', 'updateChannelResponse_httpStatus' - The response's http status code.
newUpdateChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateChannelResponse
newUpdateChannelResponse :: Int -> UpdateChannelResponse
newUpdateChannelResponse Int
pHttpStatus_ =
  UpdateChannelResponse' :: Maybe Channel -> Int -> UpdateChannelResponse
UpdateChannelResponse'
    { $sel:channel:UpdateChannelResponse' :: Maybe Channel
channel = Maybe Channel
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData UpdateChannelResponse