1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/examples/SFTP/DeleteFile.txt

50 lines
1.4 KiB
Plaintext
Raw Normal View History

2025-10-21 11:36:43 +03:00
 Host = "172.33.0.13";
Port = "2222";
2025-09-25 22:19:13 +03:00
UseProxy = True;
ProxySettings = Undefined;
AuthorizationType = "By login and password";
If AuthorizationType = "By login and password" Then
2025-10-21 11:36:43 +03:00
Login = "bayselonarrend";
Password = "12we...";
2025-09-25 22:19:13 +03:00
2025-10-05 19:19:32 +03:00
SFTPSettings = OPI_SFTP.GetSettingsLoginPassword(Host, Port, Login, Password);
2025-09-25 22:19:13 +03:00
ElsIf AuthorizationType = "By key" Then
2025-10-21 11:36:43 +03:00
Login = "bayselonarrend";
2025-09-25 22:19:13 +03:00
PrivateKey = "./ssh_key";
PublicKey = "./ssh_key.pub";
2025-10-05 19:19:32 +03:00
SFTPSettings = OPI_SFTP.GetSettingsPrivateKey(Host, Port, Login, PrivateKey, PublicKey);
2025-09-25 22:19:13 +03:00
Else
2025-10-21 11:36:43 +03:00
Login = "bayselonarrend";
2025-10-05 19:19:32 +03:00
SFTPSettings = OPI_SFTP.GetSettingsViaAgent(Host, Port, Login);
2025-09-25 22:19:13 +03:00
EndIf;
If UseProxy Then
2025-10-21 11:36:43 +03:00
ProxyType = "http"; // http, socks5, socks4
2025-09-25 22:19:13 +03:00
2025-10-21 11:36:43 +03:00
ProxyAddress = "127.0.0.1";
ProxyPort = "8071";
ProxyLogin = "proxyuser";
ProxyPassword = "12we...";
2025-09-25 22:19:13 +03:00
ProxySettings = OPI_SFTP.GetProxySettings(ProxyAddress, ProxyPort, ProxyType, ProxyLogin, ProxyPassword);
EndIf;
2025-10-05 19:19:32 +03:00
Connection = OPI_SFTP.CreateConnection(SFTPSettings, ProxySettings);
2025-09-25 22:19:13 +03:00
If OPI_SFTP.IsConnector(Connection) Then
Result = OPI_SFTP.DeleteFile(Connection, "files_folder/pic_from_binary.png");
Else
Result = Connection; // Error of connection
EndIf;