{-# 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.GetCrawler
(
GetCrawler (..),
newGetCrawler,
getCrawler_name,
GetCrawlerResponse (..),
newGetCrawlerResponse,
getCrawlerResponse_crawler,
getCrawlerResponse_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 GetCrawler = GetCrawler'
{
GetCrawler -> Text
name :: Prelude.Text
}
deriving (GetCrawler -> GetCrawler -> Bool
(GetCrawler -> GetCrawler -> Bool)
-> (GetCrawler -> GetCrawler -> Bool) -> Eq GetCrawler
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCrawler -> GetCrawler -> Bool
$c/= :: GetCrawler -> GetCrawler -> Bool
== :: GetCrawler -> GetCrawler -> Bool
$c== :: GetCrawler -> GetCrawler -> Bool
Prelude.Eq, ReadPrec [GetCrawler]
ReadPrec GetCrawler
Int -> ReadS GetCrawler
ReadS [GetCrawler]
(Int -> ReadS GetCrawler)
-> ReadS [GetCrawler]
-> ReadPrec GetCrawler
-> ReadPrec [GetCrawler]
-> Read GetCrawler
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCrawler]
$creadListPrec :: ReadPrec [GetCrawler]
readPrec :: ReadPrec GetCrawler
$creadPrec :: ReadPrec GetCrawler
readList :: ReadS [GetCrawler]
$creadList :: ReadS [GetCrawler]
readsPrec :: Int -> ReadS GetCrawler
$creadsPrec :: Int -> ReadS GetCrawler
Prelude.Read, Int -> GetCrawler -> ShowS
[GetCrawler] -> ShowS
GetCrawler -> String
(Int -> GetCrawler -> ShowS)
-> (GetCrawler -> String)
-> ([GetCrawler] -> ShowS)
-> Show GetCrawler
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCrawler] -> ShowS
$cshowList :: [GetCrawler] -> ShowS
show :: GetCrawler -> String
$cshow :: GetCrawler -> String
showsPrec :: Int -> GetCrawler -> ShowS
$cshowsPrec :: Int -> GetCrawler -> ShowS
Prelude.Show, (forall x. GetCrawler -> Rep GetCrawler x)
-> (forall x. Rep GetCrawler x -> GetCrawler) -> Generic GetCrawler
forall x. Rep GetCrawler x -> GetCrawler
forall x. GetCrawler -> Rep GetCrawler x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCrawler x -> GetCrawler
$cfrom :: forall x. GetCrawler -> Rep GetCrawler x
Prelude.Generic)
newGetCrawler ::
Prelude.Text ->
GetCrawler
newGetCrawler :: Text -> GetCrawler
newGetCrawler Text
pName_ = GetCrawler' :: Text -> GetCrawler
GetCrawler' {$sel:name:GetCrawler' :: Text
name = Text
pName_}
getCrawler_name :: Lens.Lens' GetCrawler Prelude.Text
getCrawler_name :: (Text -> f Text) -> GetCrawler -> f GetCrawler
getCrawler_name = (GetCrawler -> Text)
-> (GetCrawler -> Text -> GetCrawler)
-> Lens GetCrawler GetCrawler Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCrawler' {Text
name :: Text
$sel:name:GetCrawler' :: GetCrawler -> Text
name} -> Text
name) (\s :: GetCrawler
s@GetCrawler' {} Text
a -> GetCrawler
s {$sel:name:GetCrawler' :: Text
name = Text
a} :: GetCrawler)
instance Core.AWSRequest GetCrawler where
type AWSResponse GetCrawler = GetCrawlerResponse
request :: GetCrawler -> Request GetCrawler
request = Service -> GetCrawler -> Request GetCrawler
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCrawler
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCrawler)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCrawler))
-> Logger
-> Service
-> Proxy GetCrawler
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCrawler)))
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 Crawler -> Int -> GetCrawlerResponse
GetCrawlerResponse'
(Maybe Crawler -> Int -> GetCrawlerResponse)
-> Either String (Maybe Crawler)
-> Either String (Int -> GetCrawlerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Crawler)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Crawler")
Either String (Int -> GetCrawlerResponse)
-> Either String Int -> Either String GetCrawlerResponse
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 GetCrawler
instance Prelude.NFData GetCrawler
instance Core.ToHeaders GetCrawler where
toHeaders :: GetCrawler -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCrawler -> 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.GetCrawler" :: 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 GetCrawler where
toJSON :: GetCrawler -> Value
toJSON GetCrawler' {Text
name :: Text
$sel:name:GetCrawler' :: GetCrawler -> 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 GetCrawler where
toPath :: GetCrawler -> ByteString
toPath = ByteString -> GetCrawler -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCrawler where
toQuery :: GetCrawler -> QueryString
toQuery = QueryString -> GetCrawler -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCrawlerResponse = GetCrawlerResponse'
{
GetCrawlerResponse -> Maybe Crawler
crawler :: Prelude.Maybe Crawler,
GetCrawlerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCrawlerResponse -> GetCrawlerResponse -> Bool
(GetCrawlerResponse -> GetCrawlerResponse -> Bool)
-> (GetCrawlerResponse -> GetCrawlerResponse -> Bool)
-> Eq GetCrawlerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCrawlerResponse -> GetCrawlerResponse -> Bool
$c/= :: GetCrawlerResponse -> GetCrawlerResponse -> Bool
== :: GetCrawlerResponse -> GetCrawlerResponse -> Bool
$c== :: GetCrawlerResponse -> GetCrawlerResponse -> Bool
Prelude.Eq, ReadPrec [GetCrawlerResponse]
ReadPrec GetCrawlerResponse
Int -> ReadS GetCrawlerResponse
ReadS [GetCrawlerResponse]
(Int -> ReadS GetCrawlerResponse)
-> ReadS [GetCrawlerResponse]
-> ReadPrec GetCrawlerResponse
-> ReadPrec [GetCrawlerResponse]
-> Read GetCrawlerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCrawlerResponse]
$creadListPrec :: ReadPrec [GetCrawlerResponse]
readPrec :: ReadPrec GetCrawlerResponse
$creadPrec :: ReadPrec GetCrawlerResponse
readList :: ReadS [GetCrawlerResponse]
$creadList :: ReadS [GetCrawlerResponse]
readsPrec :: Int -> ReadS GetCrawlerResponse
$creadsPrec :: Int -> ReadS GetCrawlerResponse
Prelude.Read, Int -> GetCrawlerResponse -> ShowS
[GetCrawlerResponse] -> ShowS
GetCrawlerResponse -> String
(Int -> GetCrawlerResponse -> ShowS)
-> (GetCrawlerResponse -> String)
-> ([GetCrawlerResponse] -> ShowS)
-> Show GetCrawlerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCrawlerResponse] -> ShowS
$cshowList :: [GetCrawlerResponse] -> ShowS
show :: GetCrawlerResponse -> String
$cshow :: GetCrawlerResponse -> String
showsPrec :: Int -> GetCrawlerResponse -> ShowS
$cshowsPrec :: Int -> GetCrawlerResponse -> ShowS
Prelude.Show, (forall x. GetCrawlerResponse -> Rep GetCrawlerResponse x)
-> (forall x. Rep GetCrawlerResponse x -> GetCrawlerResponse)
-> Generic GetCrawlerResponse
forall x. Rep GetCrawlerResponse x -> GetCrawlerResponse
forall x. GetCrawlerResponse -> Rep GetCrawlerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCrawlerResponse x -> GetCrawlerResponse
$cfrom :: forall x. GetCrawlerResponse -> Rep GetCrawlerResponse x
Prelude.Generic)
newGetCrawlerResponse ::
Prelude.Int ->
GetCrawlerResponse
newGetCrawlerResponse :: Int -> GetCrawlerResponse
newGetCrawlerResponse Int
pHttpStatus_ =
GetCrawlerResponse' :: Maybe Crawler -> Int -> GetCrawlerResponse
GetCrawlerResponse'
{ $sel:crawler:GetCrawlerResponse' :: Maybe Crawler
crawler = Maybe Crawler
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCrawlerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCrawlerResponse_crawler :: Lens.Lens' GetCrawlerResponse (Prelude.Maybe Crawler)
getCrawlerResponse_crawler :: (Maybe Crawler -> f (Maybe Crawler))
-> GetCrawlerResponse -> f GetCrawlerResponse
getCrawlerResponse_crawler = (GetCrawlerResponse -> Maybe Crawler)
-> (GetCrawlerResponse -> Maybe Crawler -> GetCrawlerResponse)
-> Lens
GetCrawlerResponse
GetCrawlerResponse
(Maybe Crawler)
(Maybe Crawler)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCrawlerResponse' {Maybe Crawler
crawler :: Maybe Crawler
$sel:crawler:GetCrawlerResponse' :: GetCrawlerResponse -> Maybe Crawler
crawler} -> Maybe Crawler
crawler) (\s :: GetCrawlerResponse
s@GetCrawlerResponse' {} Maybe Crawler
a -> GetCrawlerResponse
s {$sel:crawler:GetCrawlerResponse' :: Maybe Crawler
crawler = Maybe Crawler
a} :: GetCrawlerResponse)
getCrawlerResponse_httpStatus :: Lens.Lens' GetCrawlerResponse Prelude.Int
getCrawlerResponse_httpStatus :: (Int -> f Int) -> GetCrawlerResponse -> f GetCrawlerResponse
getCrawlerResponse_httpStatus = (GetCrawlerResponse -> Int)
-> (GetCrawlerResponse -> Int -> GetCrawlerResponse)
-> Lens GetCrawlerResponse GetCrawlerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCrawlerResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCrawlerResponse' :: GetCrawlerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCrawlerResponse
s@GetCrawlerResponse' {} Int
a -> GetCrawlerResponse
s {$sel:httpStatus:GetCrawlerResponse' :: Int
httpStatus = Int
a} :: GetCrawlerResponse)
instance Prelude.NFData GetCrawlerResponse