1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-27 02:43:54 +02:00

Main build (Jenkins)

This commit is contained in:
Vitaly the Alpaca (bot) 2024-11-28 17:38:15 +03:00
parent d591294db4
commit bd0cd10443
50 changed files with 6170 additions and 5509 deletions

View File

@ -1731,6 +1731,10 @@ def test_s3(){
powershell encoding: 'UTF-8', script:'./oint.exe s3 ListObjectVersions --bucket "test" --basic "test" --prefix "test" --ver "test" --headers "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe s3 GetObjectDownloadLink --name "test" --bucket "test" --basic "test" --expires "test" --headers "test" --debug --test '
}
}

View File

@ -1731,6 +1731,10 @@ def test_s3(){
powershell encoding: 'UTF-8', script:'./oint.exe s3 ПолучитьСписокВерсийОбъектов --bucket "test" --basic "test" --prefix "test" --ver "test" --headers "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe s3 ПолучитьСсылкуСкачиванияОбъекта --name "test" --bucket "test" --basic "test" --expires "test" --headers "test" --debug --test '
}
}

View File

@ -0,0 +1,5 @@
{
"URL": "storage-155.s3hoster.by",
"AccessKey": "BRN5RKJE67...",
"SecretKey": "NNhv+i9PrytpT8Tu0C1N..."
}

View File

@ -0,0 +1,11 @@
 URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "picture.jpg";
Bucket = "opi-gpbucket3";
Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200);

View File

@ -0,0 +1,51 @@
---
sidebar_position: 16
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get object download link
Get presigned link for object retrieving without authorization
`Function GetObjectDownloadLink(Val Name, Val Bucket, Val BasicData, Val Expire = 3600, Val Headers = Undefined) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Name | --name | String | ✔ | Name of the object in the bucket |
| Bucket | --bucket | String | ✔ | Name of the bucket to put the object |
| BasicData | --basic | Structure of KeyAndValue | ✔ | Basic request data. See GetBasicDataStructure |
| Expire | --expires | String, Number | ✖ | Link lifetime in seconds. 604800 max. |
| Headers | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
Returns: String - URL for object retrieving
<br/>
:::tip
Process at AWS documentation: [Download and upload objects with presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "picture.jpg";
Bucket = "opi-gpbucket3";
Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200);
```

View File

@ -0,0 +1,5 @@
{
"URL": "storage-155.s3hoster.by",
"AccessKey": "BRN5RKJE67...",
"SecretKey": "NNhv+i9PrytpT8Tu0C1N..."
}

View File

@ -0,0 +1,11 @@
 URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
ОсновныеДанные = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Наименование = "picture.jpg";
Бакет = "opi-gpbucket3";
Результат = OPI_S3.ПолучитьСсылкуСкачиванияОбъекта(Наименование, Бакет, ОсновныеДанные, 7200);

View File

@ -0,0 +1,51 @@
---
sidebar_position: 16
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Получить ссылку скачивания объекта
Получает прямую ссылку для скачивания объекта без дополнительной авторизации
`Функция ПолучитьСсылкуСкачиванияОбъекта(Знач Наименование, Знач Бакет, Знач ОсновныеДанные, Знач ВремяЖизни = 3600, Знач Заголовки = Неопределено) Экспорт`
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|-|-|-|-|-|
| Наименование | --name | Строка | &#x2714; | Наименование объекта в бакете |
| Бакет | --bucket | Строка | &#x2714; | Имя бакета для загрузки объекта |
| ОсновныеДанные | --basic | Структура Из КлючИЗначение | &#x2714; | Основные данные запроса. См. ПолучитьСтруктуруДанных |
| ВремяЖизни | --expires | Строка, Число | &#x2716; | Время жизни ссылки в секундах. 604800 максимум |
| Заголовки | --headers | Соответствие Из КлючИЗначение | &#x2716; | Дополнительные заголовки запроса, если необходимо |
Возвращаемое значение: Строка - URL для получения объекта
<br/>
:::tip
О механизме в документации AWS: [Download and upload objects with presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
:::
<br/>
```bsl title="Пример использования для 1С:Предприятие/OneScript"
URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
ОсновныеДанные = OPI_S3.ПолучитьСтруктуруДанных(URL, AccessKey, SecretKey, Region);
Наименование = "picture.jpg";
Бакет = "opi-gpbucket3";
Результат = OPI_S3.ПолучитьСсылкуСкачиванияОбъекта(Наименование, Бакет, ОсновныеДанные, 7200);
```

File diff suppressed because it is too large Load Diff

View File

@ -1168,6 +1168,39 @@ Function ListObjectVersions(Val Bucket
EndFunction
// Get object download link
// Get presigned link for object retrieving without authorization
//
// Note
// Process at AWS documentation: [Download and upload objects with presigned URLs](@docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
//
// Parameters:
// Name - String - Name of the object in the bucket - name
// Bucket - String - Name of the bucket to put the object - bucket
// BasicData - Structure of KeyAndValue - Basic request data. See GetBasicDataStructure - basic
// Expire - String, Number - Link lifetime in seconds. 604800 max. - expires
// Headers - Map Of KeyAndValue - Additional request headers, if necessary - headers
//
// Returns:
// String - URL for object retrieving
Function GetObjectDownloadLink(Val Name
, Val Bucket
, Val BasicData
, Val Expire = 3600
, Val Headers = Undefined) Export
BasicData_ = OPI_Tools.CopyCollection(BasicData);
CheckBasicData(BasicData_);
FillObjectURL(BasicData_, Name, Bucket);
Signature = CreateURLSignature(BasicData_, Name, "GET", Expire, Headers);
URL = BasicData_["URL"] + Signature;
Return URL;
EndFunction
#EndRegion
#EndRegion
@ -1179,15 +1212,98 @@ EndFunction
Function CreateAuthorizationHeader(Val DataStructure, Val Request, Val Connection, Val Method)
AccessKey = DataStructure["AccessKey"];
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
CurrentDate = CurrentUniversalDate();
Request.Headers.Insert("x-amz-date", OPI_Tools.ISOTimestamp(CurrentDate));
Request.Headers.Insert("Host" , Connection.Host);
MainParts = GetMainSignatureParts(DataStructure, Request, Connection, Method, CurrentDate);
Scope = MainParts["Scope"];
Signature = MainParts["Signature"];
HeadersKeys = MainParts["HeadersKeys"];
AuthorizationHeader = FormAuthorisationHeader(AccessKey, Scope, Signature, HeadersKeys);
Return AuthorizationHeader;
EndFunction
Function CreateURLSignature(Val DataStructure, Val Name, Val Method, Val Expire, Val Headers)
AccessKey = DataStructure["AccessKey"];
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
URL = DataStructure["URL"];
SplitedURL = OPI_Tools.SplitURL(URL);
Host = SplitedURL["Host"];
Address = SplitedURL["Address"];
AdditionalHeaders = New Structure("Host", Host);
AddAdditionalHeaders(Headers, AdditionalHeaders);
CurrentDate = CurrentUniversalDate();
SignKey = GetSignatureKey(SecretKey, Region, Service, CurrentDate);
Scope = CreateScope(Region, Service, CurrentDate);
Timestamp = OPI_Tools.ISOTimestamp(CurrentDate);
HeadersKeys = GetHeadersKeysString(Headers);
Base = EncodeString(AccessKey + "/" + Scope, StringEncodingMethod.URLencoding);
HeadersString = GetHeadersString(Headers);
HashString = "UNSIGNED-PAYLOAD";
URLParameters = New ValueTable;
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Algorithm" , "AWS4-HMAC-SHA256");
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Credential" , Base);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Date" , Timestamp);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Expires" , Expire);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-SignedHeaders", HeadersKeys);
ParametersString = OPI_Tools.RequestParametersToString(URLParameters);
ParametersString = Right(ParametersString, StrLen(ParametersString) - 1);
RequestTemplate = "";
For N = 1 To 6 Do
RequestTemplate = RequestTemplate + "%" + String(N) + ?(N = 6, "", Chars.LF);
EndDo;
CanonicalRequest = StrTemplate(RequestTemplate
, Method
, Address
, ParametersString
, HeadersString
, HeadersKeys
, HashString);
StringToSign = CreateSignatureString(CanonicalRequest, Scope, CurrentDate);
Signature = OPI_Cryptography.HMACSHA256(SignKey, StringToSign);
Signature = Lower(ПолучитьHexСтрокуИзДвоичныхДанных(Signature));
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Signature", Signature);
URLSign = OPI_Tools.RequestParametersToString(URLParameters);
Return URLSign;
EndFunction
Function GetMainSignatureParts(Val DataStructure
, Val Request
, Val Connection
, Val Method
, Val CurrentDate)
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
SignKey = GetSignatureKey(SecretKey, Region, Service, CurrentDate);
CanonicalRequest = CreateCanonicalRequest(Request, Connection, Method);
Scope = CreateScope(Region, Service, CurrentDate);
@ -1196,10 +1312,15 @@ Function CreateAuthorizationHeader(Val DataStructure, Val Request, Val Connectio
Signature = OPI_Cryptography.HMACSHA256(SignKey, StringToSign);
Signature = Lower(ПолучитьHexСтрокуИзДвоичныхДанных(Signature));
HeadersKeys = GetHeadersKeysString(Request);
AuthorizationHeader = FormAuthorisationHeader(AccessKey, Scope, Signature, HeadersKeys);
HeadersKeys = GetHeadersKeysString(Request.Headers);
Return AuthorizationHeader;
PartsStructure = New Structure;
PartsStructure.Insert("Scope" , Scope);
PartsStructure.Insert("Signature" , Signature);
PartsStructure.Insert("HeadersKeys", HeadersKeys);
Return PartsStructure;
EndFunction
@ -1223,11 +1344,11 @@ EndFunction
Function CreateCanonicalRequest(Val Request, Val Connection, Val Method)
RequestTemplate = "";
RequestBody = OPI_Tools.GetRequestBody(Request);
HashSum = OPI_Cryptography.Hash(RequestBody, HashFunction.SHA256);
Request.Headers.Insert("x-amz-content-sha256", Lower(ПолучитьHexСтрокуИзДвоичныхДанных(HashSum)));
RequestTemplate = "";
Request.Headers.Insert("x-amz-content-sha256", Lower(ПолучитьHexСтрокуИзДвоичныхДанных(HashSum)));
For N = 1 To 6 Do
@ -1238,8 +1359,8 @@ Function CreateCanonicalRequest(Val Request, Val Connection, Val Method)
Method = Upper(Method);
URIString = GetURIString(Request);
ParameterString = GetParamsString(Request);
HeadersString = GetHeadersString(Request);
KeysString = GetHeadersKeysString(Request);
HeadersString = GetHeadersString(Request.Headers);
KeysString = GetHeadersKeysString(Request.Headers);
HashString = Lower(ПолучитьHexСтрокуИзДвоичныхДанных(HashSum));
@ -1330,10 +1451,9 @@ Function GetParamsString(Request)
EndFunction
Function GetHeadersString(Val Request)
Function GetHeadersString(Val Headers)
HeadersList = New ValueList;
Headers = Request.Headers;
For Each Title In Headers Do
@ -1358,10 +1478,9 @@ Function GetHeadersString(Val Request)
EndFunction
Function GetHeadersKeysString(Val Request)
Function GetHeadersKeysString(Val Headers)
HeadersList = New ValueList;
Headers = Request.Headers;
For Each Title In Headers Do

View File

@ -2162,6 +2162,7 @@ Procedure AWS_ObjectsManagement() Export
S3_ListObjects(TestParameters);
S3_ListObjectVersions(TestParameters);
S3_GetObject(TestParameters);
S3_GetObjectDownloadLink(TestParameters);
S3_DeleteObject(TestParameters);
S3_DeleteBucket(TestParameters);
@ -15567,6 +15568,35 @@ Procedure S3_AbortMultipartUpload(FunctionParameters)
EndProcedure
Procedure S3_GetObjectDownloadLink(FunctionParameters)
Image = FunctionParameters["Picture"]; // SKIP
OPI_TypeConversion.GetBinaryData(Image); // SKIP
RequiredSize = Image.Size(); // SKIP
URL = FunctionParameters["S3_URL"];
AccessKey = FunctionParameters["S3_AccessKey"];
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "picture.jpg";
Bucket = "opi-gpbucket3";
Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetObjectDownloadLink", "S3");
OPI_TestDataRetrieval.Check_String(Result);
Result = OPI_Tools.Get(Result);
OPI_TestDataRetrieval.Check_BinaryData(Result, RequiredSize);
EndProcedure
#EndRegion
#EndRegion

View File

@ -36,6 +36,7 @@
//@skip-check module-structure-top-region
//@skip-check module-structure-method-in-regions
//@skip-check wrong-string-literal-content
#Region Internal
#Region HTTPMethods
@ -190,20 +191,24 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
EndFunction
Function CreateConnection(Val Host, Val Safe = True, Val User = "", Val Password = "") Export
Function CreateConnection(Val Host, Val Safe = True, Val User = "", Val Password = "", Val Port = "") Export
If Not ValueIsFilled(Port) Then
Port = ?(Safe, 443, 80);
EndIf;
If Safe Then
If IsOneScript() Then
Connection = New HTTPConnection(Host, 443, User, Password, , 3000);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000);
Else
SSL = New OpenSSLSecureConnection;
Connection = New HTTPConnection(Host, 443, User, Password, , 3000, SSL);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000, SSL);
EndIf;
Else
Connection = New HTTPConnection(Host, 80, User, Password, , 3000, SSL);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000);
EndIf;
@ -227,8 +232,9 @@ Function ExecuteRequest(Val Request, Val Connection, Val View, Val ResponseFile
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Request.ResourceAddress = Address;
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
@ -344,7 +350,6 @@ Function SplitURL(Val URL) Export
URL = StrReplace(URL, "https://", "");
URL = StrReplace(URL, "http://" , "");
URL = StrReplace(URL, ":443" , "");
If StrFind(URL, "/") = 0 Then
Address = "";
@ -354,6 +359,20 @@ Function SplitURL(Val URL) Export
Host = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
EndIf;
If StrFind(Host, ":") <> 0 Then
ServerPort = StrSplit(Host, ":");
Host = ServerPort[0];
Port = ServerPort[1];
OPI_TypeConversion.GetNumber(Port);
Else
Port = ?(SecureConnection, 443, 80);
EndIf;
If IsOneScript() And SecureConnection Then
Host = "https://" + Host;
EndIf;
@ -362,6 +381,7 @@ Function SplitURL(Val URL) Export
ReturnStructure.Insert("Host" , Host);
ReturnStructure.Insert("Address" , Address);
ReturnStructure.Insert("Safe" , SecureConnection);
ReturnStructure.Insert("Port" , Port);
Return ReturnStructure;
@ -935,6 +955,41 @@ Procedure AddField(Val Name, Val Value, Val Type, Collection) Export
EndProcedure
Procedure AddKeyValue(Table, Val Key, Val Value) Export
KeyExist = False;
ValueExist = False;
For Each Coloumn In Table.Columns Do
If Coloumn.Name = "Key" Then
KeyExist = True;
ElsIf Coloumn.Name = "Value" Then
ValueExist = True;
Else
Continue;
EndIf;
EndDo;
If Not KeyExist Then
Table.Columns.Add("Key");
EndIf;
If Not ValueExist Then
Table.Columns.Add("Value");
EndIf;
NewValue = Table.Add();
NewValue.Key = Key;
NewValue.Value = Value;
EndProcedure
#EndRegion
#EndRegion
@ -952,9 +1007,10 @@ Function ExecuteRequestWithBody(Val URL, Val View, Val Parameters = "", Val Addi
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequestWithBody(Address, Parameters, AdditionalHeaders, JSON);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
Return Response;
@ -968,9 +1024,10 @@ Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val Additiona
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequest(Address, AdditionalHeaders, DataType);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
If Not Data.Size() = 0 Then
Request.SetBodyFromBinary(Data);
@ -993,9 +1050,10 @@ Function ExecuteRequestWithoutBody(Val URL, Val View, Val Parameters = "", Val A
Host = URLStructure["Host"];
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequest(Address, AdditionalHeaders);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
@ -1018,11 +1076,12 @@ Function ExecuteMultipartRequest(Val URL, Val View, Val Parameters = "", Val Fil
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
RequestBody = GetTempFileName();
Request = CreateMultipartRequest(Address, Parameters, Files, AdditionalHeaders, RequestBody, ContentType);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
Request = Undefined;
@ -1040,11 +1099,12 @@ Function ExecuteMultipartRelatedRequest(Val URL, Val View, Val JSON = "", Val Fi
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
RequestBody = GetTempFileName();
Request = CreateMultipartRelatedRequest(Address, Files, JSON, AdditionalHeaders, RequestBody);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);

View File

@ -1168,6 +1168,39 @@ Function ListObjectVersions(Val Bucket
EndFunction
// Get object download link
// Get presigned link for object retrieving without authorization
//
// Note
// Process at AWS documentation: [Download and upload objects with presigned URLs](@docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
//
// Parameters:
// Name - String - Name of the object in the bucket - name
// Bucket - String - Name of the bucket to put the object - bucket
// BasicData - Structure of KeyAndValue - Basic request data. See GetBasicDataStructure - basic
// Expire - String, Number - Link lifetime in seconds. 604800 max. - expires
// Headers - Map Of KeyAndValue - Additional request headers, if necessary - headers
//
// Returns:
// String - URL for object retrieving
Function GetObjectDownloadLink(Val Name
, Val Bucket
, Val BasicData
, Val Expire = 3600
, Val Headers = Undefined) Export
BasicData_ = OPI_Tools.CopyCollection(BasicData);
CheckBasicData(BasicData_);
FillObjectURL(BasicData_, Name, Bucket);
Signature = CreateURLSignature(BasicData_, Name, "GET", Expire, Headers);
URL = BasicData_["URL"] + Signature;
Return URL;
EndFunction
#EndRegion
#EndRegion
@ -1179,15 +1212,98 @@ EndFunction
Function CreateAuthorizationHeader(Val DataStructure, Val Request, Val Connection, Val Method)
AccessKey = DataStructure["AccessKey"];
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
CurrentDate = CurrentUniversalDate();
Request.Headers.Insert("x-amz-date", OPI_Tools.ISOTimestamp(CurrentDate));
Request.Headers.Insert("Host" , Connection.Host);
MainParts = GetMainSignatureParts(DataStructure, Request, Connection, Method, CurrentDate);
Scope = MainParts["Scope"];
Signature = MainParts["Signature"];
HeadersKeys = MainParts["HeadersKeys"];
AuthorizationHeader = FormAuthorisationHeader(AccessKey, Scope, Signature, HeadersKeys);
Return AuthorizationHeader;
EndFunction
Function CreateURLSignature(Val DataStructure, Val Name, Val Method, Val Expire, Val Headers)
AccessKey = DataStructure["AccessKey"];
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
URL = DataStructure["URL"];
SplitedURL = OPI_Tools.SplitURL(URL);
Host = SplitedURL["Host"];
Address = SplitedURL["Address"];
AdditionalHeaders = New Structure("Host", Host);
AddAdditionalHeaders(Headers, AdditionalHeaders);
CurrentDate = CurrentUniversalDate();
SignKey = GetSignatureKey(SecretKey, Region, Service, CurrentDate);
Scope = CreateScope(Region, Service, CurrentDate);
Timestamp = OPI_Tools.ISOTimestamp(CurrentDate);
HeadersKeys = GetHeadersKeysString(Headers);
Base = EncodeString(AccessKey + "/" + Scope, StringEncodingMethod.URLencoding);
HeadersString = GetHeadersString(Headers);
HashString = "UNSIGNED-PAYLOAD";
URLParameters = New ValueTable;
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Algorithm" , "AWS4-HMAC-SHA256");
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Credential" , Base);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Date" , Timestamp);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Expires" , Expire);
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-SignedHeaders", HeadersKeys);
ParametersString = OPI_Tools.RequestParametersToString(URLParameters);
ParametersString = Right(ParametersString, StrLen(ParametersString) - 1);
RequestTemplate = "";
For N = 1 To 6 Do
RequestTemplate = RequestTemplate + "%" + String(N) + ?(N = 6, "", Chars.LF);
EndDo;
CanonicalRequest = StrTemplate(RequestTemplate
, Method
, Address
, ParametersString
, HeadersString
, HeadersKeys
, HashString);
StringToSign = CreateSignatureString(CanonicalRequest, Scope, CurrentDate);
Signature = OPI_Cryptography.HMACSHA256(SignKey, StringToSign);
Signature = Lower(GetHexStringFromBinaryData(Signature));
OPI_Tools.AddKeyValue(URLParameters, "X-Amz-Signature", Signature);
URLSign = OPI_Tools.RequestParametersToString(URLParameters);
Return URLSign;
EndFunction
Function GetMainSignatureParts(Val DataStructure
, Val Request
, Val Connection
, Val Method
, Val CurrentDate)
SecretKey = DataStructure["SecretKey"];
Region = DataStructure["Region"];
Service = DataStructure["Service"];
SignKey = GetSignatureKey(SecretKey, Region, Service, CurrentDate);
CanonicalRequest = CreateCanonicalRequest(Request, Connection, Method);
Scope = CreateScope(Region, Service, CurrentDate);
@ -1196,10 +1312,15 @@ Function CreateAuthorizationHeader(Val DataStructure, Val Request, Val Connectio
Signature = OPI_Cryptography.HMACSHA256(SignKey, StringToSign);
Signature = Lower(GetHexStringFromBinaryData(Signature));
HeadersKeys = GetHeadersKeysString(Request);
AuthorizationHeader = FormAuthorisationHeader(AccessKey, Scope, Signature, HeadersKeys);
HeadersKeys = GetHeadersKeysString(Request.Headers);
Return AuthorizationHeader;
PartsStructure = New Structure;
PartsStructure.Insert("Scope" , Scope);
PartsStructure.Insert("Signature" , Signature);
PartsStructure.Insert("HeadersKeys", HeadersKeys);
Return PartsStructure;
EndFunction
@ -1223,11 +1344,11 @@ EndFunction
Function CreateCanonicalRequest(Val Request, Val Connection, Val Method)
RequestTemplate = "";
RequestBody = OPI_Tools.GetRequestBody(Request);
HashSum = OPI_Cryptography.Hash(RequestBody, HashFunction.SHA256);
Request.Headers.Insert("x-amz-content-sha256", Lower(GetHexStringFromBinaryData(HashSum)));
RequestTemplate = "";
Request.Headers.Insert("x-amz-content-sha256", Lower(GetHexStringFromBinaryData(HashSum)));
For N = 1 To 6 Do
@ -1238,8 +1359,8 @@ Function CreateCanonicalRequest(Val Request, Val Connection, Val Method)
Method = Upper(Method);
URIString = GetURIString(Request);
ParameterString = GetParamsString(Request);
HeadersString = GetHeadersString(Request);
KeysString = GetHeadersKeysString(Request);
HeadersString = GetHeadersString(Request.Headers);
KeysString = GetHeadersKeysString(Request.Headers);
HashString = Lower(GetHexStringFromBinaryData(HashSum));
@ -1330,10 +1451,9 @@ Function GetParamsString(Request)
EndFunction
Function GetHeadersString(Val Request)
Function GetHeadersString(Val Headers)
HeadersList = New ValueList;
Headers = Request.Headers;
For Each Title In Headers Do
@ -1358,10 +1478,9 @@ Function GetHeadersString(Val Request)
EndFunction
Function GetHeadersKeysString(Val Request)
Function GetHeadersKeysString(Val Headers)
HeadersList = New ValueList;
Headers = Request.Headers;
For Each Title In Headers Do

View File

@ -2162,6 +2162,7 @@ Procedure AWS_ObjectsManagement() Export
S3_ListObjects(TestParameters);
S3_ListObjectVersions(TestParameters);
S3_GetObject(TestParameters);
S3_GetObjectDownloadLink(TestParameters);
S3_DeleteObject(TestParameters);
S3_DeleteBucket(TestParameters);
@ -15567,6 +15568,35 @@ Procedure S3_AbortMultipartUpload(FunctionParameters)
EndProcedure
Procedure S3_GetObjectDownloadLink(FunctionParameters)
Image = FunctionParameters["Picture"]; // SKIP
OPI_TypeConversion.GetBinaryData(Image); // SKIP
RequiredSize = Image.Size(); // SKIP
URL = FunctionParameters["S3_URL"];
AccessKey = FunctionParameters["S3_AccessKey"];
SecretKey = FunctionParameters["S3_SecretKey"];
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "picture.jpg";
Bucket = "opi-gpbucket3";
Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetObjectDownloadLink", "S3");
OPI_TestDataRetrieval.Check_String(Result);
Result = OPI_Tools.Get(Result);
OPI_TestDataRetrieval.Check_BinaryData(Result, RequiredSize);
EndProcedure
#EndRegion
#EndRegion

View File

@ -36,6 +36,7 @@
//@skip-check module-structure-top-region
//@skip-check module-structure-method-in-regions
//@skip-check wrong-string-literal-content
#Region Internal
#Region HTTPMethods
@ -190,20 +191,24 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
EndFunction
Function CreateConnection(Val Host, Val Safe = True, Val User = "", Val Password = "") Export
Function CreateConnection(Val Host, Val Safe = True, Val User = "", Val Password = "", Val Port = "") Export
If Not ValueIsFilled(Port) Then
Port = ?(Safe, 443, 80);
EndIf;
If Safe Then
If IsOneScript() Then
Connection = New HTTPConnection(Host, 443, User, Password, , 3000);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000);
Else
SSL = New OpenSSLSecureConnection;
Connection = New HTTPConnection(Host, 443, User, Password, , 3000, SSL);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000, SSL);
EndIf;
Else
Connection = New HTTPConnection(Host, 80, User, Password, , 3000, SSL);
Connection = New HTTPConnection(Host, Port, User, Password, , 3000);
EndIf;
@ -227,8 +232,9 @@ Function ExecuteRequest(Val Request, Val Connection, Val View, Val ResponseFile
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Request.ResourceAddress = Address;
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
@ -344,7 +350,6 @@ Function SplitURL(Val URL) Export
URL = StrReplace(URL, "https://", "");
URL = StrReplace(URL, "http://" , "");
URL = StrReplace(URL, ":443" , "");
If StrFind(URL, "/") = 0 Then
Address = "";
@ -354,6 +359,20 @@ Function SplitURL(Val URL) Export
Host = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
EndIf;
If StrFind(Host, ":") <> 0 Then
ServerPort = StrSplit(Host, ":");
Host = ServerPort[0];
Port = ServerPort[1];
OPI_TypeConversion.GetNumber(Port);
Else
Port = ?(SecureConnection, 443, 80);
EndIf;
If IsOneScript() And SecureConnection Then
Host = "https://" + Host;
EndIf;
@ -362,6 +381,7 @@ Function SplitURL(Val URL) Export
ReturnStructure.Insert("Host" , Host);
ReturnStructure.Insert("Address" , Address);
ReturnStructure.Insert("Safe" , SecureConnection);
ReturnStructure.Insert("Port" , Port);
Return ReturnStructure;
@ -935,6 +955,41 @@ Procedure AddField(Val Name, Val Value, Val Type, Collection) Export
EndProcedure
Procedure AddKeyValue(Table, Val Key, Val Value) Export
KeyExists = False;
ValueExists = False;
For Each Coloumn In Table.Columns Do
If Coloumn.Name = "Key" Then
KeyExists = True;
ElsIf Coloumn.Name = "Value" Then
ValueExists = True;
Else
Continue;
EndIf;
EndDo;
If Not KeyExists Then
Table.Columns.Add("Key");
EndIf;
If Not ValueExists Then
Table.Columns.Add("Value");
EndIf;
NewValue = Table.Add();
NewValue.Key = Key;
NewValue.Value = Value;
EndProcedure
#EndRegion
#EndRegion
@ -952,9 +1007,10 @@ Function ExecuteRequestWithBody(Val URL, Val View, Val Parameters = "", Val Addi
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequestWithBody(Address, Parameters, AdditionalHeaders, JSON);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile, FullResponse);
Return Response;
@ -968,9 +1024,10 @@ Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val Additiona
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequest(Address, AdditionalHeaders, DataType);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
If Not Data.Size() = 0 Then
Request.SetBodyFromBinaryData(Data);
@ -993,9 +1050,10 @@ Function ExecuteRequestWithoutBody(Val URL, Val View, Val Parameters = "", Val A
Host = URLStructure["Host"];
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
Request = CreateRequest(Address, AdditionalHeaders);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
@ -1018,11 +1076,12 @@ Function ExecuteMultipartRequest(Val URL, Val View, Val Parameters = "", Val Fil
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
RequestBody = GetTempFileName();
Request = CreateMultipartRequest(Address, Parameters, Files, AdditionalHeaders, RequestBody, ContentType);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);
Request = Undefined;
@ -1040,11 +1099,12 @@ Function ExecuteMultipartRelatedRequest(Val URL, Val View, Val JSON = "", Val Fi
Host = URLStructure["Host"];
Address = URLStructure["Address"];
Safe = URLStructure["Safe"];
Port = URLStructure["Port"];
RequestBody = GetTempFileName();
Request = CreateMultipartRelatedRequest(Address, Files, JSON, AdditionalHeaders, RequestBody);
Connection = CreateConnection(Host, Safe);
Connection = CreateConnection(Host, Safe, , , Port);
Response = ExecuteRequest(Request, Connection, View, ResponseFile);

View File

@ -9,7 +9,6 @@
<extension xsi:type="mdclassExtension:ConfigurationExtension">
<defaultRunMode>Checked</defaultRunMode>
<usePurposes>Checked</usePurposes>
<interfaceCompatibilityMode>Checked</interfaceCompatibilityMode>
</extension>
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="12689443-2950-4e3b-b313-9a692b6acac7"/>
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="f6f98fbd-010a-4aba-8f11-01203bbc59c7"/>

View File

@ -1509,6 +1509,57 @@
NewLine.Описание = "Additional request headers, if necessary (optional, def. val. - Empty value)";
NewLine.Область = "Objects management";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "s3";
NewLine.Модуль = "OPI_S3";
NewLine.Метод = "GetObjectDownloadLink";
NewLine.МетодПоиска = "GETOBJECTDOWNLOADLINK";
NewLine.Параметр = "--name";
NewLine.Описание = "Name of the object in the bucket";
NewLine.Область = "Objects management";
NewLine.ОписаниеМетода = "Get presigned link for object retrieving without authorization";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "s3";
NewLine.Модуль = "OPI_S3";
NewLine.Метод = "GetObjectDownloadLink";
NewLine.МетодПоиска = "GETOBJECTDOWNLOADLINK";
NewLine.Параметр = "--bucket";
NewLine.Описание = "Name of the bucket to put the object";
NewLine.Область = "Objects management";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "s3";
NewLine.Модуль = "OPI_S3";
NewLine.Метод = "GetObjectDownloadLink";
NewLine.МетодПоиска = "GETOBJECTDOWNLOADLINK";
NewLine.Параметр = "--basic";
NewLine.Описание = "Basic request data. See GetBasicDataStructure";
NewLine.Область = "Objects management";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "s3";
NewLine.Модуль = "OPI_S3";
NewLine.Метод = "GetObjectDownloadLink";
NewLine.МетодПоиска = "GETOBJECTDOWNLOADLINK";
NewLine.Параметр = "--expires";
NewLine.Описание = "Link lifetime in seconds. 604800 max. (optional, def. val. - 3600)";
NewLine.Область = "Objects management";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "s3";
NewLine.Модуль = "OPI_S3";
NewLine.Метод = "GetObjectDownloadLink";
NewLine.МетодПоиска = "GETOBJECTDOWNLOADLINK";
NewLine.Параметр = "--headers";
NewLine.Описание = "Additional request headers, if necessary (optional, def. val. - Empty value)";
NewLine.Область = "Objects management";
Return CompositionTable;
EndFunction

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Airtable.os
// OneScript: ./OInt/core/Modules/OPI_Airtable.os
// Lib: Airtable
// CLI: airtable

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Bitrix24.os
// OneScript: ./OInt/core/Modules/OPI_Bitrix24.os
// Lib: Bitrix24
// CLI: bitrix24

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_CDEK.os
// OneScript: ./OInt/core/Modules/OPI_CDEK.os
// Lib: CDEK
// CLI: cdek

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Dropbox.os
// OneScript: ./OInt/core/Modules/OPI_Dropbox.os
// Lib: Dropbox
// CLI: dropbox

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_GoogleCalendar.os
// OneScript: ./OInt/core/Modules/OPI_GoogleCalendar.os
// Lib: Google Calendar
// CLI: gcalendar

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_GoogleDrive.os
// OneScript: ./OInt/core/Modules/OPI_GoogleDrive.os
// Lib: Google Drive
// CLI: gdrive

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_GoogleSheets.os
// OneScript: ./OInt/core/Modules/OPI_GoogleSheets.os
// Lib: Google Sheets
// CLI: gsheets

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_GoogleWorkspace.os
// OneScript: ./OInt/core/Modules/OPI_GoogleWorkspace.os
// Lib: Google Workspace
// CLI: google

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Neocities.os
// OneScript: ./OInt/core/Modules/OPI_Neocities.os
// Lib: Neocities
// CLI: neocities

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Notion.os
// OneScript: ./OInt/core/Modules/OPI_Notion.os
// Lib: Notion
// CLI: notion

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Ozon.os
// OneScript: ./OInt/core/Modules/OPI_Ozon.os
// Lib: Ozon
// CLI: ozon

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_S3.os
// OneScript: ./OInt/core/Modules/OPI_S3.os
// Lib: S3
// CLI: s3

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Slack.os
// OneScript: ./OInt/core/Modules/OPI_Slack.os
// Lib: Slack
// CLI: slack

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Telegram.os
// OneScript: ./OInt/core/Modules/OPI_Telegram.os
// Lib: Telegram
// CLI: telegram

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Twitter.os
// OneScript: ./OInt/core/Modules/OPI_Twitter.os
// Lib: Twitter
// CLI: twitter

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_VK.os
// OneScript: ./OInt/core/Modules/OPI_VK.os
// Lib: VK
// CLI: vk

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_VKTeams.os
// OneScript: ./OInt/core/Modules/OPI_VKTeams.os
// Lib: VKTeams
// CLI: vkteams

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_Viber.os
// OneScript: ./OInt/core/Modules/OPI_Viber.os
// Lib: Viber
// CLI: viber

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_YandexDisk.os
// OneScript: ./OInt/core/Modules/OPI_YandexDisk.os
// Lib: Yandex Disk
// CLI: yadisk

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_YandexID.os
// OneScript: ./OInt/core/Modules/OPI_YandexID.os
// Lib: Yandex ID
// CLI: yandex

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_YandexMarket.os
// OneScript: ./OInt/core/Modules/OPI_YandexMarket.os
// Lib: Yandex Market
// CLI: yamarket

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/core/Modules/OPI_YandexMetrika.os
// OneScript: ./OInt/core/Modules/OPI_YandexMetrika.os
// Lib: Yandex Metrika
// CLI: metrika

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
// MIT License

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Криптография.os
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Криптография.os
// MIT License

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tools/Modules/OPI_ПолучениеДанныхТестов.os
// OneScript: ./OInt/tools/Modules/OPI_ПолучениеДанныхТестов.os
// MIT License

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tools/Modules/OPI_ПреобразованиеТипов.os
// OneScript: ./OInt/tools/Modules/OPI_ПреобразованиеТипов.os
// MIT License

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
// MIT License

View File

@ -1,4 +1,4 @@
// OneScript: ./OInt/tests/Modules/internal/OPI_ТестыCLI.os
// OneScript: ./OInt/tests/Modules/internal/OPI_ТестыCLI.os
// MIT License

View File

@ -1513,6 +1513,57 @@
НоваяСтрока.Описание = "Дополнительные заголовки запроса, если необходимо (необяз. по ум. - Пустое значение)";
НоваяСтрока.Область = "Работа с объектами";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "s3";
НоваяСтрока.Модуль = "OPI_S3";
НоваяСтрока.Метод = "ПолучитьСсылкуСкачиванияОбъекта";
НоваяСтрока.МетодПоиска = "ПОЛУЧИТЬССЫЛКУСКАЧИВАНИЯОБЪЕКТА";
НоваяСтрока.Параметр = "--name";
НоваяСтрока.Описание = "Наименование объекта в бакете";
НоваяСтрока.Область = "Работа с объектами";
НоваяСтрока.ОписаниеМетода = "Получает прямую ссылку для скачивания объекта без дополнительной авторизации";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "s3";
НоваяСтрока.Модуль = "OPI_S3";
НоваяСтрока.Метод = "ПолучитьСсылкуСкачиванияОбъекта";
НоваяСтрока.МетодПоиска = "ПОЛУЧИТЬССЫЛКУСКАЧИВАНИЯОБЪЕКТА";
НоваяСтрока.Параметр = "--bucket";
НоваяСтрока.Описание = "Имя бакета для загрузки объекта";
НоваяСтрока.Область = "Работа с объектами";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "s3";
НоваяСтрока.Модуль = "OPI_S3";
НоваяСтрока.Метод = "ПолучитьСсылкуСкачиванияОбъекта";
НоваяСтрока.МетодПоиска = "ПОЛУЧИТЬССЫЛКУСКАЧИВАНИЯОБЪЕКТА";
НоваяСтрока.Параметр = "--basic";
НоваяСтрока.Описание = "Основные данные запроса. См. ПолучитьСтруктуруДанных";
НоваяСтрока.Область = "Работа с объектами";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "s3";
НоваяСтрока.Модуль = "OPI_S3";
НоваяСтрока.Метод = "ПолучитьСсылкуСкачиванияОбъекта";
НоваяСтрока.МетодПоиска = "ПОЛУЧИТЬССЫЛКУСКАЧИВАНИЯОБЪЕКТА";
НоваяСтрока.Параметр = "--expires";
НоваяСтрока.Описание = "Время жизни ссылки в секундах. 604800 максимум (необяз. по ум. - 3600)";
НоваяСтрока.Область = "Работа с объектами";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "s3";
НоваяСтрока.Модуль = "OPI_S3";
НоваяСтрока.Метод = "ПолучитьСсылкуСкачиванияОбъекта";
НоваяСтрока.МетодПоиска = "ПОЛУЧИТЬССЫЛКУСКАЧИВАНИЯОБЪЕКТА";
НоваяСтрока.Параметр = "--headers";
НоваяСтрока.Описание = "Дополнительные заголовки запроса, если необходимо (необяз. по ум. - Пустое значение)";
НоваяСтрока.Область = "Работа с объектами";
Возврат ТаблицаСостава;
КонецФункции