{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.CreateCrawler
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new crawler with specified targets, role, configuration, and
-- optional schedule. At least one crawl target must be specified, in the
-- @s3Targets@ field, the @jdbcTargets@ field, or the @DynamoDBTargets@
-- field.
module Amazonka.Glue.CreateCrawler
  ( -- * Creating a Request
    CreateCrawler (..),
    newCreateCrawler,

    -- * Request Lenses
    createCrawler_schemaChangePolicy,
    createCrawler_schedule,
    createCrawler_recrawlPolicy,
    createCrawler_classifiers,
    createCrawler_databaseName,
    createCrawler_crawlerSecurityConfiguration,
    createCrawler_lineageConfiguration,
    createCrawler_configuration,
    createCrawler_tablePrefix,
    createCrawler_description,
    createCrawler_tags,
    createCrawler_name,
    createCrawler_role,
    createCrawler_targets,

    -- * Destructuring the Response
    CreateCrawlerResponse (..),
    newCreateCrawlerResponse,

    -- * Response Lenses
    createCrawlerResponse_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

-- | /See:/ 'newCreateCrawler' smart constructor.
data CreateCrawler = CreateCrawler'
  { -- | The policy for the crawler\'s update and deletion behavior.
    CreateCrawler -> Maybe SchemaChangePolicy
schemaChangePolicy :: Prelude.Maybe SchemaChangePolicy,
    -- | A @cron@ expression used to specify the schedule (see
    -- <https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html Time-Based Schedules for Jobs and Crawlers>.
    -- For example, to run something every day at 12:15 UTC, you would specify:
    -- @cron(15 12 * * ? *)@.
    CreateCrawler -> Maybe Text
schedule :: Prelude.Maybe Prelude.Text,
    -- | A policy that specifies whether to crawl the entire dataset again, or to
    -- crawl only folders that were added since the last crawler run.
    CreateCrawler -> Maybe RecrawlPolicy
recrawlPolicy :: Prelude.Maybe RecrawlPolicy,
    -- | A list of custom classifiers that the user has registered. By default,
    -- all built-in classifiers are included in a crawl, but these custom
    -- classifiers always override the default classifiers for a given
    -- classification.
    CreateCrawler -> Maybe [Text]
classifiers :: Prelude.Maybe [Prelude.Text],
    -- | The Glue database where results are written, such as:
    -- @arn:aws:daylight:us-east-1::database\/sometable\/*@.
    CreateCrawler -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | The name of the @SecurityConfiguration@ structure to be used by this
    -- crawler.
    CreateCrawler -> Maybe Text
crawlerSecurityConfiguration :: Prelude.Maybe Prelude.Text,
    -- | Specifies data lineage configuration settings for the crawler.
    CreateCrawler -> Maybe LineageConfiguration
lineageConfiguration :: Prelude.Maybe LineageConfiguration,
    -- | Crawler configuration information. This versioned JSON string allows
    -- users to specify aspects of a crawler\'s behavior. For more information,
    -- see
    -- <https://docs.aws.amazon.com/glue/latest/dg/crawler-configuration.html Configuring a Crawler>.
    CreateCrawler -> Maybe Text
configuration :: Prelude.Maybe Prelude.Text,
    -- | The table prefix used for catalog tables that are created.
    CreateCrawler -> Maybe Text
tablePrefix :: Prelude.Maybe Prelude.Text,
    -- | A description of the new crawler.
    CreateCrawler -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags to use with this crawler request. You may use tags to limit
    -- access to the crawler. For more information about tags in Glue, see
    -- <https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html Amazon Web Services Tags in Glue>
    -- in the developer guide.
    CreateCrawler -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Name of the new crawler.
    CreateCrawler -> Text
name :: Prelude.Text,
    -- | The IAM role or Amazon Resource Name (ARN) of an IAM role used by the
    -- new crawler to access customer resources.
    CreateCrawler -> Text
role' :: Prelude.Text,
    -- | A list of collection of targets to crawl.
    CreateCrawler -> CrawlerTargets
targets :: CrawlerTargets
  }
  deriving (CreateCrawler -> CreateCrawler -> Bool
(CreateCrawler -> CreateCrawler -> Bool)
-> (CreateCrawler -> CreateCrawler -> Bool) -> Eq CreateCrawler
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCrawler -> CreateCrawler -> Bool
$c/= :: CreateCrawler -> CreateCrawler -> Bool
== :: CreateCrawler -> CreateCrawler -> Bool
$c== :: CreateCrawler -> CreateCrawler -> Bool
Prelude.Eq, ReadPrec [CreateCrawler]
ReadPrec CreateCrawler
Int -> ReadS CreateCrawler
ReadS [CreateCrawler]
(Int -> ReadS CreateCrawler)
-> ReadS [CreateCrawler]
-> ReadPrec CreateCrawler
-> ReadPrec [CreateCrawler]
-> Read CreateCrawler
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCrawler]
$creadListPrec :: ReadPrec [CreateCrawler]
readPrec :: ReadPrec CreateCrawler
$creadPrec :: ReadPrec CreateCrawler
readList :: ReadS [CreateCrawler]
$creadList :: ReadS [CreateCrawler]
readsPrec :: Int -> ReadS CreateCrawler
$creadsPrec :: Int -> ReadS CreateCrawler
Prelude.Read, Int -> CreateCrawler -> ShowS
[CreateCrawler] -> ShowS
CreateCrawler -> String
(Int -> CreateCrawler -> ShowS)
-> (CreateCrawler -> String)
-> ([CreateCrawler] -> ShowS)
-> Show CreateCrawler
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCrawler] -> ShowS
$cshowList :: [CreateCrawler] -> ShowS
show :: CreateCrawler -> String
$cshow :: CreateCrawler -> String
showsPrec :: Int -> CreateCrawler -> ShowS
$cshowsPrec :: Int -> CreateCrawler -> ShowS
Prelude.Show, (forall x. CreateCrawler -> Rep CreateCrawler x)
-> (forall x. Rep CreateCrawler x -> CreateCrawler)
-> Generic CreateCrawler
forall x. Rep CreateCrawler x -> CreateCrawler
forall x. CreateCrawler -> Rep CreateCrawler x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCrawler x -> CreateCrawler
$cfrom :: forall x. CreateCrawler -> Rep CreateCrawler x
Prelude.Generic)

-- |
-- Create a value of 'CreateCrawler' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'schemaChangePolicy', 'createCrawler_schemaChangePolicy' - The policy for the crawler\'s update and deletion behavior.
--
-- 'schedule', 'createCrawler_schedule' - A @cron@ expression used to specify the schedule (see
-- <https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html Time-Based Schedules for Jobs and Crawlers>.
-- For example, to run something every day at 12:15 UTC, you would specify:
-- @cron(15 12 * * ? *)@.
--
-- 'recrawlPolicy', 'createCrawler_recrawlPolicy' - A policy that specifies whether to crawl the entire dataset again, or to
-- crawl only folders that were added since the last crawler run.
--
-- 'classifiers', 'createCrawler_classifiers' - A list of custom classifiers that the user has registered. By default,
-- all built-in classifiers are included in a crawl, but these custom
-- classifiers always override the default classifiers for a given
-- classification.
--
-- 'databaseName', 'createCrawler_databaseName' - The Glue database where results are written, such as:
-- @arn:aws:daylight:us-east-1::database\/sometable\/*@.
--
-- 'crawlerSecurityConfiguration', 'createCrawler_crawlerSecurityConfiguration' - The name of the @SecurityConfiguration@ structure to be used by this
-- crawler.
--
-- 'lineageConfiguration', 'createCrawler_lineageConfiguration' - Specifies data lineage configuration settings for the crawler.
--
-- 'configuration', 'createCrawler_configuration' - Crawler configuration information. This versioned JSON string allows
-- users to specify aspects of a crawler\'s behavior. For more information,
-- see
-- <https://docs.aws.amazon.com/glue/latest/dg/crawler-configuration.html Configuring a Crawler>.
--
-- 'tablePrefix', 'createCrawler_tablePrefix' - The table prefix used for catalog tables that are created.
--
-- 'description', 'createCrawler_description' - A description of the new crawler.
--
-- 'tags', 'createCrawler_tags' - The tags to use with this crawler request. You may use tags to limit
-- access to the crawler. For more information about tags in Glue, see
-- <https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html Amazon Web Services Tags in Glue>
-- in the developer guide.
--
-- 'name', 'createCrawler_name' - Name of the new crawler.
--
-- 'role'', 'createCrawler_role' - The IAM role or Amazon Resource Name (ARN) of an IAM role used by the
-- new crawler to access customer resources.
--
-- 'targets', 'createCrawler_targets' - A list of collection of targets to crawl.
newCreateCrawler ::
  -- | 'name'
  Prelude.Text ->
  -- | 'role''
  Prelude.Text ->
  -- | 'targets'
  CrawlerTargets ->
  CreateCrawler
newCreateCrawler :: Text -> Text -> CrawlerTargets -> CreateCrawler
newCreateCrawler Text
pName_ Text
pRole_ CrawlerTargets
pTargets_ =
  CreateCrawler' :: Maybe SchemaChangePolicy
-> Maybe Text
-> Maybe RecrawlPolicy
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe LineageConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> CrawlerTargets
-> CreateCrawler
CreateCrawler'
    { $sel:schemaChangePolicy:CreateCrawler' :: Maybe SchemaChangePolicy
schemaChangePolicy =
        Maybe SchemaChangePolicy
forall a. Maybe a
Prelude.Nothing,
      $sel:schedule:CreateCrawler' :: Maybe Text
schedule = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recrawlPolicy:CreateCrawler' :: Maybe RecrawlPolicy
recrawlPolicy = Maybe RecrawlPolicy
forall a. Maybe a
Prelude.Nothing,
      $sel:classifiers:CreateCrawler' :: Maybe [Text]
classifiers = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseName:CreateCrawler' :: Maybe Text
databaseName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:crawlerSecurityConfiguration:CreateCrawler' :: Maybe Text
crawlerSecurityConfiguration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lineageConfiguration:CreateCrawler' :: Maybe LineageConfiguration
lineageConfiguration = Maybe LineageConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:CreateCrawler' :: Maybe Text
configuration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tablePrefix:CreateCrawler' :: Maybe Text
tablePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateCrawler' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateCrawler' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateCrawler' :: Text
name = Text
pName_,
      $sel:role':CreateCrawler' :: Text
role' = Text
pRole_,
      $sel:targets:CreateCrawler' :: CrawlerTargets
targets = CrawlerTargets
pTargets_
    }

-- | The policy for the crawler\'s update and deletion behavior.
createCrawler_schemaChangePolicy :: Lens.Lens' CreateCrawler (Prelude.Maybe SchemaChangePolicy)
createCrawler_schemaChangePolicy :: (Maybe SchemaChangePolicy -> f (Maybe SchemaChangePolicy))
-> CreateCrawler -> f CreateCrawler
createCrawler_schemaChangePolicy = (CreateCrawler -> Maybe SchemaChangePolicy)
-> (CreateCrawler -> Maybe SchemaChangePolicy -> CreateCrawler)
-> Lens
     CreateCrawler
     CreateCrawler
     (Maybe SchemaChangePolicy)
     (Maybe SchemaChangePolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe SchemaChangePolicy
schemaChangePolicy :: Maybe SchemaChangePolicy
$sel:schemaChangePolicy:CreateCrawler' :: CreateCrawler -> Maybe SchemaChangePolicy
schemaChangePolicy} -> Maybe SchemaChangePolicy
schemaChangePolicy) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe SchemaChangePolicy
a -> CreateCrawler
s {$sel:schemaChangePolicy:CreateCrawler' :: Maybe SchemaChangePolicy
schemaChangePolicy = Maybe SchemaChangePolicy
a} :: CreateCrawler)

-- | A @cron@ expression used to specify the schedule (see
-- <https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html Time-Based Schedules for Jobs and Crawlers>.
-- For example, to run something every day at 12:15 UTC, you would specify:
-- @cron(15 12 * * ? *)@.
createCrawler_schedule :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_schedule :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_schedule = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
schedule :: Maybe Text
$sel:schedule:CreateCrawler' :: CreateCrawler -> Maybe Text
schedule} -> Maybe Text
schedule) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:schedule:CreateCrawler' :: Maybe Text
schedule = Maybe Text
a} :: CreateCrawler)

-- | A policy that specifies whether to crawl the entire dataset again, or to
-- crawl only folders that were added since the last crawler run.
createCrawler_recrawlPolicy :: Lens.Lens' CreateCrawler (Prelude.Maybe RecrawlPolicy)
createCrawler_recrawlPolicy :: (Maybe RecrawlPolicy -> f (Maybe RecrawlPolicy))
-> CreateCrawler -> f CreateCrawler
createCrawler_recrawlPolicy = (CreateCrawler -> Maybe RecrawlPolicy)
-> (CreateCrawler -> Maybe RecrawlPolicy -> CreateCrawler)
-> Lens
     CreateCrawler
     CreateCrawler
     (Maybe RecrawlPolicy)
     (Maybe RecrawlPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe RecrawlPolicy
recrawlPolicy :: Maybe RecrawlPolicy
$sel:recrawlPolicy:CreateCrawler' :: CreateCrawler -> Maybe RecrawlPolicy
recrawlPolicy} -> Maybe RecrawlPolicy
recrawlPolicy) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe RecrawlPolicy
a -> CreateCrawler
s {$sel:recrawlPolicy:CreateCrawler' :: Maybe RecrawlPolicy
recrawlPolicy = Maybe RecrawlPolicy
a} :: CreateCrawler)

-- | A list of custom classifiers that the user has registered. By default,
-- all built-in classifiers are included in a crawl, but these custom
-- classifiers always override the default classifiers for a given
-- classification.
createCrawler_classifiers :: Lens.Lens' CreateCrawler (Prelude.Maybe [Prelude.Text])
createCrawler_classifiers :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateCrawler -> f CreateCrawler
createCrawler_classifiers = (CreateCrawler -> Maybe [Text])
-> (CreateCrawler -> Maybe [Text] -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe [Text]
classifiers :: Maybe [Text]
$sel:classifiers:CreateCrawler' :: CreateCrawler -> Maybe [Text]
classifiers} -> Maybe [Text]
classifiers) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe [Text]
a -> CreateCrawler
s {$sel:classifiers:CreateCrawler' :: Maybe [Text]
classifiers = Maybe [Text]
a} :: CreateCrawler) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateCrawler -> f CreateCrawler)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateCrawler
-> f CreateCrawler
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Glue database where results are written, such as:
-- @arn:aws:daylight:us-east-1::database\/sometable\/*@.
createCrawler_databaseName :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_databaseName :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_databaseName = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:CreateCrawler' :: CreateCrawler -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:databaseName:CreateCrawler' :: Maybe Text
databaseName = Maybe Text
a} :: CreateCrawler)

-- | The name of the @SecurityConfiguration@ structure to be used by this
-- crawler.
createCrawler_crawlerSecurityConfiguration :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_crawlerSecurityConfiguration :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_crawlerSecurityConfiguration = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
crawlerSecurityConfiguration :: Maybe Text
$sel:crawlerSecurityConfiguration:CreateCrawler' :: CreateCrawler -> Maybe Text
crawlerSecurityConfiguration} -> Maybe Text
crawlerSecurityConfiguration) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:crawlerSecurityConfiguration:CreateCrawler' :: Maybe Text
crawlerSecurityConfiguration = Maybe Text
a} :: CreateCrawler)

-- | Specifies data lineage configuration settings for the crawler.
createCrawler_lineageConfiguration :: Lens.Lens' CreateCrawler (Prelude.Maybe LineageConfiguration)
createCrawler_lineageConfiguration :: (Maybe LineageConfiguration -> f (Maybe LineageConfiguration))
-> CreateCrawler -> f CreateCrawler
createCrawler_lineageConfiguration = (CreateCrawler -> Maybe LineageConfiguration)
-> (CreateCrawler -> Maybe LineageConfiguration -> CreateCrawler)
-> Lens
     CreateCrawler
     CreateCrawler
     (Maybe LineageConfiguration)
     (Maybe LineageConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe LineageConfiguration
lineageConfiguration :: Maybe LineageConfiguration
$sel:lineageConfiguration:CreateCrawler' :: CreateCrawler -> Maybe LineageConfiguration
lineageConfiguration} -> Maybe LineageConfiguration
lineageConfiguration) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe LineageConfiguration
a -> CreateCrawler
s {$sel:lineageConfiguration:CreateCrawler' :: Maybe LineageConfiguration
lineageConfiguration = Maybe LineageConfiguration
a} :: CreateCrawler)

-- | Crawler configuration information. This versioned JSON string allows
-- users to specify aspects of a crawler\'s behavior. For more information,
-- see
-- <https://docs.aws.amazon.com/glue/latest/dg/crawler-configuration.html Configuring a Crawler>.
createCrawler_configuration :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_configuration :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_configuration = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
configuration :: Maybe Text
$sel:configuration:CreateCrawler' :: CreateCrawler -> Maybe Text
configuration} -> Maybe Text
configuration) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:configuration:CreateCrawler' :: Maybe Text
configuration = Maybe Text
a} :: CreateCrawler)

-- | The table prefix used for catalog tables that are created.
createCrawler_tablePrefix :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_tablePrefix :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_tablePrefix = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
tablePrefix :: Maybe Text
$sel:tablePrefix:CreateCrawler' :: CreateCrawler -> Maybe Text
tablePrefix} -> Maybe Text
tablePrefix) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:tablePrefix:CreateCrawler' :: Maybe Text
tablePrefix = Maybe Text
a} :: CreateCrawler)

-- | A description of the new crawler.
createCrawler_description :: Lens.Lens' CreateCrawler (Prelude.Maybe Prelude.Text)
createCrawler_description :: (Maybe Text -> f (Maybe Text)) -> CreateCrawler -> f CreateCrawler
createCrawler_description = (CreateCrawler -> Maybe Text)
-> (CreateCrawler -> Maybe Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Maybe Text
description :: Maybe Text
$sel:description:CreateCrawler' :: CreateCrawler -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe Text
a -> CreateCrawler
s {$sel:description:CreateCrawler' :: Maybe Text
description = Maybe Text
a} :: CreateCrawler)

-- | The tags to use with this crawler request. You may use tags to limit
-- access to the crawler. For more information about tags in Glue, see
-- <https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html Amazon Web Services Tags in Glue>
-- in the developer guide.
createCrawler_tags :: Lens.Lens' CreateCrawler (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createCrawler_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateCrawler -> f CreateCrawler
createCrawler_tags = (CreateCrawler -> Maybe (HashMap Text Text))
-> (CreateCrawler -> Maybe (HashMap Text Text) -> CreateCrawler)
-> Lens
     CreateCrawler
     CreateCrawler
     (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 (\CreateCrawler' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateCrawler' :: CreateCrawler -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateCrawler
s@CreateCrawler' {} Maybe (HashMap Text Text)
a -> CreateCrawler
s {$sel:tags:CreateCrawler' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateCrawler) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateCrawler -> f CreateCrawler)
-> ((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)))
-> CreateCrawler
-> f CreateCrawler
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

-- | Name of the new crawler.
createCrawler_name :: Lens.Lens' CreateCrawler Prelude.Text
createCrawler_name :: (Text -> f Text) -> CreateCrawler -> f CreateCrawler
createCrawler_name = (CreateCrawler -> Text)
-> (CreateCrawler -> Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Text
name :: Text
$sel:name:CreateCrawler' :: CreateCrawler -> Text
name} -> Text
name) (\s :: CreateCrawler
s@CreateCrawler' {} Text
a -> CreateCrawler
s {$sel:name:CreateCrawler' :: Text
name = Text
a} :: CreateCrawler)

-- | The IAM role or Amazon Resource Name (ARN) of an IAM role used by the
-- new crawler to access customer resources.
createCrawler_role :: Lens.Lens' CreateCrawler Prelude.Text
createCrawler_role :: (Text -> f Text) -> CreateCrawler -> f CreateCrawler
createCrawler_role = (CreateCrawler -> Text)
-> (CreateCrawler -> Text -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {Text
role' :: Text
$sel:role':CreateCrawler' :: CreateCrawler -> Text
role'} -> Text
role') (\s :: CreateCrawler
s@CreateCrawler' {} Text
a -> CreateCrawler
s {$sel:role':CreateCrawler' :: Text
role' = Text
a} :: CreateCrawler)

-- | A list of collection of targets to crawl.
createCrawler_targets :: Lens.Lens' CreateCrawler CrawlerTargets
createCrawler_targets :: (CrawlerTargets -> f CrawlerTargets)
-> CreateCrawler -> f CreateCrawler
createCrawler_targets = (CreateCrawler -> CrawlerTargets)
-> (CreateCrawler -> CrawlerTargets -> CreateCrawler)
-> Lens CreateCrawler CreateCrawler CrawlerTargets CrawlerTargets
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawler' {CrawlerTargets
targets :: CrawlerTargets
$sel:targets:CreateCrawler' :: CreateCrawler -> CrawlerTargets
targets} -> CrawlerTargets
targets) (\s :: CreateCrawler
s@CreateCrawler' {} CrawlerTargets
a -> CreateCrawler
s {$sel:targets:CreateCrawler' :: CrawlerTargets
targets = CrawlerTargets
a} :: CreateCrawler)

instance Core.AWSRequest CreateCrawler where
  type
    AWSResponse CreateCrawler =
      CreateCrawlerResponse
  request :: CreateCrawler -> Request CreateCrawler
request = Service -> CreateCrawler -> Request CreateCrawler
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCrawler
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCrawler)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CreateCrawler))
-> Logger
-> Service
-> Proxy CreateCrawler
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCrawler)))
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 -> CreateCrawlerResponse
CreateCrawlerResponse'
            (Int -> CreateCrawlerResponse)
-> Either String Int -> Either String CreateCrawlerResponse
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 CreateCrawler

instance Prelude.NFData CreateCrawler

instance Core.ToHeaders CreateCrawler where
  toHeaders :: CreateCrawler -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateCrawler -> 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.CreateCrawler" :: 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 CreateCrawler where
  toJSON :: CreateCrawler -> Value
toJSON CreateCrawler' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe LineageConfiguration
Maybe RecrawlPolicy
Maybe SchemaChangePolicy
Text
CrawlerTargets
targets :: CrawlerTargets
role' :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
tablePrefix :: Maybe Text
configuration :: Maybe Text
lineageConfiguration :: Maybe LineageConfiguration
crawlerSecurityConfiguration :: Maybe Text
databaseName :: Maybe Text
classifiers :: Maybe [Text]
recrawlPolicy :: Maybe RecrawlPolicy
schedule :: Maybe Text
schemaChangePolicy :: Maybe SchemaChangePolicy
$sel:targets:CreateCrawler' :: CreateCrawler -> CrawlerTargets
$sel:role':CreateCrawler' :: CreateCrawler -> Text
$sel:name:CreateCrawler' :: CreateCrawler -> Text
$sel:tags:CreateCrawler' :: CreateCrawler -> Maybe (HashMap Text Text)
$sel:description:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:tablePrefix:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:configuration:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:lineageConfiguration:CreateCrawler' :: CreateCrawler -> Maybe LineageConfiguration
$sel:crawlerSecurityConfiguration:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:databaseName:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:classifiers:CreateCrawler' :: CreateCrawler -> Maybe [Text]
$sel:recrawlPolicy:CreateCrawler' :: CreateCrawler -> Maybe RecrawlPolicy
$sel:schedule:CreateCrawler' :: CreateCrawler -> Maybe Text
$sel:schemaChangePolicy:CreateCrawler' :: CreateCrawler -> Maybe SchemaChangePolicy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SchemaChangePolicy" Text -> SchemaChangePolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SchemaChangePolicy -> Pair)
-> Maybe SchemaChangePolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SchemaChangePolicy
schemaChangePolicy,
            (Text
"Schedule" 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
schedule,
            (Text
"RecrawlPolicy" Text -> RecrawlPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (RecrawlPolicy -> Pair) -> Maybe RecrawlPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RecrawlPolicy
recrawlPolicy,
            (Text
"Classifiers" 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]
classifiers,
            (Text
"DatabaseName" 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
databaseName,
            (Text
"CrawlerSecurityConfiguration" 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
crawlerSecurityConfiguration,
            (Text
"LineageConfiguration" Text -> LineageConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LineageConfiguration -> Pair)
-> Maybe LineageConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LineageConfiguration
lineageConfiguration,
            (Text
"Configuration" 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
configuration,
            (Text
"TablePrefix" 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
tablePrefix,
            (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 -> 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)
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
"Role" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
role'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Targets" Text -> CrawlerTargets -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CrawlerTargets
targets)
          ]
      )

instance Core.ToPath CreateCrawler where
  toPath :: CreateCrawler -> ByteString
toPath = ByteString -> CreateCrawler -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateCrawler where
  toQuery :: CreateCrawler -> QueryString
toQuery = QueryString -> CreateCrawler -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateCrawlerResponse' smart constructor.
data CreateCrawlerResponse = CreateCrawlerResponse'
  { -- | The response's http status code.
    CreateCrawlerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCrawlerResponse -> CreateCrawlerResponse -> Bool
(CreateCrawlerResponse -> CreateCrawlerResponse -> Bool)
-> (CreateCrawlerResponse -> CreateCrawlerResponse -> Bool)
-> Eq CreateCrawlerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCrawlerResponse -> CreateCrawlerResponse -> Bool
$c/= :: CreateCrawlerResponse -> CreateCrawlerResponse -> Bool
== :: CreateCrawlerResponse -> CreateCrawlerResponse -> Bool
$c== :: CreateCrawlerResponse -> CreateCrawlerResponse -> Bool
Prelude.Eq, ReadPrec [CreateCrawlerResponse]
ReadPrec CreateCrawlerResponse
Int -> ReadS CreateCrawlerResponse
ReadS [CreateCrawlerResponse]
(Int -> ReadS CreateCrawlerResponse)
-> ReadS [CreateCrawlerResponse]
-> ReadPrec CreateCrawlerResponse
-> ReadPrec [CreateCrawlerResponse]
-> Read CreateCrawlerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCrawlerResponse]
$creadListPrec :: ReadPrec [CreateCrawlerResponse]
readPrec :: ReadPrec CreateCrawlerResponse
$creadPrec :: ReadPrec CreateCrawlerResponse
readList :: ReadS [CreateCrawlerResponse]
$creadList :: ReadS [CreateCrawlerResponse]
readsPrec :: Int -> ReadS CreateCrawlerResponse
$creadsPrec :: Int -> ReadS CreateCrawlerResponse
Prelude.Read, Int -> CreateCrawlerResponse -> ShowS
[CreateCrawlerResponse] -> ShowS
CreateCrawlerResponse -> String
(Int -> CreateCrawlerResponse -> ShowS)
-> (CreateCrawlerResponse -> String)
-> ([CreateCrawlerResponse] -> ShowS)
-> Show CreateCrawlerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCrawlerResponse] -> ShowS
$cshowList :: [CreateCrawlerResponse] -> ShowS
show :: CreateCrawlerResponse -> String
$cshow :: CreateCrawlerResponse -> String
showsPrec :: Int -> CreateCrawlerResponse -> ShowS
$cshowsPrec :: Int -> CreateCrawlerResponse -> ShowS
Prelude.Show, (forall x. CreateCrawlerResponse -> Rep CreateCrawlerResponse x)
-> (forall x. Rep CreateCrawlerResponse x -> CreateCrawlerResponse)
-> Generic CreateCrawlerResponse
forall x. Rep CreateCrawlerResponse x -> CreateCrawlerResponse
forall x. CreateCrawlerResponse -> Rep CreateCrawlerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCrawlerResponse x -> CreateCrawlerResponse
$cfrom :: forall x. CreateCrawlerResponse -> Rep CreateCrawlerResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCrawlerResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'createCrawlerResponse_httpStatus' - The response's http status code.
newCreateCrawlerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCrawlerResponse
newCreateCrawlerResponse :: Int -> CreateCrawlerResponse
newCreateCrawlerResponse Int
pHttpStatus_ =
  CreateCrawlerResponse' :: Int -> CreateCrawlerResponse
CreateCrawlerResponse' {$sel:httpStatus:CreateCrawlerResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
createCrawlerResponse_httpStatus :: Lens.Lens' CreateCrawlerResponse Prelude.Int
createCrawlerResponse_httpStatus :: (Int -> f Int) -> CreateCrawlerResponse -> f CreateCrawlerResponse
createCrawlerResponse_httpStatus = (CreateCrawlerResponse -> Int)
-> (CreateCrawlerResponse -> Int -> CreateCrawlerResponse)
-> Lens CreateCrawlerResponse CreateCrawlerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrawlerResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCrawlerResponse' :: CreateCrawlerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCrawlerResponse
s@CreateCrawlerResponse' {} Int
a -> CreateCrawlerResponse
s {$sel:httpStatus:CreateCrawlerResponse' :: Int
httpStatus = Int
a} :: CreateCrawlerResponse)

instance Prelude.NFData CreateCrawlerResponse