- release_tracks: [ALPHA]
  help_text:
    brief: Create a new Data Catalog crawler.
    description: Create a new Data Catalog crawler.
    examples: |
      Create a project-scoped crawler:

        $ {command} crawler1 \
            --run-option=MANUAL --display-name=my-crawler --crawl-scope=PROJECT

      Create a bucket-scoped crawler that runs weekly:

        $ {command} crawler1 \
            --display-name=my-crawler --crawl-scope=BUCKET \
            --buckets="gs://bucket1,gs://bucket2,gs://bucket3" \
            --run-option=SCHEDULED --run-schedule=WEEKLY

  request:
    collection: datacatalog.projects.crawlers
    api_version: v1alpha3
    modify_request_hooks:
    - googlecloudsdk.command_lib.data_catalog.crawlers.util:ValidateScopeFlagsForCreate
    - googlecloudsdk.command_lib.data_catalog.crawlers.util:ValidateSchedulingFlagsForCreate
    - googlecloudsdk.command_lib.data_catalog.crawlers.util:ParseScopeFlagsForCreate
    - googlecloudsdk.command_lib.data_catalog.crawlers.util:ParseSchedulingFlagsForCreate

  arguments:
    resource:
      help_text: The crawler to create.
      spec: !REF googlecloudsdk.command_lib.data_catalog.resources:crawler

    params:
    - !REF googlecloudsdk.command_lib.data_catalog.crawlers.flags:crawler.description
    - !REF googlecloudsdk.command_lib.data_catalog.crawlers.flags:crawler.display_name
    - !REF googlecloudsdk.command_lib.data_catalog.crawlers.flags:crawler.bundle_specs

    additional_arguments_hook: |-
      googlecloudsdk.command_lib.data_catalog.crawlers.flags:AddCrawlerScopeAndSchedulingFlagsForCreate
