Information

This site will undergo a brief period of maintenance on Friday, 18 December at 12:30 AM Central/12:00 PM IST. During a 30 minute window, site availability may be intermittent.

SFTP adapter request and response for a ls command


To configure an adapter request to communicate with a host that is not defined in the adapter configuration, you can designate a dynamic target by assigning values for the required configuration elements. These elements work as a set. You cannot retrieve partial information from the configuration node.

You can omit the <targets> block from the adapter request. In the absence of a <targets> block, the default target from the adapter configuration is used.

When you use a context item as an input for an adapter request, you must enclose the adapter request in <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <adapterName-adapter-request> element.

BMC recommends that you do not include empty elements in the adapter request because they might cause errors.

The following table describes the elements of an SFTP adapter request with an ls command:

 Elements of an SFTP adapter request with an ls command

The following figure shows an XML sample of the adapter request for the SFTP adapter with the ls command.

XML template of the SFTP adapter request with ls command


<sftp-request>
  <targets>
    <target name=""/>
    <target>
      <host></host>
      <port></port>
      <user-name></user-name>
      <password encryption-type=""></password>
      <timeout-secs></timeout-secs>
      <known-hosts-config></known-hosts-config>
      <allow-unknown-hosts></allow-unknown-hosts>
      <preferred-pk-algorithm></preferred-pk-algorithm>
      <establish-connection-timeout-secs></establish-connection-timeout-secs>
      <network-environment></network-environment>
      <character-set></character-set>
    </target>
    </targets>
  <commands>
    <ls></ls>
  </commands>
</sftp-request>

The following figure shows an XML sample of the adapter request for the SFTP adapter with the ls command. In this sample, the first target references the adapter configuration and the second target is a dynamic target.

XML sample of the SFTP adapter request with ls command


<sftp-request>
  <targets>
    <target name="host1"/>
    <target>
      <host>server1</host>
      <port>2200</port>
      <user-name>user</user-name>
      <password encryption-type="Plain">test</password>
      <timeout-secs>90</timeout-secs>
      <known-hosts-config>/path/to/known_hosts</known-hosts-config>
      <allow-unknown-hosts>false</allow-unknown-hosts>
      <preferred-pk-algorithm>ssh-dss</preferred-pk-algorithm>
      <establish-connection-timeout-secs>90</establish-connection-timeout-secs>
      <network-environment>true</network-environment>
      <character-set>Shift_JIS</character-set>
    </target>
    </targets>
  <commands>
    <ls>/tmp</ls>
  </commands>
</sftp-request>

The ls command request for a SFTP adapter returns an adapter response containing the details about the files in the specified directory.

The following table describes the elements of an SFTP adapter response to a request with ls command:

 Elements of an SFTP adapter response to a request with Is command

The following figure illustrates the adapter response for the SFTP adapter with the ls command.

XML sample of the SFTP adapter response with ls command


<sftp-command-output>
  <request-metadata>
    <status>success</status>
    <error>Present only with status of 'error'</error>
  </request-metadata>
    <targets-output>
      <target-output host="server1">
      <target-metadata>
        <status>success</status>
        <error>Present only with status of 'error'</error>
      </target-metadata>
    <commands-output>
    <command-output>
      <metadata>
        <id>1</id>
        <command>ls</command>
        <execution-milliseconds>value</execution-milliseconds>
        <status>success</status>
        <error>Present only with status of 'error'</error>
      </metadata>
     <output>
       <file>
         <filename>Sample File1</name>
         <mask>0644</mask>
         <modification-time>Jan 01 01:00</modification-time>
         <permissions>-rw-r--r--</permissions>
         <gid>1</gid>
         <uid>106</uid>
       </file>
       <file>
         <filename>Sample File2</name>
         <mask>0600</mask>
         <modification-time>Jan 01 02:00</modification-time>
         <permissions>-rw-------</permissions>
         <gid>1</gid>
         <uid>106</uid>
       </file>
     </output>
    </command-output>
    </commands-output>
  </target-output>
  </targets-output>
</sftp-command-output>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

(archive) BMC Atrium Orchestrator Base Adapters 20.12.02