SFTP adapter request and response for a chmod 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.

The following table describes the elements of an SFTP adapter request with the chmod command.

Elements of an SFTP adapter request with chmod command

Element

Description

Required

<targets>

Contains the <target> elements

Conditional; required if a target is referenced or defined in the request

<target>

Contains a name attribute that references a configuration node from the adapter configuration, or contains the elements that define a dynamic target computer

The default target in the adapter configuration is used.

Conditional; required if a target is referenced or defined in the request

<host>

Specifies the host name or the IP address of the remote host

Conditional; required when defining a dynamic target computer

<port>

Specifies the port on which the remote host listens

This element applies to a dynamic target.

Default value: 22

Conditional

<user-name>

Specifies the user name to be used for remote host authentication

This element applies to a dynamic target computer.

Conditional; required when defining a dynamic target

<password>

Specifies the password that corresponds to the <user-name> provided

This element applies to a dynamic target computer. The <private-key-file> element is used if you do not provide the <password> element.

The <password> element can contain an encryption-type attribute.

Conditional

<encryption-type>

Indicates whether the password specified is encrypted; is an attribute of the <password> element, not an element itself

Valid values: Base64, Plain (default)

No

<timeout-secs>

Specifies the time, in seconds, to wait for the expected prompt to be returned

If the expected prompt is not returned before the specified period has elapsed, an error message is returned.

Default value: 60 seconds

No

<known-hosts-config>

Identifies the path to the local known_hosts file

This file is used when performing key verification. This element applies to a dynamic target computer.

Default value: homeDdir/.ssh/known_hosts

Conditional

<allow-unknown-hosts>

Determines whether a connection must continue if key verification fails

This element applies to a dynamic target computer.

Valid values: true (default), false

Note: With a value of true, the connection is maintained when connecting to an unknown or mismatched system. Else, the connection is dropped and the adapter response returns an error.

Conditional

<preferred-pk-algorithm>

Specifies the preference of the algorithm used to encrypt the public key

This element applies to a dynamic target computer.

Valid values: ssh-dss, ssh-rsa (default)

Conditional

<establish-connection-timeout-secs>

Specifies the time, in seconds, to wait for user authentication on the target server

If the authentication is not successful within this time, an error message is returned.

Default value: 60 seconds

No

<network-environment>

Creates an extra channel session for use with Oracle Solaris 9

This value must be false when connecting to network appliances.

Valid values: true, false (default)

No

<commands>

Contains the SFTP command and supporting elements

Yes

<chmod>

Indicates whether the file's permissions is changed

It also contains the elements defining the file and its new permissions.

Yes

<file>

Specifies the remote file path, including the file name

The permissions on this file is changed.

Yes

<permissions>

Specifies the permission assigned to the specified file

Yes

<character-set>

Specifies the supporting CharSet

CharSet is also called Character set that are identifiers describing a series of universal characters

No

The following figure shows an XML template of the adapter request for the SFTP adapter with the chmod command.

XML template of the SFTP adapter request with chmod 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>
     <chmod>
       <file></file>
       <permissions></permissions>
     </chmod>
   </commands>
</sftp-request>


The following figure shows an XML sample of the adapter request for the SFTP adapter with chmod 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 chmod 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>
     <chmod>
       <file>/path/to/file/filename</file>
       <permissions>0777</permissions>
     </chmod>
   </commands>
</sftp-request>


The chmod command request for the SFTP adapter returns an adapter response that contains the summary information for the command. The following figure shows an XML sample of the adapter request for the SFTP adapter with the chmod command.

XML sample of the SFTP adapter response with chmod 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>chmod</command>
         <execution-milliseconds>value</execution-milliseconds>
         <status>success</status>
         <error>Present only with status of 'error'</error>
        </metadata>
     <output/>
     </command-output>
     </commands-output>
   </target-output>
   </targets-output>
</sftp-command-output>
<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>chmod</command>
         <execution-milliseconds>value</execution-milliseconds>
         <status>success</status>
         <error>Present only with status of 'error'</error>
        </metadata>
     <output/>
     </command-output>
     </commands-output>
   </target-output>
   </targets-output>
</sftp-command-output>


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

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

Element

Description

<request-metadata>

Contains the request level summary information

<status>

Indicates the status of the request

Valid values: success, error

<error>

Indicates the error message returned when the value of the <status> element is error

When the value of the <status> element is success, this element is absent.

<targets-output>

Contains the command output for all the targets

<target-output>

Contains the command output for a specific target

The host attribute provides the host name or the IP address of the target.

<target-metadata>

Contains the target level summary information

<status>

Indicates the status of the target connection

Valid values: success, error

<error>

Contains the error message if a target level error occurs

When the value of the <status> element is success, this element is absent.

<commands-output>

Contains the command responses for all the commands executed on the target computer

<command-output>

Contains the command response for a specific command

<metadata>

Contains the command summary information

<id>

Specifies the sequence in which the command is executed

<command>

Specifies the command executed

<execution-milliseconds>

Specifies the duration of the command execution, in milliseconds

<status>

Indicates the status of the command execution

Valid values: success, error

<error>

Contains the error message if the execution of a command is interrupted When the value of the <status> element is success, this element is absent.

<output>

Contains the lines that result from the command

This command does not return a detailed response.

Was this page helpful? Yes No Submitting... Thank you

Comments