@resources.command(<EOL>use_fields_as_options=(<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>)<EOL>)<EOL><INDENT>@click.option('<STR_LIT>', is_flag=True, default=False,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', is_flag=True, default=False,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', required=False, type=int,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>def launch(self, monitor=False, wait=False, timeout=None, **kwargs):<DEDENT>
<EOL>r = client.get('<STR_LIT:/>')<EOL>if '<STR_LIT>' not in r.json():<EOL><INDENT>raise exc.TowerCLIError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>self._pop_none(kwargs)<EOL>debug.log('<STR_LIT>', header='<STR_LIT>')<EOL>result = client.post(self.endpoint, data=kwargs)<EOL>command = result.json()<EOL>command_id = command['<STR_LIT:id>']<EOL>if monitor:<EOL><INDENT>return self.monitor(command_id, timeout=timeout)<EOL><DEDENT>elif wait:<EOL><INDENT>return self.wait(command_id, timeout=timeout)<EOL><DEDENT>answer = OrderedDict((<EOL>('<STR_LIT>', True),<EOL>('<STR_LIT:id>', command_id),<EOL>))<EOL>answer.update(result.json())<EOL>return answer<EOL>
Launch a new ad-hoc command.

        Runs a user-defined command from Ansible Tower, immediately starts it,
        and returns back an ID in order for its status to be monitored.

        =====API DOCS=====
        Launch a new ad-hoc command.

        :param monitor: Flag that if set, immediately calls ``monitor`` on the newly launched command rather
                        than exiting with a success.
        :type monitor: bool
        :param wait: Flag that if set, monitor the status of the job, but do not print while job is in progress.
        :type wait: bool
        :param timeout: If provided with ``monitor`` flag set, this attempt will time out after the given number
                        of seconds.
        :type timeout: int
        :param `**kwargs`: Fields needed to create and launch an ad hoc command.
        :returns: Result of subsequent ``monitor`` call if ``monitor`` flag is on; Result of subsequent ``wait``
                  call if ``wait`` flag is on; dictionary of "id" and "changed" if none of the two flags are on.
        :rtype: dict
        :raises tower_cli.exceptions.TowerCLIError: When ad hoc commands are not available in Tower backend.

        =====API DOCS=====