- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Sends a command to a device.
    description: Sends a command to a device.
    examples: |
     To send a simple command to a device in 'my-registry' and region 'us-central1' using a special command subfolder, run:

       $ {command} --region=us-central1 --registry=my-registry --device=my-device --command-data="restart job" --subfolder="/jobs/metric_collector"

     To send a command containing special characters to a device in 'my-registry' and region 'us-central1', run:

       $ {command} --region=us-central1 --registry=my-registry --device=my-device --command-file=/path/to/command.file

  request:
    collection: cloudiot.projects.locations.registries.devices
    method: sendCommandToDevice

  arguments:
    params:
    - arg_name: subfolder
      api_field: sendCommandToDeviceRequest.subfolder
      required: false
      help_text: |
        The commands subfolder to append to the topic path.

        This field must not have more than 256 characters, and must not
        contain any MQTT wildcards ("+" or "#") or null characters.
    - group:
        mutex: true
        required: true
        params:
        - arg_name: command-file
          api_field: sendCommandToDeviceRequest.binaryData
          processor: googlecloudsdk.command_lib.iot.util:GetCommandFromFileProcessor
          help_text: |
            Path to a local file containing the data for this command.
        - arg_name: command-data
          api_field: sendCommandToDeviceRequest.binaryData
          help_text: |
            The data for this command, as a string. For any values that
            contain special characters (in the context of your shell), use the
            `--command-file` flag instead.

    resource:
      help_text: The device you want to send commands to.
      spec: !REF googlecloudsdk.command_lib.iot.resources:device
      is_positional: false
