{-# 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_description,
createDataCatalog_parameters,
createDataCatalog_tags,
createDataCatalog_name,
createDataCatalog_type,
CreateDataCatalogResponse (..),
newCreateDataCatalogResponse,
createDataCatalogResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDataCatalog = CreateDataCatalog'
{
CreateDataCatalog -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateDataCatalog -> Maybe (HashMap Text Text)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateDataCatalog -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDataCatalog -> Text
name :: Prelude.Text,
CreateDataCatalog -> DataCatalogType
type' :: DataCatalogType
}
deriving (CreateDataCatalog -> CreateDataCatalog -> Bool
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]
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
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. 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'
{ $sel:description:CreateDataCatalog' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:parameters:CreateDataCatalog' :: Maybe (HashMap Text Text)
parameters = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDataCatalog' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDataCatalog' :: Text
name = Text
pName_,
$sel:type':CreateDataCatalog' :: DataCatalogType
type' = DataCatalogType
pType_
}
createDataCatalog_description :: Lens.Lens' CreateDataCatalog (Prelude.Maybe Prelude.Text)
createDataCatalog_description :: Lens' CreateDataCatalog (Maybe Text)
createDataCatalog_description = 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_parameters :: Lens.Lens' CreateDataCatalog (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDataCatalog_parameters :: Lens' CreateDataCatalog (Maybe (HashMap Text Text))
createDataCatalog_parameters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createDataCatalog_tags :: Lens.Lens' CreateDataCatalog (Prelude.Maybe [Tag])
createDataCatalog_tags :: Lens' CreateDataCatalog (Maybe [Tag])
createDataCatalog_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CreateDataCatalog Text
createDataCatalog_name = 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 :: Lens' CreateDataCatalog DataCatalogType
createDataCatalog_type = 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 :: (Service -> Service)
-> CreateDataCatalog -> Request CreateDataCatalog
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 CreateDataCatalog
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDataCatalog)))
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 -> CreateDataCatalogResponse
CreateDataCatalogResponse'
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 CreateDataCatalog where
hashWithSalt :: Int -> CreateDataCatalog -> Int
hashWithSalt Int
_salt CreateDataCatalog' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
DataCatalogType
type' :: DataCatalogType
name :: Text
tags :: Maybe [Tag]
parameters :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
parameters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DataCatalogType
type'
instance Prelude.NFData CreateDataCatalog where
rnf :: CreateDataCatalog -> ()
rnf CreateDataCatalog' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
DataCatalogType
type' :: DataCatalogType
name :: Text
tags :: Maybe [Tag]
parameters :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
parameters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DataCatalogType
type'
instance Data.ToHeaders CreateDataCatalog where
toHeaders :: CreateDataCatalog -> 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
"AmazonAthena.CreateDataCatalog" ::
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 CreateDataCatalog where
toJSON :: CreateDataCatalog -> Value
toJSON CreateDataCatalog' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
DataCatalogType
type' :: DataCatalogType
name :: Text
tags :: Maybe [Tag]
parameters :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:type':CreateDataCatalog' :: CreateDataCatalog -> DataCatalogType
$sel:name:CreateDataCatalog' :: CreateDataCatalog -> Text
$sel:tags:CreateDataCatalog' :: CreateDataCatalog -> Maybe [Tag]
$sel:parameters:CreateDataCatalog' :: CreateDataCatalog -> Maybe (HashMap Text Text)
$sel:description:CreateDataCatalog' :: CreateDataCatalog -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" 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
description,
(Key
"Parameters" 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 (HashMap Text Text)
parameters,
(Key
"Tags" 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 [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DataCatalogType
type')
]
)
instance Data.ToPath CreateDataCatalog where
toPath :: CreateDataCatalog -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateDataCatalog where
toQuery :: CreateDataCatalog -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateDataCatalogResponse = CreateDataCatalogResponse'
{
CreateDataCatalogResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDataCatalogResponse -> CreateDataCatalogResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:CreateDataCatalogResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createDataCatalogResponse_httpStatus :: Lens.Lens' CreateDataCatalogResponse Prelude.Int
createDataCatalogResponse_httpStatus :: Lens' CreateDataCatalogResponse Int
createDataCatalogResponse_httpStatus = 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 where
rnf :: CreateDataCatalogResponse -> ()
rnf CreateDataCatalogResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDataCatalogResponse' :: CreateDataCatalogResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus