help_text:
  brief: Creates a backup of a Cloud Bigtable table.
  description: Creates a backup of a Cloud Bigtable table.
  examples: |
    To create a backup 'BACKUP_NAME' asyncronously from table 'TABLE_NAME' which expires at
    '2019-03-30T10:49:41Z', run:

      $ {command} BACKUP_NAME --instance=INSTANCE_NAME --cluster=CLUSTER_NAME
      --table=TABLE_NAME --expiration-date=2019-03-30T10:49:41Z --async

    To create a backup 'BACKUP_NAME' syncronously from table 'TABLE_NAME' which expires in 2 weeks
    from now, run:

      $ {command} BACKUP_NAME --instance=INSTANCE_NAME --cluster=CLUSTER_NAME
      --table=TABLE_NAME --retention-period=2w

request:
  collection: bigtableadmin.projects.instances.clusters.backups
  modify_request_hooks:
  - googlecloudsdk.api_lib.bigtable.backups:ModifyCreateRequest
arguments:
  params:
  - api_field: backup.sourceTable
    arg_name: table
    required: true
    help_text: ID of the table from which the backup will be created.
  - group:
      mutex: true
      required: true
      params:
      - arg_name: expiration-date
        api_field: backup.expireTime
        help_text: |
          Absolute expiration time of the backup, must be at least 6 hours and at most 30 days from
          the time the request is received. See `$ gcloud topic datetimes` for information on
          date/time formats.
      - arg_name: retention-period
        api_field: backup.expireTime
        help_text: |
          Retention period of the backup relative from now, must be at least 6 hours and at most 30
          days. See `$ gcloud topic datetimes` for information on duration formats.
  resource:
    help_text: The Cloud Bigtable backup to create.
    spec: !REF googlecloudsdk.command_lib.bigtable.resources:backup

async:
  collection: bigtableadmin.operations
