{-# 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.Glue.CreatePartition
(
createPartition
, CreatePartition
, cpCatalogId
, cpDatabaseName
, cpTableName
, cpPartitionInput
, createPartitionResponse
, CreatePartitionResponse
, cprsResponseStatus
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreatePartition = CreatePartition'
{ _cpCatalogId :: !(Maybe Text)
, _cpDatabaseName :: !Text
, _cpTableName :: !Text
, _cpPartitionInput :: !PartitionInput
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPartition
:: Text
-> Text
-> PartitionInput
-> CreatePartition
createPartition pDatabaseName_ pTableName_ pPartitionInput_ =
CreatePartition'
{ _cpCatalogId = Nothing
, _cpDatabaseName = pDatabaseName_
, _cpTableName = pTableName_
, _cpPartitionInput = pPartitionInput_
}
cpCatalogId :: Lens' CreatePartition (Maybe Text)
cpCatalogId = lens _cpCatalogId (\ s a -> s{_cpCatalogId = a})
cpDatabaseName :: Lens' CreatePartition Text
cpDatabaseName = lens _cpDatabaseName (\ s a -> s{_cpDatabaseName = a})
cpTableName :: Lens' CreatePartition Text
cpTableName = lens _cpTableName (\ s a -> s{_cpTableName = a})
cpPartitionInput :: Lens' CreatePartition PartitionInput
cpPartitionInput = lens _cpPartitionInput (\ s a -> s{_cpPartitionInput = a})
instance AWSRequest CreatePartition where
type Rs CreatePartition = CreatePartitionResponse
request = postJSON glue
response
= receiveEmpty
(\ s h x ->
CreatePartitionResponse' <$> (pure (fromEnum s)))
instance Hashable CreatePartition where
instance NFData CreatePartition where
instance ToHeaders CreatePartition where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.CreatePartition" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreatePartition where
toJSON CreatePartition'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _cpCatalogId,
Just ("DatabaseName" .= _cpDatabaseName),
Just ("TableName" .= _cpTableName),
Just ("PartitionInput" .= _cpPartitionInput)])
instance ToPath CreatePartition where
toPath = const "/"
instance ToQuery CreatePartition where
toQuery = const mempty
newtype CreatePartitionResponse = CreatePartitionResponse'
{ _cprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createPartitionResponse
:: Int
-> CreatePartitionResponse
createPartitionResponse pResponseStatus_ =
CreatePartitionResponse' {_cprsResponseStatus = pResponseStatus_}
cprsResponseStatus :: Lens' CreatePartitionResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a})
instance NFData CreatePartitionResponse where