{-# 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.StartCrawler
(
StartCrawler (..),
newStartCrawler,
startCrawler_name,
StartCrawlerResponse (..),
newStartCrawlerResponse,
startCrawlerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartCrawler = StartCrawler'
{
StartCrawler -> Text
name :: Prelude.Text
}
deriving (StartCrawler -> StartCrawler -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCrawler -> StartCrawler -> Bool
$c/= :: StartCrawler -> StartCrawler -> Bool
== :: StartCrawler -> StartCrawler -> Bool
$c== :: StartCrawler -> StartCrawler -> Bool
Prelude.Eq, ReadPrec [StartCrawler]
ReadPrec StartCrawler
Int -> ReadS StartCrawler
ReadS [StartCrawler]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartCrawler]
$creadListPrec :: ReadPrec [StartCrawler]
readPrec :: ReadPrec StartCrawler
$creadPrec :: ReadPrec StartCrawler
readList :: ReadS [StartCrawler]
$creadList :: ReadS [StartCrawler]
readsPrec :: Int -> ReadS StartCrawler
$creadsPrec :: Int -> ReadS StartCrawler
Prelude.Read, Int -> StartCrawler -> ShowS
[StartCrawler] -> ShowS
StartCrawler -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCrawler] -> ShowS
$cshowList :: [StartCrawler] -> ShowS
show :: StartCrawler -> String
$cshow :: StartCrawler -> String
showsPrec :: Int -> StartCrawler -> ShowS
$cshowsPrec :: Int -> StartCrawler -> ShowS
Prelude.Show, forall x. Rep StartCrawler x -> StartCrawler
forall x. StartCrawler -> Rep StartCrawler x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCrawler x -> StartCrawler
$cfrom :: forall x. StartCrawler -> Rep StartCrawler x
Prelude.Generic)
newStartCrawler ::
Prelude.Text ->
StartCrawler
newStartCrawler :: Text -> StartCrawler
newStartCrawler Text
pName_ = StartCrawler' {$sel:name:StartCrawler' :: Text
name = Text
pName_}
startCrawler_name :: Lens.Lens' StartCrawler Prelude.Text
startCrawler_name :: Lens' StartCrawler Text
startCrawler_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCrawler' {Text
name :: Text
$sel:name:StartCrawler' :: StartCrawler -> Text
name} -> Text
name) (\s :: StartCrawler
s@StartCrawler' {} Text
a -> StartCrawler
s {$sel:name:StartCrawler' :: Text
name = Text
a} :: StartCrawler)
instance Core.AWSRequest StartCrawler where
type AWSResponse StartCrawler = StartCrawlerResponse
request :: (Service -> Service) -> StartCrawler -> Request StartCrawler
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 StartCrawler
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartCrawler)))
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 -> StartCrawlerResponse
StartCrawlerResponse'
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 StartCrawler where
hashWithSalt :: Int -> StartCrawler -> Int
hashWithSalt Int
_salt StartCrawler' {Text
name :: Text
$sel:name:StartCrawler' :: StartCrawler -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData StartCrawler where
rnf :: StartCrawler -> ()
rnf StartCrawler' {Text
name :: Text
$sel:name:StartCrawler' :: StartCrawler -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders StartCrawler where
toHeaders :: StartCrawler -> 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
"AWSGlue.StartCrawler" :: 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 StartCrawler where
toJSON :: StartCrawler -> Value
toJSON StartCrawler' {Text
name :: Text
$sel:name:StartCrawler' :: StartCrawler -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
)
instance Data.ToPath StartCrawler where
toPath :: StartCrawler -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartCrawler where
toQuery :: StartCrawler -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartCrawlerResponse = StartCrawlerResponse'
{
StartCrawlerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartCrawlerResponse -> StartCrawlerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCrawlerResponse -> StartCrawlerResponse -> Bool
$c/= :: StartCrawlerResponse -> StartCrawlerResponse -> Bool
== :: StartCrawlerResponse -> StartCrawlerResponse -> Bool
$c== :: StartCrawlerResponse -> StartCrawlerResponse -> Bool
Prelude.Eq, ReadPrec [StartCrawlerResponse]
ReadPrec StartCrawlerResponse
Int -> ReadS StartCrawlerResponse
ReadS [StartCrawlerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartCrawlerResponse]
$creadListPrec :: ReadPrec [StartCrawlerResponse]
readPrec :: ReadPrec StartCrawlerResponse
$creadPrec :: ReadPrec StartCrawlerResponse
readList :: ReadS [StartCrawlerResponse]
$creadList :: ReadS [StartCrawlerResponse]
readsPrec :: Int -> ReadS StartCrawlerResponse
$creadsPrec :: Int -> ReadS StartCrawlerResponse
Prelude.Read, Int -> StartCrawlerResponse -> ShowS
[StartCrawlerResponse] -> ShowS
StartCrawlerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCrawlerResponse] -> ShowS
$cshowList :: [StartCrawlerResponse] -> ShowS
show :: StartCrawlerResponse -> String
$cshow :: StartCrawlerResponse -> String
showsPrec :: Int -> StartCrawlerResponse -> ShowS
$cshowsPrec :: Int -> StartCrawlerResponse -> ShowS
Prelude.Show, forall x. Rep StartCrawlerResponse x -> StartCrawlerResponse
forall x. StartCrawlerResponse -> Rep StartCrawlerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCrawlerResponse x -> StartCrawlerResponse
$cfrom :: forall x. StartCrawlerResponse -> Rep StartCrawlerResponse x
Prelude.Generic)
newStartCrawlerResponse ::
Prelude.Int ->
StartCrawlerResponse
newStartCrawlerResponse :: Int -> StartCrawlerResponse
newStartCrawlerResponse Int
pHttpStatus_ =
StartCrawlerResponse' {$sel:httpStatus:StartCrawlerResponse' :: Int
httpStatus = Int
pHttpStatus_}
startCrawlerResponse_httpStatus :: Lens.Lens' StartCrawlerResponse Prelude.Int
startCrawlerResponse_httpStatus :: Lens' StartCrawlerResponse Int
startCrawlerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCrawlerResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartCrawlerResponse' :: StartCrawlerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartCrawlerResponse
s@StartCrawlerResponse' {} Int
a -> StartCrawlerResponse
s {$sel:httpStatus:StartCrawlerResponse' :: Int
httpStatus = Int
a} :: StartCrawlerResponse)
instance Prelude.NFData StartCrawlerResponse where
rnf :: StartCrawlerResponse -> ()
rnf StartCrawlerResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartCrawlerResponse' :: StartCrawlerResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus