{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.MediaLive.UpdateChannel
(
updateChannel
, UpdateChannel
, ucInputSpecification
, ucInputAttachments
, ucDestinations
, ucName
, ucEncoderSettings
, ucRoleARN
, ucChannelId
, updateChannelResponse
, UpdateChannelResponse
, ucrsChannel
, ucrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MediaLive.Types
import Network.AWS.MediaLive.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateChannel = UpdateChannel'
{ _ucInputSpecification :: !(Maybe InputSpecification)
, _ucInputAttachments :: !(Maybe [InputAttachment])
, _ucDestinations :: !(Maybe [OutputDestination])
, _ucName :: !(Maybe Text)
, _ucEncoderSettings :: !(Maybe EncoderSettings)
, _ucRoleARN :: !(Maybe Text)
, _ucChannelId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateChannel
:: Text
-> UpdateChannel
updateChannel pChannelId_ =
UpdateChannel'
{ _ucInputSpecification = Nothing
, _ucInputAttachments = Nothing
, _ucDestinations = Nothing
, _ucName = Nothing
, _ucEncoderSettings = Nothing
, _ucRoleARN = Nothing
, _ucChannelId = pChannelId_
}
ucInputSpecification :: Lens' UpdateChannel (Maybe InputSpecification)
ucInputSpecification = lens _ucInputSpecification (\ s a -> s{_ucInputSpecification = a})
ucInputAttachments :: Lens' UpdateChannel [InputAttachment]
ucInputAttachments = lens _ucInputAttachments (\ s a -> s{_ucInputAttachments = a}) . _Default . _Coerce
ucDestinations :: Lens' UpdateChannel [OutputDestination]
ucDestinations = lens _ucDestinations (\ s a -> s{_ucDestinations = a}) . _Default . _Coerce
ucName :: Lens' UpdateChannel (Maybe Text)
ucName = lens _ucName (\ s a -> s{_ucName = a})
ucEncoderSettings :: Lens' UpdateChannel (Maybe EncoderSettings)
ucEncoderSettings = lens _ucEncoderSettings (\ s a -> s{_ucEncoderSettings = a})
ucRoleARN :: Lens' UpdateChannel (Maybe Text)
ucRoleARN = lens _ucRoleARN (\ s a -> s{_ucRoleARN = a})
ucChannelId :: Lens' UpdateChannel Text
ucChannelId = lens _ucChannelId (\ s a -> s{_ucChannelId = a})
instance AWSRequest UpdateChannel where
type Rs UpdateChannel = UpdateChannelResponse
request = putJSON mediaLive
response
= receiveJSON
(\ s h x ->
UpdateChannelResponse' <$>
(x .?> "channel") <*> (pure (fromEnum s)))
instance Hashable UpdateChannel where
instance NFData UpdateChannel where
instance ToHeaders UpdateChannel where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateChannel where
toJSON UpdateChannel'{..}
= object
(catMaybes
[("inputSpecification" .=) <$> _ucInputSpecification,
("inputAttachments" .=) <$> _ucInputAttachments,
("destinations" .=) <$> _ucDestinations,
("name" .=) <$> _ucName,
("encoderSettings" .=) <$> _ucEncoderSettings,
("roleArn" .=) <$> _ucRoleARN])
instance ToPath UpdateChannel where
toPath UpdateChannel'{..}
= mconcat ["/prod/channels/", toBS _ucChannelId]
instance ToQuery UpdateChannel where
toQuery = const mempty
data UpdateChannelResponse = UpdateChannelResponse'
{ _ucrsChannel :: !(Maybe Channel)
, _ucrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateChannelResponse
:: Int
-> UpdateChannelResponse
updateChannelResponse pResponseStatus_ =
UpdateChannelResponse'
{_ucrsChannel = Nothing, _ucrsResponseStatus = pResponseStatus_}
ucrsChannel :: Lens' UpdateChannelResponse (Maybe Channel)
ucrsChannel = lens _ucrsChannel (\ s a -> s{_ucrsChannel = a})
ucrsResponseStatus :: Lens' UpdateChannelResponse Int
ucrsResponseStatus = lens _ucrsResponseStatus (\ s a -> s{_ucrsResponseStatus = a})
instance NFData UpdateChannelResponse where