{-# 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.CreateChannel
(
createChannel
, CreateChannel
, ccRequestId
, ccInputSpecification
, ccInputAttachments
, ccReserved
, ccDestinations
, ccName
, ccEncoderSettings
, ccRoleARN
, createChannelResponse
, CreateChannelResponse
, ccrsChannel
, ccrsResponseStatus
) 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 CreateChannel = CreateChannel'
{ _ccRequestId :: !(Maybe Text)
, _ccInputSpecification :: !(Maybe InputSpecification)
, _ccInputAttachments :: !(Maybe [InputAttachment])
, _ccReserved :: !(Maybe Text)
, _ccDestinations :: !(Maybe [OutputDestination])
, _ccName :: !(Maybe Text)
, _ccEncoderSettings :: !(Maybe EncoderSettings)
, _ccRoleARN :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createChannel
:: CreateChannel
createChannel =
CreateChannel'
{ _ccRequestId = Nothing
, _ccInputSpecification = Nothing
, _ccInputAttachments = Nothing
, _ccReserved = Nothing
, _ccDestinations = Nothing
, _ccName = Nothing
, _ccEncoderSettings = Nothing
, _ccRoleARN = Nothing
}
ccRequestId :: Lens' CreateChannel (Maybe Text)
ccRequestId = lens _ccRequestId (\ s a -> s{_ccRequestId = a})
ccInputSpecification :: Lens' CreateChannel (Maybe InputSpecification)
ccInputSpecification = lens _ccInputSpecification (\ s a -> s{_ccInputSpecification = a})
ccInputAttachments :: Lens' CreateChannel [InputAttachment]
ccInputAttachments = lens _ccInputAttachments (\ s a -> s{_ccInputAttachments = a}) . _Default . _Coerce
ccReserved :: Lens' CreateChannel (Maybe Text)
ccReserved = lens _ccReserved (\ s a -> s{_ccReserved = a})
ccDestinations :: Lens' CreateChannel [OutputDestination]
ccDestinations = lens _ccDestinations (\ s a -> s{_ccDestinations = a}) . _Default . _Coerce
ccName :: Lens' CreateChannel (Maybe Text)
ccName = lens _ccName (\ s a -> s{_ccName = a})
ccEncoderSettings :: Lens' CreateChannel (Maybe EncoderSettings)
ccEncoderSettings = lens _ccEncoderSettings (\ s a -> s{_ccEncoderSettings = a})
ccRoleARN :: Lens' CreateChannel (Maybe Text)
ccRoleARN = lens _ccRoleARN (\ s a -> s{_ccRoleARN = a})
instance AWSRequest CreateChannel where
type Rs CreateChannel = CreateChannelResponse
request = postJSON mediaLive
response
= receiveJSON
(\ s h x ->
CreateChannelResponse' <$>
(x .?> "channel") <*> (pure (fromEnum s)))
instance Hashable CreateChannel where
instance NFData CreateChannel where
instance ToHeaders CreateChannel where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateChannel where
toJSON CreateChannel'{..}
= object
(catMaybes
[("requestId" .=) <$> _ccRequestId,
("inputSpecification" .=) <$> _ccInputSpecification,
("inputAttachments" .=) <$> _ccInputAttachments,
("reserved" .=) <$> _ccReserved,
("destinations" .=) <$> _ccDestinations,
("name" .=) <$> _ccName,
("encoderSettings" .=) <$> _ccEncoderSettings,
("roleArn" .=) <$> _ccRoleARN])
instance ToPath CreateChannel where
toPath = const "/prod/channels"
instance ToQuery CreateChannel where
toQuery = const mempty
data CreateChannelResponse = CreateChannelResponse'
{ _ccrsChannel :: !(Maybe Channel)
, _ccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createChannelResponse
:: Int
-> CreateChannelResponse
createChannelResponse pResponseStatus_ =
CreateChannelResponse'
{_ccrsChannel = Nothing, _ccrsResponseStatus = pResponseStatus_}
ccrsChannel :: Lens' CreateChannelResponse (Maybe Channel)
ccrsChannel = lens _ccrsChannel (\ s a -> s{_ccrsChannel = a})
ccrsResponseStatus :: Lens' CreateChannelResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a})
instance NFData CreateChannelResponse where