{-# 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.Athena.CreateDataCatalog
(
CreateDataCatalog (..),
newCreateDataCatalog,
createDataCatalog_parameters,
createDataCatalog_description,
createDataCatalog_tags,
createDataCatalog_name,
createDataCatalog_type,
CreateDataCatalogResponse (..),
newCreateDataCatalogResponse,
createDataCatalogResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
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 CreateDataCatalog = CreateDataCatalog'
{
CreateDataCatalog -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateDataCatalog -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateDataCatalog -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDataCatalog -> Text
name :: Prelude.Text,
CreateDataCatalog -> DataCatalogType
type' :: DataCatalogType
}
deriving (CreateDataCatalog -> CreateDataCatalog -> Bool
(CreateDataCatalog -> CreateDataCatalog -> Bool)
-> (CreateDataCatalog -> CreateDataCatalog -> Bool)
-> Eq CreateDataCatalog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataCatalog -> CreateDataCatalog -> Bool
$c/= :: CreateDataCatalog -> CreateDataCatalog -> Bool
== :: CreateDataCatalog -> CreateDataCatalog -> Bool
$c== :: CreateDataCatalog -> CreateDataCatalog -> Bool
Prelude.Eq, ReadPrec [CreateDataCatalog]
ReadPrec CreateDataCatalog
Int -> ReadS CreateDataCatalog
ReadS [CreateDataCatalog]
(Int -> ReadS CreateDataCatalog)
-> ReadS [CreateDataCatalog]
-> ReadPrec CreateDataCatalog
-> ReadPrec [CreateDataCatalog]
-> Read CreateDataCatalog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataCatalog]
$creadListPrec :: ReadPrec [CreateDataCatalog]
readPrec :: ReadPrec CreateDataCatalog
$creadPrec :: ReadPrec CreateDataCatalog
readList :: ReadS [CreateDataCatalog]
$creadList :: ReadS [CreateDataCatalog]
readsPrec :: Int -> ReadS CreateDataCatalog
$creadsPrec :: Int -> ReadS CreateDataCatalog
Prelude.Read, Int -> CreateDataCatalog -> ShowS
[CreateDataCatalog] -> ShowS
CreateDataCatalog -> String
(Int -> CreateDataCatalog -> ShowS)
-> (CreateDataCatalog -> String)
-> ([CreateDataCatalog] -> ShowS)
-> Show CreateDataCatalog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataCatalog] -> ShowS
$cshowList :: [CreateDataCatalog] -> ShowS
show :: CreateDataCatalog -> String
$cshow :: CreateDataCatalog -> String
showsPrec :: Int -> CreateDataCatalog -> ShowS
$cshowsPrec :: Int -> CreateDataCatalog -> ShowS
Prelude.Show, (forall x. CreateDataCatalog -> Rep CreateDataCatalog x)
-> (forall x. Rep CreateDataCatalog x -> CreateDataCatalog)
-> Generic CreateDataCatalog
forall x. Rep CreateDataCatalog x -> CreateDataCatalog
forall x. CreateDataCatalog -> Rep CreateDataCatalog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataCatalog x -> CreateDataCatalog
$cfrom :: forall x. CreateDataCatalog -> Rep CreateDataCatalog x
Prelude.Generic)
newCreateDataCatalog ::
Prelude.Text ->
DataCatalogType ->
CreateDataCatalog
newCreateDataCatalog :: Text -> DataCatalogType -> CreateDataCatalog
newCreateDataCatalog Text
pName_ DataCatalogType
pType_ =
CreateDataCatalog' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe [Tag]
-> Text
-> DataCatalogType
-> CreateDataCatalog
CreateDataCatalog'
{ $sel:parameters:CreateDataCatalog' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateDataCatalog' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDataCatalog' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDataCatalog' :: Text
name = Text
pName_,
$sel:type':CreateDataCatalog' :: DataCatalogType
type' = DataCatalogType
pType_
}
createDataCatalog_parameters :: Lens.Lens' CreateDataCatalog (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDataCatalog_parameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_parameters = (CreateDataCatalog -> Maybe (HashMap Text Text))
-> (CreateDataCatalog
-> Maybe (HashMap Text Text) -> CreateDataCatalog)
-> Lens
CreateDataCatalog
CreateDataCatalog
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text Text)
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
parameters} -> Maybe (HashMap Text Text)
parameters) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe (HashMap Text Text)
a -> CreateDataCatalog
s {$sel:parameters:CreateDataCatalog' :: Maybe (HashMap Text Text)
parameters = Maybe (HashMap Text Text)
a} :: CreateDataCatalog) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataCatalog -> f CreateDataCatalog)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDataCatalog
-> f CreateDataCatalog
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createDataCatalog_description :: Lens.Lens' CreateDataCatalog (Prelude.Maybe Prelude.Text)
createDataCatalog_description :: (Maybe Text -> f (Maybe Text))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_description = (CreateDataCatalog -> Maybe Text)
-> (CreateDataCatalog -> Maybe Text -> CreateDataCatalog)
-> Lens
CreateDataCatalog CreateDataCatalog (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Maybe Text
description :: Maybe Text
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe Text
a -> CreateDataCatalog
s {$sel:description:CreateDataCatalog' :: Maybe Text
description = Maybe Text
a} :: CreateDataCatalog)
createDataCatalog_tags :: Lens.Lens' CreateDataCatalog (Prelude.Maybe [Tag])
createDataCatalog_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_tags = (CreateDataCatalog -> Maybe [Tag])
-> (CreateDataCatalog -> Maybe [Tag] -> CreateDataCatalog)
-> Lens
CreateDataCatalog CreateDataCatalog (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Maybe [Tag]
a -> CreateDataCatalog
s {$sel:tags:CreateDataCatalog' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDataCatalog) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDataCatalog -> f CreateDataCatalog)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDataCatalog
-> f CreateDataCatalog
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createDataCatalog_name :: Lens.Lens' CreateDataCatalog Prelude.Text
createDataCatalog_name :: (Text -> f Text) -> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_name = (CreateDataCatalog -> Text)
-> (CreateDataCatalog -> Text -> CreateDataCatalog)
-> Lens CreateDataCatalog CreateDataCatalog Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {Text
name :: Text
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
name} -> Text
name) (\s :: CreateDataCatalog
s@CreateDataCatalog' {} Text
a -> CreateDataCatalog
s {$sel:name:CreateDataCatalog' :: Text
name = Text
a} :: CreateDataCatalog)
createDataCatalog_type :: Lens.Lens' CreateDataCatalog DataCatalogType
createDataCatalog_type :: (DataCatalogType -> f DataCatalogType)
-> CreateDataCatalog -> f CreateDataCatalog
createDataCatalog_type = (CreateDataCatalog -> DataCatalogType)
-> (CreateDataCatalog -> DataCatalogType -> CreateDataCatalog)
-> Lens
CreateDataCatalog CreateDataCatalog DataCatalogType DataCatalogType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalog' {DataCatalogType
type' :: DataCatalogType
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
type'} -> DataCatalogType
type') (\s :: CreateDataCatalog
s@CreateDataCatalog' {} DataCatalogType
a -> CreateDataCatalog
s {$sel:type':CreateDataCatalog' :: DataCatalogType
type' = DataCatalogType
a} :: CreateDataCatalog)
instance Core.AWSRequest CreateDataCatalog where
type
AWSResponse CreateDataCatalog =
CreateDataCatalogResponse
request :: CreateDataCatalog -> Request CreateDataCatalog
request = Service -> CreateDataCatalog -> Request CreateDataCatalog
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDataCatalog
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDataCatalog)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateDataCatalog))
-> Logger
-> Service
-> Proxy CreateDataCatalog
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDataCatalog)))
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 -> CreateDataCatalogResponse
CreateDataCatalogResponse'
(Int -> CreateDataCatalogResponse)
-> Either String Int -> Either String CreateDataCatalogResponse
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 CreateDataCatalog
instance Prelude.NFData CreateDataCatalog
instance Core.ToHeaders CreateDataCatalog where
toHeaders :: CreateDataCatalog -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDataCatalog -> 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
"AmazonAthena.CreateDataCatalog" ::
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 CreateDataCatalog where
toJSON :: CreateDataCatalog -> Value
toJSON CreateDataCatalog' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
DataCatalogType
type' :: DataCatalogType
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
parameters :: Maybe (HashMap Text Text)
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Parameters" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
parameters,
(Text
"Description" 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
description,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> DataCatalogType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DataCatalogType
type')
]
)
instance Core.ToPath CreateDataCatalog where
toPath :: CreateDataCatalog -> ByteString
toPath = ByteString -> CreateDataCatalog -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDataCatalog where
toQuery :: CreateDataCatalog -> QueryString
toQuery = QueryString -> CreateDataCatalog -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDataCatalogResponse = CreateDataCatalogResponse'
{
CreateDataCatalogResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
(CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool)
-> (CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool)
-> Eq CreateDataCatalogResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
$c/= :: CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
== :: CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
$c== :: CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
Prelude.Eq, ReadPrec [CreateDataCatalogResponse]
ReadPrec CreateDataCatalogResponse
Int -> ReadS CreateDataCatalogResponse
ReadS [CreateDataCatalogResponse]
(Int -> ReadS CreateDataCatalogResponse)
-> ReadS [CreateDataCatalogResponse]
-> ReadPrec CreateDataCatalogResponse
-> ReadPrec [CreateDataCatalogResponse]
-> Read CreateDataCatalogResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataCatalogResponse]
$creadListPrec :: ReadPrec [CreateDataCatalogResponse]
readPrec :: ReadPrec CreateDataCatalogResponse
$creadPrec :: ReadPrec CreateDataCatalogResponse
readList :: ReadS [CreateDataCatalogResponse]
$creadList :: ReadS [CreateDataCatalogResponse]
readsPrec :: Int -> ReadS CreateDataCatalogResponse
$creadsPrec :: Int -> ReadS CreateDataCatalogResponse
Prelude.Read, Int -> CreateDataCatalogResponse -> ShowS
[CreateDataCatalogResponse] -> ShowS
CreateDataCatalogResponse -> String
(Int -> CreateDataCatalogResponse -> ShowS)
-> (CreateDataCatalogResponse -> String)
-> ([CreateDataCatalogResponse] -> ShowS)
-> Show CreateDataCatalogResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataCatalogResponse] -> ShowS
$cshowList :: [CreateDataCatalogResponse] -> ShowS
show :: CreateDataCatalogResponse -> String
$cshow :: CreateDataCatalogResponse -> String
showsPrec :: Int -> CreateDataCatalogResponse -> ShowS
$cshowsPrec :: Int -> CreateDataCatalogResponse -> ShowS
Prelude.Show, (forall x.
CreateDataCatalogResponse -> Rep CreateDataCatalogResponse x)
-> (forall x.
Rep CreateDataCatalogResponse x -> CreateDataCatalogResponse)
-> Generic CreateDataCatalogResponse
forall x.
Rep CreateDataCatalogResponse x -> CreateDataCatalogResponse
forall x.
CreateDataCatalogResponse -> Rep CreateDataCatalogResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDataCatalogResponse x -> CreateDataCatalogResponse
$cfrom :: forall x.
CreateDataCatalogResponse -> Rep CreateDataCatalogResponse x
Prelude.Generic)
newCreateDataCatalogResponse ::
Prelude.Int ->
CreateDataCatalogResponse
newCreateDataCatalogResponse :: Int -> CreateDataCatalogResponse
newCreateDataCatalogResponse Int
pHttpStatus_ =
CreateDataCatalogResponse' :: Int -> CreateDataCatalogResponse
CreateDataCatalogResponse'
{ $sel:httpStatus:CreateDataCatalogResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createDataCatalogResponse_httpStatus :: Lens.Lens' CreateDataCatalogResponse Prelude.Int
createDataCatalogResponse_httpStatus :: (Int -> f Int)
-> CreateDataCatalogResponse -> f CreateDataCatalogResponse
createDataCatalogResponse_httpStatus = (CreateDataCatalogResponse -> Int)
-> (CreateDataCatalogResponse -> Int -> CreateDataCatalogResponse)
-> Lens CreateDataCatalogResponse CreateDataCatalogResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataCatalogResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDataCatalogResponse' :: CreateDataCatalogResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDataCatalogResponse
s@CreateDataCatalogResponse' {} Int
a -> CreateDataCatalogResponse
s {$sel:httpStatus:CreateDataCatalogResponse' :: Int
httpStatus = Int
a} :: CreateDataCatalogResponse)
instance Prelude.NFData CreateDataCatalogResponse