- release_tracks: [ALPHA, BETA, GA]
  help_text:
    brief:  |
      Export metadata from a Dataproc Metastore service to Google Cloud Storage.
    description: |
      Export metadata from a Dataproc Metastore service to Google Cloud Storage.

      If run asynchronously with `--async`, exits after printing
      the operation name that can be used to poll the status of the
      export via:

        {top_command} metastore operations describe
    examples: |
        To export metadata from a Dataproc Metastore service with the name `my-metastore-service`
        in location `us-central1` to the destination folder `gs://my-bucket/destination-folder`, run:

          $ {command} my-metastore-service --location=us-central1 --destination-folder=gs://my-bucket/destination-folder

  request:
    method: exportMetadata
    ALPHA:
      api_version: v1alpha
    BETA:
      api_version: v1beta
    GA:
      api_version: v1
    collection: metastore.projects.locations.services

  arguments:
    resource:
      help_text: |
        Arguments and flags that specify the Dataproc Metastore service
        you want to export.
      spec: !REF googlecloudsdk.command_lib.metastore.resources:service
    params:
    - arg_name: dump-type
      api_field: exportMetadataRequest.databaseDumpType
      help_text: |
        The type of the database dump. If unspecified, defaults to `mysql`.
      choices:
      - arg_value: mysql
        enum_value: MYSQL
        help_text: |
          Database dump is a MYSQL dump file.
      - arg_value: avro
        enum_value: AVRO
        help_text: |
          Database dump contains AVRO files.
      default: mysql
    - arg_name: destination-folder
      api_field: exportMetadataRequest.destinationGcsFolder
      required: true
      processor: googlecloudsdk.command_lib.metastore.validators:ValidateGcsUri:arg_name=--destination-folder
      help_text: |
        A Cloud Storage URI of a folder that metadata is exported to, in the format
        `gs://<bucket_name>/<path_inside_bukcet>`. A sub-folder containing
        exported files will be created below it.

  async:
    collection: metastore.projects.locations.operations
