{-# 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.CreatePartitionIndex
(
CreatePartitionIndex (..),
newCreatePartitionIndex,
createPartitionIndex_catalogId,
createPartitionIndex_databaseName,
createPartitionIndex_tableName,
createPartitionIndex_partitionIndex,
CreatePartitionIndexResponse (..),
newCreatePartitionIndexResponse,
createPartitionIndexResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePartitionIndex = CreatePartitionIndex'
{
CreatePartitionIndex -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
CreatePartitionIndex -> Text
databaseName :: Prelude.Text,
CreatePartitionIndex -> Text
tableName :: Prelude.Text,
CreatePartitionIndex -> PartitionIndex
partitionIndex :: PartitionIndex
}
deriving (CreatePartitionIndex -> CreatePartitionIndex -> Bool
(CreatePartitionIndex -> CreatePartitionIndex -> Bool)
-> (CreatePartitionIndex -> CreatePartitionIndex -> Bool)
-> Eq CreatePartitionIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartitionIndex -> CreatePartitionIndex -> Bool
$c/= :: CreatePartitionIndex -> CreatePartitionIndex -> Bool
== :: CreatePartitionIndex -> CreatePartitionIndex -> Bool
$c== :: CreatePartitionIndex -> CreatePartitionIndex -> Bool
Prelude.Eq, ReadPrec [CreatePartitionIndex]
ReadPrec CreatePartitionIndex
Int -> ReadS CreatePartitionIndex
ReadS [CreatePartitionIndex]
(Int -> ReadS CreatePartitionIndex)
-> ReadS [CreatePartitionIndex]
-> ReadPrec CreatePartitionIndex
-> ReadPrec [CreatePartitionIndex]
-> Read CreatePartitionIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartitionIndex]
$creadListPrec :: ReadPrec [CreatePartitionIndex]
readPrec :: ReadPrec CreatePartitionIndex
$creadPrec :: ReadPrec CreatePartitionIndex
readList :: ReadS [CreatePartitionIndex]
$creadList :: ReadS [CreatePartitionIndex]
readsPrec :: Int -> ReadS CreatePartitionIndex
$creadsPrec :: Int -> ReadS CreatePartitionIndex
Prelude.Read, Int -> CreatePartitionIndex -> ShowS
[CreatePartitionIndex] -> ShowS
CreatePartitionIndex -> String
(Int -> CreatePartitionIndex -> ShowS)
-> (CreatePartitionIndex -> String)
-> ([CreatePartitionIndex] -> ShowS)
-> Show CreatePartitionIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartitionIndex] -> ShowS
$cshowList :: [CreatePartitionIndex] -> ShowS
show :: CreatePartitionIndex -> String
$cshow :: CreatePartitionIndex -> String
showsPrec :: Int -> CreatePartitionIndex -> ShowS
$cshowsPrec :: Int -> CreatePartitionIndex -> ShowS
Prelude.Show, (forall x. CreatePartitionIndex -> Rep CreatePartitionIndex x)
-> (forall x. Rep CreatePartitionIndex x -> CreatePartitionIndex)
-> Generic CreatePartitionIndex
forall x. Rep CreatePartitionIndex x -> CreatePartitionIndex
forall x. CreatePartitionIndex -> Rep CreatePartitionIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePartitionIndex x -> CreatePartitionIndex
$cfrom :: forall x. CreatePartitionIndex -> Rep CreatePartitionIndex x
Prelude.Generic)
newCreatePartitionIndex ::
Prelude.Text ->
Prelude.Text ->
PartitionIndex ->
CreatePartitionIndex
newCreatePartitionIndex :: Text -> Text -> PartitionIndex -> CreatePartitionIndex
newCreatePartitionIndex
Text
pDatabaseName_
Text
pTableName_
PartitionIndex
pPartitionIndex_ =
CreatePartitionIndex' :: Maybe Text
-> Text -> Text -> PartitionIndex -> CreatePartitionIndex
CreatePartitionIndex'
{ $sel:catalogId:CreatePartitionIndex' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:CreatePartitionIndex' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:CreatePartitionIndex' :: Text
tableName = Text
pTableName_,
$sel:partitionIndex:CreatePartitionIndex' :: PartitionIndex
partitionIndex = PartitionIndex
pPartitionIndex_
}
createPartitionIndex_catalogId :: Lens.Lens' CreatePartitionIndex (Prelude.Maybe Prelude.Text)
createPartitionIndex_catalogId :: (Maybe Text -> f (Maybe Text))
-> CreatePartitionIndex -> f CreatePartitionIndex
createPartitionIndex_catalogId = (CreatePartitionIndex -> Maybe Text)
-> (CreatePartitionIndex -> Maybe Text -> CreatePartitionIndex)
-> Lens
CreatePartitionIndex CreatePartitionIndex (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionIndex' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:CreatePartitionIndex' :: CreatePartitionIndex -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: CreatePartitionIndex
s@CreatePartitionIndex' {} Maybe Text
a -> CreatePartitionIndex
s {$sel:catalogId:CreatePartitionIndex' :: Maybe Text
catalogId = Maybe Text
a} :: CreatePartitionIndex)
createPartitionIndex_databaseName :: Lens.Lens' CreatePartitionIndex Prelude.Text
createPartitionIndex_databaseName :: (Text -> f Text) -> CreatePartitionIndex -> f CreatePartitionIndex
createPartitionIndex_databaseName = (CreatePartitionIndex -> Text)
-> (CreatePartitionIndex -> Text -> CreatePartitionIndex)
-> Lens CreatePartitionIndex CreatePartitionIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionIndex' {Text
databaseName :: Text
$sel:databaseName:CreatePartitionIndex' :: CreatePartitionIndex -> Text
databaseName} -> Text
databaseName) (\s :: CreatePartitionIndex
s@CreatePartitionIndex' {} Text
a -> CreatePartitionIndex
s {$sel:databaseName:CreatePartitionIndex' :: Text
databaseName = Text
a} :: CreatePartitionIndex)
createPartitionIndex_tableName :: Lens.Lens' CreatePartitionIndex Prelude.Text
createPartitionIndex_tableName :: (Text -> f Text) -> CreatePartitionIndex -> f CreatePartitionIndex
createPartitionIndex_tableName = (CreatePartitionIndex -> Text)
-> (CreatePartitionIndex -> Text -> CreatePartitionIndex)
-> Lens CreatePartitionIndex CreatePartitionIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionIndex' {Text
tableName :: Text
$sel:tableName:CreatePartitionIndex' :: CreatePartitionIndex -> Text
tableName} -> Text
tableName) (\s :: CreatePartitionIndex
s@CreatePartitionIndex' {} Text
a -> CreatePartitionIndex
s {$sel:tableName:CreatePartitionIndex' :: Text
tableName = Text
a} :: CreatePartitionIndex)
createPartitionIndex_partitionIndex :: Lens.Lens' CreatePartitionIndex PartitionIndex
createPartitionIndex_partitionIndex :: (PartitionIndex -> f PartitionIndex)
-> CreatePartitionIndex -> f CreatePartitionIndex
createPartitionIndex_partitionIndex = (CreatePartitionIndex -> PartitionIndex)
-> (CreatePartitionIndex -> PartitionIndex -> CreatePartitionIndex)
-> Lens
CreatePartitionIndex
CreatePartitionIndex
PartitionIndex
PartitionIndex
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionIndex' {PartitionIndex
partitionIndex :: PartitionIndex
$sel:partitionIndex:CreatePartitionIndex' :: CreatePartitionIndex -> PartitionIndex
partitionIndex} -> PartitionIndex
partitionIndex) (\s :: CreatePartitionIndex
s@CreatePartitionIndex' {} PartitionIndex
a -> CreatePartitionIndex
s {$sel:partitionIndex:CreatePartitionIndex' :: PartitionIndex
partitionIndex = PartitionIndex
a} :: CreatePartitionIndex)
instance Core.AWSRequest CreatePartitionIndex where
type
AWSResponse CreatePartitionIndex =
CreatePartitionIndexResponse
request :: CreatePartitionIndex -> Request CreatePartitionIndex
request = Service -> CreatePartitionIndex -> Request CreatePartitionIndex
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePartitionIndex
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePartitionIndex)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreatePartitionIndex))
-> Logger
-> Service
-> Proxy CreatePartitionIndex
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePartitionIndex)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreatePartitionIndexResponse
CreatePartitionIndexResponse'
(Int -> CreatePartitionIndexResponse)
-> Either String Int -> Either String CreatePartitionIndexResponse
forall (f :: * -> *) a b. Functor 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 CreatePartitionIndex
instance Prelude.NFData CreatePartitionIndex
instance Core.ToHeaders CreatePartitionIndex where
toHeaders :: CreatePartitionIndex -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePartitionIndex -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSGlue.CreatePartitionIndex" ::
Prelude.ByteString
),
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 CreatePartitionIndex where
toJSON :: CreatePartitionIndex -> Value
toJSON CreatePartitionIndex' {Maybe Text
Text
PartitionIndex
partitionIndex :: PartitionIndex
tableName :: Text
databaseName :: Text
catalogId :: Maybe Text
$sel:partitionIndex:CreatePartitionIndex' :: CreatePartitionIndex -> PartitionIndex
$sel:tableName:CreatePartitionIndex' :: CreatePartitionIndex -> Text
$sel:databaseName:CreatePartitionIndex' :: CreatePartitionIndex -> Text
$sel:catalogId:CreatePartitionIndex' :: CreatePartitionIndex -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CatalogId" 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
catalogId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PartitionIndex" Text -> PartitionIndex -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PartitionIndex
partitionIndex)
]
)
instance Core.ToPath CreatePartitionIndex where
toPath :: CreatePartitionIndex -> ByteString
toPath = ByteString -> CreatePartitionIndex -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePartitionIndex where
toQuery :: CreatePartitionIndex -> QueryString
toQuery = QueryString -> CreatePartitionIndex -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePartitionIndexResponse = CreatePartitionIndexResponse'
{
CreatePartitionIndexResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool
(CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool)
-> (CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool)
-> Eq CreatePartitionIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool
$c/= :: CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool
== :: CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool
$c== :: CreatePartitionIndexResponse
-> CreatePartitionIndexResponse -> Bool
Prelude.Eq, ReadPrec [CreatePartitionIndexResponse]
ReadPrec CreatePartitionIndexResponse
Int -> ReadS CreatePartitionIndexResponse
ReadS [CreatePartitionIndexResponse]
(Int -> ReadS CreatePartitionIndexResponse)
-> ReadS [CreatePartitionIndexResponse]
-> ReadPrec CreatePartitionIndexResponse
-> ReadPrec [CreatePartitionIndexResponse]
-> Read CreatePartitionIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePartitionIndexResponse]
$creadListPrec :: ReadPrec [CreatePartitionIndexResponse]
readPrec :: ReadPrec CreatePartitionIndexResponse
$creadPrec :: ReadPrec CreatePartitionIndexResponse
readList :: ReadS [CreatePartitionIndexResponse]
$creadList :: ReadS [CreatePartitionIndexResponse]
readsPrec :: Int -> ReadS CreatePartitionIndexResponse
$creadsPrec :: Int -> ReadS CreatePartitionIndexResponse
Prelude.Read, Int -> CreatePartitionIndexResponse -> ShowS
[CreatePartitionIndexResponse] -> ShowS
CreatePartitionIndexResponse -> String
(Int -> CreatePartitionIndexResponse -> ShowS)
-> (CreatePartitionIndexResponse -> String)
-> ([CreatePartitionIndexResponse] -> ShowS)
-> Show CreatePartitionIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePartitionIndexResponse] -> ShowS
$cshowList :: [CreatePartitionIndexResponse] -> ShowS
show :: CreatePartitionIndexResponse -> String
$cshow :: CreatePartitionIndexResponse -> String
showsPrec :: Int -> CreatePartitionIndexResponse -> ShowS
$cshowsPrec :: Int -> CreatePartitionIndexResponse -> ShowS
Prelude.Show, (forall x.
CreatePartitionIndexResponse -> Rep CreatePartitionIndexResponse x)
-> (forall x.
Rep CreatePartitionIndexResponse x -> CreatePartitionIndexResponse)
-> Generic CreatePartitionIndexResponse
forall x.
Rep CreatePartitionIndexResponse x -> CreatePartitionIndexResponse
forall x.
CreatePartitionIndexResponse -> Rep CreatePartitionIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePartitionIndexResponse x -> CreatePartitionIndexResponse
$cfrom :: forall x.
CreatePartitionIndexResponse -> Rep CreatePartitionIndexResponse x
Prelude.Generic)
newCreatePartitionIndexResponse ::
Prelude.Int ->
CreatePartitionIndexResponse
newCreatePartitionIndexResponse :: Int -> CreatePartitionIndexResponse
newCreatePartitionIndexResponse Int
pHttpStatus_ =
CreatePartitionIndexResponse' :: Int -> CreatePartitionIndexResponse
CreatePartitionIndexResponse'
{ $sel:httpStatus:CreatePartitionIndexResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createPartitionIndexResponse_httpStatus :: Lens.Lens' CreatePartitionIndexResponse Prelude.Int
createPartitionIndexResponse_httpStatus :: (Int -> f Int)
-> CreatePartitionIndexResponse -> f CreatePartitionIndexResponse
createPartitionIndexResponse_httpStatus = (CreatePartitionIndexResponse -> Int)
-> (CreatePartitionIndexResponse
-> Int -> CreatePartitionIndexResponse)
-> Lens
CreatePartitionIndexResponse CreatePartitionIndexResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePartitionIndexResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePartitionIndexResponse' :: CreatePartitionIndexResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePartitionIndexResponse
s@CreatePartitionIndexResponse' {} Int
a -> CreatePartitionIndexResponse
s {$sel:httpStatus:CreatePartitionIndexResponse' :: Int
httpStatus = Int
a} :: CreatePartitionIndexResponse)
instance Prelude.NFData CreatePartitionIndexResponse