{-# 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.GetDataCatalog
(
GetDataCatalog (..),
newGetDataCatalog,
getDataCatalog_name,
GetDataCatalogResponse (..),
newGetDataCatalogResponse,
getDataCatalogResponse_dataCatalog,
getDataCatalogResponse_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 GetDataCatalog = GetDataCatalog'
{
GetDataCatalog -> Text
name :: Prelude.Text
}
deriving (GetDataCatalog -> GetDataCatalog -> Bool
(GetDataCatalog -> GetDataCatalog -> Bool)
-> (GetDataCatalog -> GetDataCatalog -> Bool) -> Eq GetDataCatalog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataCatalog -> GetDataCatalog -> Bool
$c/= :: GetDataCatalog -> GetDataCatalog -> Bool
== :: GetDataCatalog -> GetDataCatalog -> Bool
$c== :: GetDataCatalog -> GetDataCatalog -> Bool
Prelude.Eq, ReadPrec [GetDataCatalog]
ReadPrec GetDataCatalog
Int -> ReadS GetDataCatalog
ReadS [GetDataCatalog]
(Int -> ReadS GetDataCatalog)
-> ReadS [GetDataCatalog]
-> ReadPrec GetDataCatalog
-> ReadPrec [GetDataCatalog]
-> Read GetDataCatalog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataCatalog]
$creadListPrec :: ReadPrec [GetDataCatalog]
readPrec :: ReadPrec GetDataCatalog
$creadPrec :: ReadPrec GetDataCatalog
readList :: ReadS [GetDataCatalog]
$creadList :: ReadS [GetDataCatalog]
readsPrec :: Int -> ReadS GetDataCatalog
$creadsPrec :: Int -> ReadS GetDataCatalog
Prelude.Read, Int -> GetDataCatalog -> ShowS
[GetDataCatalog] -> ShowS
GetDataCatalog -> String
(Int -> GetDataCatalog -> ShowS)
-> (GetDataCatalog -> String)
-> ([GetDataCatalog] -> ShowS)
-> Show GetDataCatalog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataCatalog] -> ShowS
$cshowList :: [GetDataCatalog] -> ShowS
show :: GetDataCatalog -> String
$cshow :: GetDataCatalog -> String
showsPrec :: Int -> GetDataCatalog -> ShowS
$cshowsPrec :: Int -> GetDataCatalog -> ShowS
Prelude.Show, (forall x. GetDataCatalog -> Rep GetDataCatalog x)
-> (forall x. Rep GetDataCatalog x -> GetDataCatalog)
-> Generic GetDataCatalog
forall x. Rep GetDataCatalog x -> GetDataCatalog
forall x. GetDataCatalog -> Rep GetDataCatalog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDataCatalog x -> GetDataCatalog
$cfrom :: forall x. GetDataCatalog -> Rep GetDataCatalog x
Prelude.Generic)
newGetDataCatalog ::
Prelude.Text ->
GetDataCatalog
newGetDataCatalog :: Text -> GetDataCatalog
newGetDataCatalog Text
pName_ =
GetDataCatalog' :: Text -> GetDataCatalog
GetDataCatalog' {$sel:name:GetDataCatalog' :: Text
name = Text
pName_}
getDataCatalog_name :: Lens.Lens' GetDataCatalog Prelude.Text
getDataCatalog_name :: (Text -> f Text) -> GetDataCatalog -> f GetDataCatalog
getDataCatalog_name = (GetDataCatalog -> Text)
-> (GetDataCatalog -> Text -> GetDataCatalog)
-> Lens GetDataCatalog GetDataCatalog Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataCatalog' {Text
name :: Text
$sel:name:GetDataCatalog' :: GetDataCatalog -> Text
name} -> Text
name) (\s :: GetDataCatalog
s@GetDataCatalog' {} Text
a -> GetDataCatalog
s {$sel:name:GetDataCatalog' :: Text
name = Text
a} :: GetDataCatalog)
instance Core.AWSRequest GetDataCatalog where
type
AWSResponse GetDataCatalog =
GetDataCatalogResponse
request :: GetDataCatalog -> Request GetDataCatalog
request = Service -> GetDataCatalog -> Request GetDataCatalog
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDataCatalog
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDataCatalog)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDataCatalog))
-> Logger
-> Service
-> Proxy GetDataCatalog
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDataCatalog)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DataCatalog -> Int -> GetDataCatalogResponse
GetDataCatalogResponse'
(Maybe DataCatalog -> Int -> GetDataCatalogResponse)
-> Either String (Maybe DataCatalog)
-> Either String (Int -> GetDataCatalogResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DataCatalog)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataCatalog")
Either String (Int -> GetDataCatalogResponse)
-> Either String Int -> Either String GetDataCatalogResponse
forall (f :: * -> *) a b. Applicative f => 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 GetDataCatalog
instance Prelude.NFData GetDataCatalog
instance Core.ToHeaders GetDataCatalog where
toHeaders :: GetDataCatalog -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDataCatalog -> 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.GetDataCatalog" ::
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 GetDataCatalog where
toJSON :: GetDataCatalog -> Value
toJSON GetDataCatalog' {Text
name :: Text
$sel:name:GetDataCatalog' :: GetDataCatalog -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[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)]
)
instance Core.ToPath GetDataCatalog where
toPath :: GetDataCatalog -> ByteString
toPath = ByteString -> GetDataCatalog -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDataCatalog where
toQuery :: GetDataCatalog -> QueryString
toQuery = QueryString -> GetDataCatalog -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDataCatalogResponse = GetDataCatalogResponse'
{
GetDataCatalogResponse -> Maybe DataCatalog
dataCatalog :: Prelude.Maybe DataCatalog,
GetDataCatalogResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDataCatalogResponse -> GetDataCatalogResponse -> Bool
(GetDataCatalogResponse -> GetDataCatalogResponse -> Bool)
-> (GetDataCatalogResponse -> GetDataCatalogResponse -> Bool)
-> Eq GetDataCatalogResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataCatalogResponse -> GetDataCatalogResponse -> Bool
$c/= :: GetDataCatalogResponse -> GetDataCatalogResponse -> Bool
== :: GetDataCatalogResponse -> GetDataCatalogResponse -> Bool
$c== :: GetDataCatalogResponse -> GetDataCatalogResponse -> Bool
Prelude.Eq, ReadPrec [GetDataCatalogResponse]
ReadPrec GetDataCatalogResponse
Int -> ReadS GetDataCatalogResponse
ReadS [GetDataCatalogResponse]
(Int -> ReadS GetDataCatalogResponse)
-> ReadS [GetDataCatalogResponse]
-> ReadPrec GetDataCatalogResponse
-> ReadPrec [GetDataCatalogResponse]
-> Read GetDataCatalogResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataCatalogResponse]
$creadListPrec :: ReadPrec [GetDataCatalogResponse]
readPrec :: ReadPrec GetDataCatalogResponse
$creadPrec :: ReadPrec GetDataCatalogResponse
readList :: ReadS [GetDataCatalogResponse]
$creadList :: ReadS [GetDataCatalogResponse]
readsPrec :: Int -> ReadS GetDataCatalogResponse
$creadsPrec :: Int -> ReadS GetDataCatalogResponse
Prelude.Read, Int -> GetDataCatalogResponse -> ShowS
[GetDataCatalogResponse] -> ShowS
GetDataCatalogResponse -> String
(Int -> GetDataCatalogResponse -> ShowS)
-> (GetDataCatalogResponse -> String)
-> ([GetDataCatalogResponse] -> ShowS)
-> Show GetDataCatalogResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataCatalogResponse] -> ShowS
$cshowList :: [GetDataCatalogResponse] -> ShowS
show :: GetDataCatalogResponse -> String
$cshow :: GetDataCatalogResponse -> String
showsPrec :: Int -> GetDataCatalogResponse -> ShowS
$cshowsPrec :: Int -> GetDataCatalogResponse -> ShowS
Prelude.Show, (forall x. GetDataCatalogResponse -> Rep GetDataCatalogResponse x)
-> (forall x.
Rep GetDataCatalogResponse x -> GetDataCatalogResponse)
-> Generic GetDataCatalogResponse
forall x. Rep GetDataCatalogResponse x -> GetDataCatalogResponse
forall x. GetDataCatalogResponse -> Rep GetDataCatalogResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDataCatalogResponse x -> GetDataCatalogResponse
$cfrom :: forall x. GetDataCatalogResponse -> Rep GetDataCatalogResponse x
Prelude.Generic)
newGetDataCatalogResponse ::
Prelude.Int ->
GetDataCatalogResponse
newGetDataCatalogResponse :: Int -> GetDataCatalogResponse
newGetDataCatalogResponse Int
pHttpStatus_ =
GetDataCatalogResponse' :: Maybe DataCatalog -> Int -> GetDataCatalogResponse
GetDataCatalogResponse'
{ $sel:dataCatalog:GetDataCatalogResponse' :: Maybe DataCatalog
dataCatalog =
Maybe DataCatalog
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDataCatalogResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDataCatalogResponse_dataCatalog :: Lens.Lens' GetDataCatalogResponse (Prelude.Maybe DataCatalog)
getDataCatalogResponse_dataCatalog :: (Maybe DataCatalog -> f (Maybe DataCatalog))
-> GetDataCatalogResponse -> f GetDataCatalogResponse
getDataCatalogResponse_dataCatalog = (GetDataCatalogResponse -> Maybe DataCatalog)
-> (GetDataCatalogResponse
-> Maybe DataCatalog -> GetDataCatalogResponse)
-> Lens
GetDataCatalogResponse
GetDataCatalogResponse
(Maybe DataCatalog)
(Maybe DataCatalog)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataCatalogResponse' {Maybe DataCatalog
dataCatalog :: Maybe DataCatalog
$sel:dataCatalog:GetDataCatalogResponse' :: GetDataCatalogResponse -> Maybe DataCatalog
dataCatalog} -> Maybe DataCatalog
dataCatalog) (\s :: GetDataCatalogResponse
s@GetDataCatalogResponse' {} Maybe DataCatalog
a -> GetDataCatalogResponse
s {$sel:dataCatalog:GetDataCatalogResponse' :: Maybe DataCatalog
dataCatalog = Maybe DataCatalog
a} :: GetDataCatalogResponse)
getDataCatalogResponse_httpStatus :: Lens.Lens' GetDataCatalogResponse Prelude.Int
getDataCatalogResponse_httpStatus :: (Int -> f Int)
-> GetDataCatalogResponse -> f GetDataCatalogResponse
getDataCatalogResponse_httpStatus = (GetDataCatalogResponse -> Int)
-> (GetDataCatalogResponse -> Int -> GetDataCatalogResponse)
-> Lens GetDataCatalogResponse GetDataCatalogResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataCatalogResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDataCatalogResponse' :: GetDataCatalogResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDataCatalogResponse
s@GetDataCatalogResponse' {} Int
a -> GetDataCatalogResponse
s {$sel:httpStatus:GetDataCatalogResponse' :: Int
httpStatus = Int
a} :: GetDataCatalogResponse)
instance Prelude.NFData GetDataCatalogResponse