{-# 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 #-}
module Amazonka.Glue.CreatePartition
(
CreatePartition (..),
newCreatePartition,
createPartition_catalogId,
createPartition_databaseName,
createPartition_tableName,
createPartition_partitionInput,
CreatePartitionResponse (..),
newCreatePartitionResponse,
createPartitionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePartition = CreatePartition'
{
CreatePartition -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
CreatePartition -> Text
databaseName :: Prelude.Text,
CreatePartition -> Text
tableName :: Prelude.Text,
CreatePartition -> PartitionInput
partitionInput :: PartitionInput
}
deriving (CreatePartition -> CreatePartition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartition -> CreatePartition -> Bool
$c/= :: CreatePartition -> CreatePartition -> Bool
== :: CreatePartition -> CreatePartition -> Bool
$c== :: CreatePartition -> CreatePartition -> Bool
Prelude.Eq, ReadPrec [CreatePartition]
ReadPrec CreatePartition
Int -> ReadS CreatePartition
ReadS [CreatePartition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartition]
$creadListPrec :: ReadPrec [CreatePartition]
readPrec :: ReadPrec CreatePartition
$creadPrec :: ReadPrec CreatePartition
readList :: ReadS [CreatePartition]
$creadList :: ReadS [CreatePartition]
readsPrec :: Int -> ReadS CreatePartition
$creadsPrec :: Int -> ReadS CreatePartition
Prelude.Read, Int -> CreatePartition -> ShowS
[CreatePartition] -> ShowS
CreatePartition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartition] -> ShowS
$cshowList :: [CreatePartition] -> ShowS
show :: CreatePartition -> String
$cshow :: CreatePartition -> String
showsPrec :: Int -> CreatePartition -> ShowS
$cshowsPrec :: Int -> CreatePartition -> ShowS
Prelude.Show, forall x. Rep CreatePartition x -> CreatePartition
forall x. CreatePartition -> Rep CreatePartition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePartition x -> CreatePartition
$cfrom :: forall x. CreatePartition -> Rep CreatePartition x
Prelude.Generic)
newCreatePartition ::
Prelude.Text ->
Prelude.Text ->
PartitionInput ->
CreatePartition
newCreatePartition :: Text -> Text -> PartitionInput -> CreatePartition
newCreatePartition
Text
pDatabaseName_
Text
pTableName_
PartitionInput
pPartitionInput_ =
CreatePartition'
{ $sel:catalogId:CreatePartition' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:CreatePartition' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:CreatePartition' :: Text
tableName = Text
pTableName_,
$sel:partitionInput:CreatePartition' :: PartitionInput
partitionInput = PartitionInput
pPartitionInput_
}
createPartition_catalogId :: Lens.Lens' CreatePartition (Prelude.Maybe Prelude.Text)
createPartition_catalogId :: Lens' CreatePartition (Maybe Text)
createPartition_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartition' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:CreatePartition' :: CreatePartition -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: CreatePartition
s@CreatePartition' {} Maybe Text
a -> CreatePartition
s {$sel:catalogId:CreatePartition' :: Maybe Text
catalogId = Maybe Text
a} :: CreatePartition)
createPartition_databaseName :: Lens.Lens' CreatePartition Prelude.Text
createPartition_databaseName :: Lens' CreatePartition Text
createPartition_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartition' {Text
databaseName :: Text
$sel:databaseName:CreatePartition' :: CreatePartition -> Text
databaseName} -> Text
databaseName) (\s :: CreatePartition
s@CreatePartition' {} Text
a -> CreatePartition
s {$sel:databaseName:CreatePartition' :: Text
databaseName = Text
a} :: CreatePartition)
createPartition_tableName :: Lens.Lens' CreatePartition Prelude.Text
createPartition_tableName :: Lens' CreatePartition Text
createPartition_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartition' {Text
tableName :: Text
$sel:tableName:CreatePartition' :: CreatePartition -> Text
tableName} -> Text
tableName) (\s :: CreatePartition
s@CreatePartition' {} Text
a -> CreatePartition
s {$sel:tableName:CreatePartition' :: Text
tableName = Text
a} :: CreatePartition)
createPartition_partitionInput :: Lens.Lens' CreatePartition PartitionInput
createPartition_partitionInput :: Lens' CreatePartition PartitionInput
createPartition_partitionInput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartition' {PartitionInput
partitionInput :: PartitionInput
$sel:partitionInput:CreatePartition' :: CreatePartition -> PartitionInput
partitionInput} -> PartitionInput
partitionInput) (\s :: CreatePartition
s@CreatePartition' {} PartitionInput
a -> CreatePartition
s {$sel:partitionInput:CreatePartition' :: PartitionInput
partitionInput = PartitionInput
a} :: CreatePartition)
instance Core.AWSRequest CreatePartition where
type
AWSResponse CreatePartition =
CreatePartitionResponse
request :: (Service -> Service) -> CreatePartition -> Request CreatePartition
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePartition
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePartition)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreatePartitionResponse
CreatePartitionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreatePartition where
hashWithSalt :: Int -> CreatePartition -> Int
hashWithSalt Int
_salt CreatePartition' {Maybe Text
Text
PartitionInput
partitionInput :: PartitionInput
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionInput:CreatePartition' :: CreatePartition -> PartitionInput
$sel:tableName:CreatePartition' :: CreatePartition -> Text
$sel:databaseName:CreatePartition' :: CreatePartition -> Text
$sel:catalogId:CreatePartition' :: CreatePartition -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PartitionInput
partitionInput
instance Prelude.NFData CreatePartition where
rnf :: CreatePartition -> ()
rnf CreatePartition' {Maybe Text
Text
PartitionInput
partitionInput :: PartitionInput
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionInput:CreatePartition' :: CreatePartition -> PartitionInput
$sel:tableName:CreatePartition' :: CreatePartition -> Text
$sel:databaseName:CreatePartition' :: CreatePartition -> Text
$sel:catalogId:CreatePartition' :: CreatePartition -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PartitionInput
partitionInput
instance Data.ToHeaders CreatePartition where
toHeaders :: CreatePartition -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AWSGlue.CreatePartition" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreatePartition where
toJSON :: CreatePartition -> Value
toJSON CreatePartition' {Maybe Text
Text
PartitionInput
partitionInput :: PartitionInput
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionInput:CreatePartition' :: CreatePartition -> PartitionInput
$sel:tableName:CreatePartition' :: CreatePartition -> Text
$sel:databaseName:CreatePartition' :: CreatePartition -> Text
$sel:catalogId:CreatePartition' :: CreatePartition -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just
(Key
"PartitionInput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PartitionInput
partitionInput)
]
)
instance Data.ToPath CreatePartition where
toPath :: CreatePartition -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreatePartition where
toQuery :: CreatePartition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreatePartitionResponse = CreatePartitionResponse'
{
CreatePartitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePartitionResponse -> CreatePartitionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartitionResponse -> CreatePartitionResponse -> Bool
$c/= :: CreatePartitionResponse -> CreatePartitionResponse -> Bool
== :: CreatePartitionResponse -> CreatePartitionResponse -> Bool
$c== :: CreatePartitionResponse -> CreatePartitionResponse -> Bool
Prelude.Eq, ReadPrec [CreatePartitionResponse]
ReadPrec CreatePartitionResponse
Int -> ReadS CreatePartitionResponse
ReadS [CreatePartitionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartitionResponse]
$creadListPrec :: ReadPrec [CreatePartitionResponse]
readPrec :: ReadPrec CreatePartitionResponse
$creadPrec :: ReadPrec CreatePartitionResponse
readList :: ReadS [CreatePartitionResponse]
$creadList :: ReadS [CreatePartitionResponse]
readsPrec :: Int -> ReadS CreatePartitionResponse
$creadsPrec :: Int -> ReadS CreatePartitionResponse
Prelude.Read, Int -> CreatePartitionResponse -> ShowS
[CreatePartitionResponse] -> ShowS
CreatePartitionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartitionResponse] -> ShowS
$cshowList :: [CreatePartitionResponse] -> ShowS
show :: CreatePartitionResponse -> String
$cshow :: CreatePartitionResponse -> String
showsPrec :: Int -> CreatePartitionResponse -> ShowS
$cshowsPrec :: Int -> CreatePartitionResponse -> ShowS
Prelude.Show, forall x. Rep CreatePartitionResponse x -> CreatePartitionResponse
forall x. CreatePartitionResponse -> Rep CreatePartitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePartitionResponse x -> CreatePartitionResponse
$cfrom :: forall x. CreatePartitionResponse -> Rep CreatePartitionResponse x
Prelude.Generic)
newCreatePartitionResponse ::
Prelude.Int ->
CreatePartitionResponse
newCreatePartitionResponse :: Int -> CreatePartitionResponse
newCreatePartitionResponse Int
pHttpStatus_ =
CreatePartitionResponse' {$sel:httpStatus:CreatePartitionResponse' :: Int
httpStatus = Int
pHttpStatus_}
createPartitionResponse_httpStatus :: Lens.Lens' CreatePartitionResponse Prelude.Int
createPartitionResponse_httpStatus :: Lens' CreatePartitionResponse Int
createPartitionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePartitionResponse' :: CreatePartitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePartitionResponse
s@CreatePartitionResponse' {} Int
a -> CreatePartitionResponse
s {$sel:httpStatus:CreatePartitionResponse' :: Int
httpStatus = Int
a} :: CreatePartitionResponse)
instance Prelude.NFData CreatePartitionResponse where
rnf :: CreatePartitionResponse -> ()
rnf CreatePartitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePartitionResponse' :: CreatePartitionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus