├── Source
├── DelphiAWSSDK.inc
├── Core
│ ├── Amazon.Credentials.pas
│ ├── Amazon.Response.pas
│ ├── Amazon.Environment.pas
│ ├── Amazon.Interfaces.pas
│ ├── Amazon.DelphiRESTClient.pas
│ ├── Amazon.SignatureV4.pas
│ ├── Amazon.Request.pas
│ ├── Amazon.IndyRESTClient.pas
│ ├── Amazon.Utils.pas
│ ├── Amazon.Marshaller.pas
│ └── Amazon.Client.pas
├── DelphiVersions.inc
└── SDK
│ └── DynamoDB
│ ├── Amazon.DynamoDB.pas
│ └── Amazon.DynamoDB2.pas
├── Doc
├── DynamoDB.md
├── Lazarus.md
├── Indy.md
├── EnvironmentVariables.md
├── test.html
└── test.md
├── Code-generation
├── Code-generation.code-workspace
└── Generator
│ ├── Source
│ ├── SDKUtils.pas
│ ├── SDK.inc
│ └── SDK.pas
│ ├── Properties
│ └── DynamoDB.xml
│ └── Generator.ccproject
├── Samples
└── DynamoDB
│ ├── Lazarus
│ └── CreateTable1
│ │ ├── CreateTable1.exe
│ │ ├── CreateTable1.lpi
│ │ ├── CreateTable1.pas
│ │ └── CreateTable1.lps
│ └── Delphi
│ ├── CreateTable1
│ ├── DynamoDBCreateTable.res
│ ├── DynamoDBCreateTable.stat
│ ├── DynamoDBCreateTable.dpr
│ └── DynamoDBCreateTable.dproj
│ └── CreateTable2
│ ├── DynamoDBCreateTable.res
│ ├── DynamoDBCreateTable.stat
│ └── DynamoDBCreateTable.dpr
├── README.md
├── Changelog.md
└── LICENSE
/Source/DelphiAWSSDK.inc:
--------------------------------------------------------------------------------
1 | {$I DelphiVersions.Inc}
2 |
--------------------------------------------------------------------------------
/Doc/DynamoDB.md:
--------------------------------------------------------------------------------
1 | https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.LowLevelAPI.html
--------------------------------------------------------------------------------
/Doc/Lazarus.md:
--------------------------------------------------------------------------------
1 | * Lazarus / fpc
2 |
3 |
4 |
5 |
6 | http://wiki.freepascal.org/Indy_with_Lazarus
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Doc/Indy.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | OpenSSL compiled DLL's
4 | https://indy.fulgan.com/SSL/
5 |
6 |
7 | Win32
8 | ssleay32.dll
9 | libeay32.dll
--------------------------------------------------------------------------------
/Code-generation/Code-generation.code-workspace:
--------------------------------------------------------------------------------
1 | {
2 | "folders": [
3 | {
4 | "path": "."
5 | }
6 | ],
7 | "settings": {}
8 | }
--------------------------------------------------------------------------------
/Code-generation/Generator/Source/SDKUtils.pas:
--------------------------------------------------------------------------------
1 | Unit SDKUtils;
2 |
3 | procedure test;
4 | begin
5 | writeln('test');
6 | end;
7 |
8 |
--------------------------------------------------------------------------------
/Code-generation/Generator/Source/SDK.inc:
--------------------------------------------------------------------------------
1 | <%$string="string"%>
2 | <%$structure="structure"%>
3 | <%$type="type"%>
4 | <%$members="members"%>
5 | <%$shape="shape"%>
--------------------------------------------------------------------------------
/Samples/DynamoDB/Lazarus/CreateTable1/CreateTable1.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/novuslogic/DelphiAWSSDK/HEAD/Samples/DynamoDB/Lazarus/CreateTable1/CreateTable1.exe
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable1/DynamoDBCreateTable.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/novuslogic/DelphiAWSSDK/HEAD/Samples/DynamoDB/Delphi/CreateTable1/DynamoDBCreateTable.res
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable2/DynamoDBCreateTable.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/novuslogic/DelphiAWSSDK/HEAD/Samples/DynamoDB/Delphi/CreateTable2/DynamoDBCreateTable.res
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable1/DynamoDBCreateTable.stat:
--------------------------------------------------------------------------------
1 | [Stats]
2 | EditorSecs=3844
3 | DesignerSecs=1
4 | InspectorSecs=1
5 | CompileSecs=355433
6 | OtherSecs=839
7 | StartTime=24/11/2016 9:24:40 AM
8 | RealKeys=0
9 | EffectiveKeys=0
10 | DebugSecs=14319
11 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable2/DynamoDBCreateTable.stat:
--------------------------------------------------------------------------------
1 | [Stats]
2 | EditorSecs=1276
3 | DesignerSecs=1
4 | InspectorSecs=1
5 | CompileSecs=127151
6 | OtherSecs=193
7 | StartTime=18/08/2018 2:53:04 PM
8 | RealKeys=0
9 | EffectiveKeys=0
10 | DebugSecs=4938
11 |
--------------------------------------------------------------------------------
/Doc/EnvironmentVariables.md:
--------------------------------------------------------------------------------
1 | # Environment Variables
2 |
3 | * AWS_ACCESS_KEY_ID
4 | * AWS_SECRET_ACCESS_KEY
5 | * AWS_DEFAULT_REGION - not supported
6 |
7 |
8 | [Environment variables to configure the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
--------------------------------------------------------------------------------
/Code-generation/Generator/Properties/DynamoDB.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | TAmazonDynamoDBClient
4 | D:\Projects\DelphiAWSSDK\Code-generation\api-descriptions\dynamodb-2012-08-10.normal.json
5 | D:\Projects\DelphiAWSSDK\Doc\
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | DelphiAWSSDK
2 | ==============
3 |
4 | The Delphi AWS SDK enables Delphi/Pascal developers to easily work with Amazon Web Services.
5 |
6 |
7 | Changelog
8 | ---------
9 |
10 | [Changelog](https://github.com/novuslogic/DelphiAWSSDK/blob/master/Changelog.md)
11 |
12 |
13 | Licence
14 | -------
15 | [Apache License Version 2.0](LICENSE)
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Doc/test.html:
--------------------------------------------------------------------------------
1 |
Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
You can only perform one of the following operations at once:
Modify the provisioned throughput settings of the table.
Enable or disable Streams on the table.
Remove a global secondary index from the table.
Create a new global secondary index on the table. Once the index begins backfilling, you can use UpdateTable to perform other operations.
UpdateTable is an asynchronous operation; while it is executing, the table status changes from ACTIVE to UPDATING. While it is UPDATING, you cannot issue another UpdateTable request. When the table returns to the ACTIVE state, the UpdateTable operation is complete.
2 |
--------------------------------------------------------------------------------
/Doc/test.md:
--------------------------------------------------------------------------------
1 | Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
You can only perform one of the following operations at once:
Modify the provisioned throughput settings of the table.
Enable or disable Streams on the table.
Remove a global secondary index from the table.
Create a new global secondary index on the table. Once the index begins backfilling, you can use UpdateTable to perform other operations.
UpdateTable is an asynchronous operation; while it is executing, the table status changes from ACTIVE to UPDATING. While it is UPDATING, you cannot issue another UpdateTable request. When the table returns to the ACTIVE state, the UpdateTable operation is complete.
2 |
--------------------------------------------------------------------------------
/Code-generation/Generator/Generator.ccproject:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 | true
6 | true
7 |
8 |
9 | [%sourcepath%]SDK.pas
10 | [%propertiespath%]DynamoDB.xml
11 | true
12 | [%outputpath%]DynamoDB\Amazon.DynamoDB2.pas
13 |
14 |
15 |
16 |
17 | D:\Projects\DelphiAWSSDK\Source\SDK\
18 | D:\Projects\DelphiAWSSDK\Code-generation\Generator\Properties\
19 | D:\Projects\DelphiAWSSDK\Code-generation\Generator\Source\
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Credentials.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Credentials;
2 |
3 | interface
4 |
5 | uses Amazon.Environment, Amazon.Utils,
6 | {$IFNDEF FPC}
7 | System.SysUtils,
8 | {$ELSE}
9 | SysUtils,
10 | {$ENDIF}
11 | inifiles;
12 |
13 | const
14 | aws_defaultcredential_file = 'credentials.ini';
15 |
16 | type
17 | TAmazonCredentials = class(TAmazonEnvironment)
18 | private
19 | protected
20 | public
21 | function Iscredential_file: Boolean;
22 | procedure Loadcredential_file;
23 | end;
24 |
25 | implementation
26 |
27 | function TAmazonCredentials.Iscredential_file: Boolean;
28 | begin
29 | Try
30 | result := True;
31 |
32 | credential_file := GetAWSUserDir;
33 |
34 | if credential_file <> '' then
35 | credential_file := credential_file + '\' + aws_defaultcredential_file;
36 |
37 | Finally
38 | if Not fileExists(credential_file) then
39 | result := False;
40 | End;
41 | end;
42 |
43 | procedure TAmazonCredentials.Loadcredential_file;
44 | var
45 | FIniFile: TIniFile;
46 | begin
47 | if Not fileExists(credential_file) then
48 | Exit;
49 |
50 | Try
51 | FIniFile := TIniFile.Create(credential_file);
52 |
53 | access_key := FIniFile.Readstring(profile, 'aws_access_key_id', access_key);
54 | secret_key := FIniFile.Readstring(profile, 'aws_secret_access_key',
55 | secret_key);
56 | region := FIniFile.Readstring(profile, 'aws_region', region);
57 |
58 | Finally
59 | FIniFile.Free;
60 | End;
61 | end;
62 |
63 | end.
64 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Response.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Response;
2 |
3 | interface
4 |
5 | Uses Amazon.Interfaces;
6 |
7 | type
8 | TAmazonResponse = class(TInterfacedObject, IAmazonResponse)
9 | private
10 | firesponsecode: Integer;
11 | fsreponsetext: UTF8String;
12 | fsresponse: UTF8String;
13 | protected
14 | procedure setresponsecode(value: Integer);
15 | procedure setreponsetext(value: UTF8String);
16 | procedure setreponse(value: UTF8String);
17 | function getresponsecode: Integer;
18 | function getreponsetext: UTF8String;
19 | function getreponse: UTF8String;
20 | public
21 | property ResponseText: UTF8String read getreponsetext write setreponsetext;
22 | property ResponseCode: Integer read getresponsecode write setresponsecode;
23 | property Response: UTF8String read getreponse write setreponse;
24 | end;
25 |
26 | implementation
27 |
28 | procedure TAmazonResponse.setresponsecode(value: Integer);
29 | begin
30 | firesponsecode := value;
31 | end;
32 |
33 | procedure TAmazonResponse.setreponsetext(value: UTF8String);
34 | begin
35 | fsreponsetext := value;
36 | end;
37 |
38 | procedure TAmazonResponse.setreponse(value: UTF8String);
39 | begin
40 | fsresponse := value;
41 | end;
42 |
43 | function TAmazonResponse.getresponsecode: Integer;
44 | begin
45 | result := firesponsecode;
46 | end;
47 |
48 | function TAmazonResponse.getreponsetext: UTF8String;
49 | begin
50 | result := fsreponsetext;
51 | end;
52 |
53 | function TAmazonResponse.getreponse: UTF8String;
54 | begin
55 | result := fsresponse;
56 | end;
57 |
58 | end.
59 |
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | 09/1/2022
2 |
3 | * Update for Delphi 10.4 and Delphi 11
4 |
5 | 18/03/2019
6 |
7 | * Experimental Code-Generation based on CodeImatic.codegen
8 | * Support for Delphi 10.3 / C++Builder Rio
9 |
10 | 5/11/2018
11 |
12 | * Fix samples paths to units.
13 |
14 | 5/11/20018
15 |
16 | * New Lazarus CreateTable1 DynamoDB Sample
17 | * Refactored Core for Lazarus / fpc 1.8 or higher
18 | * New exception "secret_key or access_key not assigned." in TAmazonClient.execute
19 | * New exception "IAmazonRESTClient not assigned." in TAmazonClient.execute
20 | * New exception "region not assigned.' in TAmazonClient.execute
21 | * DateTimeToISO8601 and DeepCopy removed for Lazarus / fpc in unit
22 | * Moved Samples Samples\DynamoDB to Samples\DynamoDB\Delphi
23 |
24 | 03/09/2018
25 |
26 | * Tested support for Windows 32/64Bit, MacOSX 32Bit
27 | * Removed Windows unit from unit Amazon.Utils
28 | * Added Region to TAmazonClient.Create
29 |
30 |
31 | 30/08/2018
32 |
33 | * THashSHA2 supported in unit Amazon.Utils for Delphi XE8 and up.
34 | * TidBytes reference change to Tbytes in unit Amazon.SignatureV4 for Delphi XE8 and up.
35 | * Fixed support for Delphi XE to Delphi XE7
36 |
37 | 28/08/2018
38 |
39 | * New RESTClient class TAmazonDelphiRestClient based on Delphi TRESTClient and TRESTHTTP. Note TAmazonSignatureV4 still requires OpenSSL Library
40 | * Updated TAmazonIndyRestClient with latest IAmazonRESTClient interface
41 | * New properties UserAgent, AcceptCharset, Accept in IAmazonRESTClient interface
42 |
43 | 23/08/2018
44 |
45 | * Update DelphiVerion.inc which includes Delphi 10.2 support
46 |
47 | 19/08/2018
48 |
49 | * Start of the Changelog
50 | * Renamed Amazon.RESTClient.pas to Amazon.IndyRESTClient.pas and class TAmazonRESTClient to TAmazonIndyRESTClient
51 | * Fixed TAmazonMarshaller function GetSubRttiAttributekeys RTTI in Delphi XE8 moved from List To FObjectList: TObjectList
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable2/DynamoDBCreateTable.dpr:
--------------------------------------------------------------------------------
1 | program DynamoDBCreateTable;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 | uses
8 | System.SysUtils,
9 | Amazon.Client in 'Amazon.Client.pas',
10 | Amazon.Interfaces in 'Amazon.Interfaces.pas',
11 | Amazon.Credentials in 'Amazon.Credentials.pas',
12 | Amazon.Environment in 'Amazon.Environment.pas',
13 | Amazon.Utils in 'Amazon.Utils.pas',
14 | Amazon.Request in 'Amazon.Request.pas',
15 | Amazon.Response in 'Amazon.Response.pas',
16 | Amazon.IndyRESTClient in 'Amazon.IndyRESTClient.pas',
17 | // Amazon.DelphiRESTClient in 'Amazon.DelphiRESTClient.pas',
18 | Amazon.SignatureV4 in 'Amazon.SignatureV4.pas',
19 | Amazon.Marshaller in 'Amazon.Marshaller.pas',
20 | Amazon.DynamoDB in 'Amazon.DynamoDB.pas';
21 |
22 | Var
23 | FAmazonRESTClient: IAmazonRestClient;
24 | FAmazonDynamoDBClient: TAmazonDynamoDBClient;
25 | FCreateTableRequest: TCreateTableRequest;
26 | FAmazonDynamoDBResponse: TAmazonDynamoDBResponse;
27 | begin
28 | try
29 | Try
30 | Writeln('DynamoDB API (CreateTable) using Amazon.DynamoDB class');
31 |
32 | FAmazonRESTClient := TAmazonIndyRESTClient.Create;
33 | //FAmazonRESTClient := TAmazonDelphiRESTClient.Create;
34 |
35 |
36 | FAmazonDynamoDBClient:= TAmazonDynamoDBClient.Create(FAmazonRESTClient);
37 |
38 | FAmazonDynamoDBClient.endpoint := 'https://dynamodb.ap-southeast-2.amazonaws.com/';
39 |
40 | FCreateTableRequest := TCreateTableRequest.Create;
41 | FCreateTableRequest.Tablename := 'ProductCatalog';
42 |
43 | FCreateTableRequest.AttributeDefinitions.Add(TAttributeDefinition.Create('Id', 'S'));
44 |
45 | FCreateTableRequest.KeySchema.Add(TKeySchemaElement.Create('Id', 'HASH'));
46 |
47 | With FCreateTableRequest.ProvisionedThroughput do
48 | begin
49 | ReadCapacityUnits := 10;
50 | WriteCapacityUnits := 5;
51 | end;
52 |
53 | FAmazonDynamoDBResponse := FAmazonDynamoDBClient.CreateTable(FCreateTableRequest);
54 |
55 | Writeln('ResponseCode:' + IntTostr( FAmazonDynamoDBResponse.ResponseCode));
56 | Writeln('ResponseStr:' + FAmazonDynamoDBResponse.ResponseText);
57 |
58 | Writeln('Response:' + FAmazonDynamoDBResponse.Response);
59 |
60 | Writeln('Press [enter] to finish.');
61 | readln;
62 | Finally
63 | FAmazonRESTClient := NIL;
64 |
65 | FAmazonDynamoDBClient.Free;
66 |
67 | FAmazonDynamoDBResponse.Free;
68 | End;
69 | except
70 | on E: Exception do
71 | Writeln(E.ClassName, ': ', E.Message);
72 | end;
73 | end.
74 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable1/DynamoDBCreateTable.dpr:
--------------------------------------------------------------------------------
1 | program DynamoDBCreateTable;
2 |
3 | {$APPTYPE CONSOLE}
4 |
5 | {$R *.res}
6 |
7 | uses
8 | System.SysUtils,
9 | Classes,
10 | Amazon.Interfaces in 'Amazon.Interfaces.pas',
11 | Amazon.Credentials in 'Amazon.Credentials.pas',
12 | Amazon.Environment in 'Amazon.Environment.pas',
13 | Amazon.Utils in 'Amazon.Utils.pas',
14 | Amazon.Request in 'Amazon.Request.pas',
15 | Amazon.Response in 'Amazon.Response.pas',
16 | Amazon.DelphiRESTClient in 'Amazon.DelphiRESTClient.pas',
17 | Amazon.IndyRESTClient in 'Amazon.IndyRESTClient.pas',
18 | Amazon.SignatureV4 in 'Amazon.SignatureV4.pas',
19 | Amazon.Client in 'Amazon.Client.pas';
20 |
21 | var
22 | FAmazonRESTClient: IAmazonRestClient;
23 | FAmazonRequest: TAmazonRequest;
24 | FAmazonSignatureV4: TAmazonSignatureV4;
25 | FAmazonClient: TAmazonClient;
26 | FAmazonResponse: IAmazonResponse;
27 | begin
28 | try
29 | Try
30 | Writeln('DynamoDB API (CreateTable) using Amazon.Client class');
31 |
32 | FAmazonClient:= TAmazonClient.Create;
33 | FAmazonClient.endpoint := 'https://dynamodb.ap-southeast-2.amazonaws.com/';
34 |
35 | FAmazonClient.service := 'dynamodb';
36 |
37 | FAmazonRequest := TAmazonRequest.Create;
38 | FAmazonSignatureV4 := TAmazonSignatureV4.Create;
39 |
40 |
41 | FAmazonRESTClient := TAmazonIndyRESTClient.Create;
42 | //FAmazonRESTClient := TAmazonDelphiRESTClient.Create;
43 |
44 |
45 | FAmazonRequest.request_parameters := '{' +
46 | '"KeySchema": [{"KeyType": "HASH","AttributeName": "Id"}],' +
47 | '"TableName": "TestTable",' +
48 | '"AttributeDefinitions": [{"AttributeName": "Id","AttributeType": "S"}],' +
49 | '"ProvisionedThroughput": {"WriteCapacityUnits": 5,"ReadCapacityUnits": 5}' +
50 | '}';
51 |
52 | Writeln('Endpoint:'+FAmazonClient.endpoint);
53 |
54 | FAmazonRequest.targetPrefix := 'DynamoDB_20120810';
55 | FAmazonRequest.operationName := 'CreateTable';
56 |
57 | Writeln('Target:'+FAmazonRequest.Target);
58 |
59 | FAmazonResponse := FAmazonClient.execute(FAmazonRequest, fAmazonSignatureV4, FAmazonRESTClient);
60 |
61 | Writeln('ResponseCode:' + IntTostr( FAmazonResponse.ResponseCode));
62 | Writeln('ResponseStr:' + FAmazonResponse.ResponseText);
63 |
64 | Writeln('Response:' + FAmazonResponse.Response);
65 |
66 |
67 | Writeln('Press [enter] to finish.');
68 | readln;
69 | Finally
70 | FAmazonClient.Free;
71 | FAmazonResponse := NIL;
72 | End;
73 |
74 |
75 |
76 |
77 | except
78 | on E: Exception do
79 | Writeln(E.ClassName, ': ', E.Message);
80 | end;
81 | end.
82 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Lazarus/CreateTable1/CreateTable1.lpi:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Lazarus/CreateTable1/CreateTable1.pas:
--------------------------------------------------------------------------------
1 | program CreateTable1;
2 |
3 | {$mode objfpc}{$H+}
4 |
5 | uses
6 | {$IFDEF UNIX}{$IFDEF UseCThreads}
7 | cthreads,
8 | {$ENDIF}{$ENDIF}
9 | Classes, SysUtils,
10 | CustApp,
11 | Amazon.Client in 'Amazon.Client.pas',
12 | Amazon.Interfaces in 'Amazon.Interfaces.pas',
13 | Amazon.Credentials in 'Amazon.Credentials.pas',
14 | Amazon.Environment in 'Amazon.Environment.pas',
15 | Amazon.Utils in 'Amazon.Utils.pas',
16 | Amazon.Request in 'Amazon.Request.pas',
17 | Amazon.Response in 'Amazon.Response.pas',
18 | Amazon.IndyRESTClient in 'Amazon.IndyRESTClient.pas',
19 | Amazon.SignatureV4 in 'Amazon.SignatureV4.pas';
20 |
21 | type
22 |
23 | { TCreateTable1 }
24 |
25 | TCreateTable1 = class(TCustomApplication)
26 | protected
27 | procedure DoRun; override;
28 | public
29 | constructor Create(TheOwner: TComponent); override;
30 | destructor Destroy; override;
31 | end;
32 |
33 | { TCreateTable3 }
34 |
35 | procedure TCreateTable1.DoRun;
36 | var
37 | FAmazonRESTClient: TAmazonIndyRESTClient;
38 | FAmazonRequest: TAmazonRequest;
39 | FAmazonSignatureV4: TAmazonSignatureV4;
40 | FAmazonClient: TAmazonClient;
41 | FAmazonResponse: IAmazonResponse;
42 | begin
43 | try
44 | Try
45 | Writeln('DynamoDB API (CreateTable) using Amazon.Client class');
46 |
47 | FAmazonClient:= TAmazonClient.Create;
48 | FAmazonClient.endpoint := 'https://dynamodb.ap-southeast-2.amazonaws.com/';
49 |
50 | FAmazonClient.service := 'dynamodb';
51 |
52 | FAmazonRequest := TAmazonRequest.Create;
53 | FAmazonSignatureV4 := TAmazonSignatureV4.Create;
54 | FAmazonRESTClient := TAmazonIndyRESTClient.Create;
55 |
56 |
57 | FAmazonRequest.request_parameters := '{' +
58 | '"KeySchema": [{"KeyType": "HASH","AttributeName": "Id"}],' +
59 | '"TableName": "TestTable",' +
60 | '"AttributeDefinitions": [{"AttributeName": "Id","AttributeType": "S"}],' +
61 | '"ProvisionedThroughput": {"WriteCapacityUnits": 5,"ReadCapacityUnits": 5}' +
62 | '}';
63 |
64 | Writeln('Endpoint:'+FAmazonClient.endpoint);
65 |
66 | FAmazonRequest.targetPrefix := 'DynamoDB_20120810';
67 | FAmazonRequest.operationName := 'CreateTable';
68 |
69 | Writeln('Target:'+FAmazonRequest.Target);
70 |
71 | FAmazonResponse := FAmazonClient.execute(FAmazonRequest, fAmazonSignatureV4, FAmazonRESTClient);
72 |
73 | Writeln('ResponseCode:' + IntTostr( FAmazonResponse.ResponseCode));
74 | Writeln('ResponseStr:' + FAmazonResponse.ResponseText);
75 |
76 | Writeln('Response:' + FAmazonResponse.Response);
77 |
78 |
79 | Writeln('Press [enter] to finish.');
80 | readln;
81 | Finally
82 | FAmazonClient.Free;
83 | FAmazonResponse := NIL;
84 | End;
85 |
86 |
87 | except
88 | on E: Exception do
89 | Writeln(E.ClassName, ': ', E.Message);
90 | end;
91 |
92 | Terminate;
93 | end;
94 |
95 | constructor TCreateTable1.Create(TheOwner: TComponent);
96 | begin
97 | inherited Create(TheOwner);
98 | StopOnException:=True;
99 | end;
100 |
101 | destructor TCreateTable1.Destroy;
102 | begin
103 | inherited Destroy;
104 | end;
105 |
106 |
107 | var
108 | Application: TCreateTable1;
109 | begin
110 | Application:=TCreateTable1.Create(nil);
111 | Application.Run;
112 | Application.Free;
113 | end.
114 |
115 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Environment.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Environment;
2 |
3 | interface
4 |
5 | Uses {$IFNDEF FPC}
6 | System.SysUtils;
7 | {$ELSE}
8 | SysUtils;
9 | {$ENDIF}
10 |
11 | const
12 | AWS_REGION = 'AWS_REGION';
13 | AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID';
14 | AWS_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY';
15 | AWS_CREDENTIAL_FILE = 'AWS_CREDENTIAL_FILE';
16 | AWS_PROFILE = 'AWS_PROFILE';
17 |
18 | type
19 | TAmazonEnvironment = class
20 | protected
21 | fsprofile: UTF8String;
22 | fssecret_key: UTF8String;
23 | fsaccess_key: UTF8String;
24 | fsregion: UTF8String;
25 | fscredential_file: UTF8String;
26 | private
27 | function getsecret_key: UTF8String;
28 | procedure setsecret_key(value: UTF8String);
29 | function getaccess_key: UTF8String;
30 | procedure setaccess_key(value: UTF8String);
31 | function getregion: UTF8String;
32 | procedure setregion(value: UTF8String);
33 | function getprofile: UTF8String;
34 | procedure setprofile(value: UTF8String);
35 | function getcredential_file: UTF8String;
36 | procedure setcredential_file(value: UTF8String);
37 |
38 | function GetEnvVariableValue(const aVariablename: string): string;
39 | public
40 | property profile: UTF8String read getprofile write setprofile;
41 | property credential_file: UTF8String read getcredential_file
42 | write setcredential_file;
43 | property region: UTF8String read getregion write setregion;
44 | property secret_key: UTF8String read getsecret_key write setsecret_key;
45 | property access_key: UTF8String read getaccess_key write setaccess_key;
46 |
47 | procedure GetEnvironmentVariables;
48 | end;
49 |
50 | implementation
51 |
52 | function TAmazonEnvironment.GetEnvVariableValue(const aVariablename
53 | : string): string;
54 | var
55 | BufSize: Integer;
56 | begin
57 | Result := Trim(GetEnvironmentVariable(aVariablename));
58 | end;
59 |
60 | procedure TAmazonEnvironment.GetEnvironmentVariables;
61 | begin
62 | fsaccess_key := GetEnvVariableValue(AWS_ACCESS_KEY_ID);
63 | fssecret_key := GetEnvVariableValue(AWS_SECRET_ACCESS_KEY);
64 | fsregion := GetEnvVariableValue(AWS_REGION);
65 | fscredential_file := GetEnvVariableValue(AWS_CREDENTIAL_FILE);
66 | fsprofile := GetEnvVariableValue(AWS_PROFILE);
67 | end;
68 |
69 | function TAmazonEnvironment.getaccess_key: UTF8String;
70 | begin
71 | Result := fsaccess_key;
72 | end;
73 |
74 | procedure TAmazonEnvironment.setaccess_key(value: UTF8String);
75 | begin
76 | fsaccess_key := value;
77 | end;
78 |
79 | function TAmazonEnvironment.getsecret_key: UTF8String;
80 | begin
81 | Result := fssecret_key;
82 | end;
83 |
84 | procedure TAmazonEnvironment.setsecret_key(value: UTF8String);
85 | begin
86 | fssecret_key := value;
87 | end;
88 |
89 | function TAmazonEnvironment.getregion: UTF8String;
90 | begin
91 | Result := fsregion;
92 | end;
93 |
94 | procedure TAmazonEnvironment.setregion(value: UTF8String);
95 | begin
96 | fsregion := value;
97 | end;
98 |
99 | function TAmazonEnvironment.getprofile: UTF8String;
100 | begin
101 | Result := fsprofile;
102 | end;
103 |
104 | procedure TAmazonEnvironment.setprofile(value: UTF8String);
105 | begin
106 | fsprofile := value;
107 | end;
108 |
109 | function TAmazonEnvironment.getcredential_file: UTF8String;
110 | begin
111 | Result := fscredential_file;
112 | end;
113 |
114 | procedure TAmazonEnvironment.setcredential_file(value: UTF8String);
115 | begin
116 | fscredential_file := value;
117 | end;
118 |
119 | end.
120 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Interfaces.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Interfaces;
2 |
3 | interface
4 |
5 | type
6 | IAmazonRESTClient = interface
7 | ['{E6CD9C73-6C92-4996-AEC3-3EC836629E6D}']
8 | function GetAccept: string;
9 | procedure SetAccept(value: string);
10 | function GetAcceptCharset: string;
11 | procedure SetAcceptCharset(value: string);
12 | function GetUserAgent: string;
13 | procedure SetUserAgent(value:string);
14 | function GetResponseCode: Integer;
15 | function GetResponseText: String;
16 | function GetContent_type: string;
17 | function GetErrorCode: Integer;
18 | procedure SetContent_type(value: string);
19 | function GetErrorMessage: String;
20 |
21 | procedure AddHeader(aName, aValue: UTF8String);
22 |
23 | procedure Post(aUrl: string; aRequest: UTF8String;
24 | var aResponse: UTF8String);
25 |
26 | property ResponseCode: Integer read GetResponseCode;
27 | property ResponseText: string read GetResponseText;
28 | property Content_type: String read GetContent_type write SetContent_type;
29 | property ErrorCode: Integer read GetErrorCode;
30 | property ErrorMessage: String read GetErrorMessage;
31 | property UserAgent: string read GetUserAgent write SetUserAgent;
32 | property AcceptCharset: string read GetAcceptCharset write SetAcceptCharset;
33 | property Accept: string read GetAccept write SetAccept;
34 | end;
35 |
36 | IAmazonClient = interface
37 | ['{24BF1E03-A208-4F7D-9FC7-875BC33D339F}']
38 | end;
39 |
40 | IAmazonMarshaller = interface
41 | ['{132F6BC1-8F07-4A2E-B763-02C4CF66008C}']
42 | end;
43 |
44 | IAmazonResponse = interface
45 | ['{022460F3-2D8A-4784-9207-825242851A12}']
46 | procedure setresponsecode(value: Integer);
47 | procedure setreponsetext(value: UTF8String);
48 | procedure setreponse(value: UTF8String);
49 | function GetResponseCode: Integer;
50 | function getreponsetext: UTF8String;
51 | function getreponse: UTF8String;
52 | property ResponseText: UTF8String read getreponsetext write setreponsetext;
53 | property ResponseCode: Integer read GetResponseCode write setresponsecode;
54 | property Response: UTF8String read getreponse write setreponse;
55 | end;
56 |
57 | IAmazonRequest = interface
58 | ['{DA029A3F-05C2-4286-BF0B-4FE859AC8A64}']
59 | function getsecret_key: UTF8String;
60 | procedure setsecret_key(value: UTF8String);
61 | function getaccess_key: UTF8String;
62 | procedure setaccess_key(value: UTF8String);
63 |
64 | function gettarget: UTF8String;
65 | function gettargetPrefix: UTF8String;
66 | procedure settargetPrefix(value: UTF8String);
67 | function getservice: UTF8String;
68 | procedure setservice(value: UTF8String);
69 | function getregion: UTF8String;
70 | procedure setregion(value: UTF8String);
71 | function gethost: UTF8String;
72 | procedure sethost(value: UTF8String);
73 | function getamz_date: UTF8String;
74 | procedure setamz_date(value: UTF8String);
75 | function getdate_stamp: UTF8String;
76 | procedure setdate_stamp(value: UTF8String);
77 | function getendpoint: UTF8String;
78 | procedure setendpoint(value: UTF8String);
79 | function getoperationName: UTF8String;
80 | procedure setoperationName(value: UTF8String);
81 | function getauthorization_header: UTF8String;
82 | procedure setauthorization_header(value: UTF8String);
83 |
84 | function getrequest_parameters: UTF8String;
85 | procedure setrequest_parameters(value: UTF8String);
86 |
87 | property secret_key: UTF8String read getsecret_key write setsecret_key;
88 | property access_key: UTF8String read getaccess_key write setaccess_key;
89 |
90 | property targetPrefix: UTF8String read gettargetPrefix
91 | write settargetPrefix;
92 | property operationName: UTF8String read getoperationName
93 | write setoperationName;
94 | property service: UTF8String read getservice write setservice;
95 | property region: UTF8String read getregion write setregion;
96 | property host: UTF8String read gethost write sethost;
97 | property endpoint: UTF8String read getendpoint write setendpoint;
98 |
99 | property amz_date: UTF8String read getamz_date write setamz_date;
100 | property date_stamp: UTF8String read getdate_stamp write setdate_stamp;
101 |
102 | property target: UTF8String read gettarget;
103 |
104 | property authorization_header: UTF8String read getauthorization_header
105 | write setauthorization_header;
106 |
107 | property request_parameters: UTF8String read getrequest_parameters
108 | write setrequest_parameters;
109 | end;
110 |
111 | IAmazonSignature = interface
112 | ['{56901E5E-BA6C-49E4-B730-CA58AE7F8DCB}']
113 | function getsignature: UTF8String;
114 | function getauthorization_header: UTF8String;
115 | function GetContent_type: UTF8String;
116 | procedure Sign(aRequest: IAmazonRequest);
117 |
118 | property Signature: UTF8String read getsignature;
119 | property authorization_header: UTF8String read getauthorization_header;
120 |
121 | end;
122 |
123 | implementation
124 |
125 | end.
126 |
--------------------------------------------------------------------------------
/Code-generation/Generator/Source/SDK.pas:
--------------------------------------------------------------------------------
1 | <%CODEBEHINE="SDKUtils.pas"%>
2 | <%include="sdk.inc"%>
3 | <%$JSONRoot=JSON.LoadJSON($$apifilename)%>
4 | <%$JSONMetadata=JSON.JSONQuery($JSONRoot, "metadata")%>
5 | <%$JSONOperations=JSON.JSONQuery($JSONRoot, "operations")%>
6 | <%$JSONShapes=JSON.JSONQuery($JSONRoot, "shapes")%>
7 | unit Amazon.DynamoDB;
8 |
9 | interface
10 |
11 | uses Amazon.Client, Amazon.Request, System.Classes, System.Generics.Collections,
12 | Amazon.Response, Amazon.Utils, Amazon.Marshaller, System.Rtti, System.TypInfo,
13 | Amazon.Interfaces, System.AnsiStrings, System.SysUtils;
14 |
15 | <%$targetPrefix=JSON.ToJSONValue(JSON.JSONQuery($JSONMetadata, "targetPrefix"))%>
16 | <%$endpointPrefix=JSON.ToJSONValue(JSON.JSONQuery($JSONMetadata, "endpointPrefix"))%>
17 |
18 | Const
19 | cDynamoDB_targetPrefix = '<%=$targetPrefix%>';
20 | cDynamoDB_endpointPrefix = '<%=$endpointPrefix%>';
21 |
22 | type
23 | <%$Counter=0%>
24 | <%repeat(SYS.PRED(JSON.JSONArraySize($JSONShapes))%>
25 | <%$JSONShape=JSON.JSONGetArray($JSONShapes,$Counter)%>
26 | <%IF(JSON.JSONQueryValue($JSONShape, $type)=$structure)%>
27 | [TAmazonMarshallerAttribute('<%=JSON.JSONString(JSON.JSONPair($JSONShape))%>')]
28 | T<%=JSON.JSONString(JSON.JSONPair($JSONShape))%>=class(tobject)
29 | <%$JSONShapeMembers=JSON.JSONQuery($JSONShape, $members)%>
30 | protected
31 | private
32 | public
33 | end;
34 |
35 | <%ENDIF%>
36 | <%SYS.Inc($Counter)%>
37 | <%endrepeat%>
38 |
39 |
40 |
41 | <%classname%> = class(TAmazonClient)
42 | protected
43 | private
44 | public
45 | procedure InitClient(aprofile: UTF8String; asecret_key: UTF8String;
46 | aaccess_key: UTF8String; aregion: UTF8String); override;
47 | <%$Counter=0%>
48 | <%repeat(SYS.PRED(JSON.JSONArraySize($JSONOperations))%>
49 | <%$JSONOperation=JSON.JSONGetArray($JSONOperations,$Counter)%>
50 | <%$procedurename=JSON.JSONString($JSONOperation)%>
51 | <%$JSONOperationInput=JSON.JSONQuery($JSONOperation, "input")%>
52 | <%$JSONOperationOutput=JSON.JSONQuery($JSONOperation, "output")%>
53 | <%$JSONOperationDocumentation=JSON.JSONQuery($JSONOperation, "documentation")%>
54 | <%IF(SYS.IsVarEmpty($JSONOperationDocumentation)=false)%>
55 | <%$Doc=JSON.ToJSONValue($JSONOperationDocumentation)%>
56 | <%$folder=$$docfolder+$endpointPrefix+"\"%>
57 | <%$filename=$folder+$procedurename+".html"%>
58 | <%SYS.CreateFolder($folder)%>
59 | <%SYS.STRINGTOFILE($Doc, $filename)%>
60 | <%ENDIF%>
61 | [TAmazonMarshallerAttribute('<%=JSON.ToJSONValue(JSON.JSONQuery($JSONOperation, "name"))%>')]
62 | <%IF(SYS.IsVarEmpty($JSONOperationOutput)=true)%>
63 | procedure <%=JSON.JSONString($JSONOperation)%>(a<%=JSON.ToJSONValue(JSON.JSONQuery($JSONOperationInput, "shape"))%>: t<%=JSON.ToJSONValue(JSON.JSONQuery($JSONOperationInput, "shape"))%>);
64 | <%ENDIF%>
65 | <%IF(SYS.IsVarEmpty($JSONOperationOutput)=false)%>
66 | function <%=JSON.JSONString($JSONOperation)%>(a<%=JSON.JSONQueryValue($JSONOperationInput, "shape")%>: t<%=JSON.JSONQueryValue($JSONOperationInput, "shape")%>):t<%=JSON.JSONQueryValue($JSONOperationOutput,"shape")%>;
67 | <%ENDIF%>
68 | <%SYS.Inc($Counter)%>
69 | <%endrepeat%>
70 | end;
71 |
72 | implementation
73 |
74 | procedure <%classname%>.InitClient(aprofile: UTF8String;
75 | asecret_key: UTF8String; aaccess_key: UTF8String; aregion: UTF8String);
76 | begin
77 | inherited InitClient(aprofile, asecret_key, aaccess_key, aregion);
78 |
79 | service := c<%=$endpointPrefix%>_endpointPrefix;
80 | end;
81 |
82 | <%$Counter=0%>
83 | <%repeat(SYS.PRED(JSON.JSONArraySize($JSONOperations))%>
84 | <%$JSONOperation=JSON.JSONGetArray($JSONOperations,$Counter)%>
85 | <%$JSONOperationInput=JSON.JSONQuery($JSONOperation, "input")%>
86 | <%$JSONOperationOutput=JSON.JSONQuery($JSONOperation, "output")%>
87 | <%IF(SYS.IsVarEmpty($JSONOperationOutput)=true)%>
88 | procedure <%classname%>.<%=JSON.JSONString($JSONOperation)%>(a<%=JSON.ToJSONValue(JSON.JSONQuery($JSONOperationInput, "shape"))%>: t<%=JSON.ToJSONValue(JSON.JSONQuery($JSONOperationInput, "shape"))%>);
89 | <%ENDIF%>
90 | <%IF(SYS.IsVarEmpty($JSONOperationOutput)=false)%>
91 | function <%classname%>.<%=JSON.JSONString($JSONOperation)%>(a<%=JSON.JSONQueryValue($JSONOperationInput, "shape")%>: t<%=JSON.JSONQueryValue($JSONOperationInput, "shape")%>):t<%=JSON.JSONQueryValue($JSONOperationOutput,"shape")%>;
92 | <%ENDIF%>
93 | begin
94 |
95 | end;
96 |
97 | <%SYS.Inc($Counter)%>
98 | <%endrepeat%>
99 |
100 |
101 | end.
102 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.DelphiRESTClient.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.DelphiRESTClient;
2 |
3 | interface
4 |
5 | uses classes, SysUtils, Amazon.Interfaces, REST.Client, REST.Types,
6 | REST.HttpClient;
7 |
8 | const
9 | cAccept = CONTENTTYPE_APPLICATION_JSON + ', ' + CONTENTTYPE_TEXT_PLAIN +
10 | '; q=0.9, ' + CONTENTTYPE_TEXT_HTML + ';q=0.8,';
11 | cAcceptCharset = 'UTF-8, *;q=0.8';
12 | cUserAgent = 'Embarcadero RESTClient/' + RESTCLIENT_VERSION;
13 |
14 | type
15 | TAmazonDelphiRestClient = class(TInterfacedObject, IAmazonRestClient)
16 | private
17 | fsAccept: string;
18 | fsAcceptCharset: string;
19 | fsContent_type: string;
20 | fiErrorCode: Integer;
21 | fsErrorMessage: String;
22 | fsUserAgent: string;
23 | FHttpClient: TRESTHTTP;
24 | protected
25 | function GetResponseCode: Integer;
26 | function GetResponseText: String;
27 | function GetContent_type: string;
28 | function GetErrorCode: Integer;
29 | procedure SetContent_type(value: string);
30 | function GetErrorMessage: String;
31 | function GetAcceptCharset: string;
32 | procedure SetAcceptCharset(value: string);
33 | function GetAccept: string;
34 | procedure SetAccept(value: string);
35 | function GetUserAgent: string;
36 | procedure SetUserAgent(value: string);
37 | public
38 | constructor Create;
39 | destructor Destory;
40 |
41 | procedure AddHeader(aName, aValue: UTF8String);
42 |
43 | procedure Post(aUrl: string; aRequest: UTF8String;
44 | var aResponse: UTF8String);
45 |
46 | property ResponseCode: Integer read GetResponseCode;
47 | property ResponseText: string read GetResponseText;
48 | property Content_type: String read GetContent_type write SetContent_type;
49 | property ErrorCode: Integer read GetErrorCode;
50 | property ErrorMessage: String read GetErrorMessage;
51 |
52 | property UserAgent: string read GetUserAgent write SetUserAgent;
53 | property AcceptCharset: string read GetAcceptCharset write SetAcceptCharset;
54 | property Accept: string read GetAccept write SetAccept;
55 | end;
56 |
57 | implementation
58 |
59 | constructor TAmazonDelphiRestClient.Create;
60 | begin
61 | fsContent_type := '';
62 | fiErrorCode := 0;
63 | fsErrorMessage := '';
64 | fsAccept := '';
65 | fsAcceptCharset :='';
66 | fsUserAgent := '';
67 |
68 | FHttpClient := TRESTHTTP.Create;
69 | end;
70 |
71 | destructor TAmazonDelphiRestClient.Destory;
72 | begin
73 | FHttpClient.Free;
74 | end;
75 |
76 | procedure TAmazonDelphiRestClient.AddHeader(aName, aValue: UTF8String);
77 | begin
78 | FHttpClient.Request.CustomHeaders.SetValue(aName, aValue);
79 | end;
80 |
81 | procedure TAmazonDelphiRestClient.Post(aUrl: string; aRequest: UTF8String;
82 | var aResponse: UTF8String);
83 | Var
84 | FSource, FResponseContent: TStringStream;
85 | begin
86 | Try
87 | Try
88 | FSource := TStringStream.Create(aRequest, TEncoding.ANSI);
89 | FSource.Position := 0;
90 |
91 | FResponseContent := TStringStream.Create;
92 |
93 | FHttpClient.Request.Accept := Accept;
94 | FHttpClient.Request.AcceptCharset := AcceptCharset;
95 | FHttpClient.Request.UserAgent := UserAgent;
96 | FHttpClient.Request.ContentType := Content_type;
97 |
98 | FHttpClient.Post(aUrl, FSource, FResponseContent);
99 |
100 | aResponse := FResponseContent.DataString;
101 |
102 | Except
103 | on E: Exception do
104 | begin
105 | // fiErrorCode := E.Message
106 | fsErrorMessage := E.Message;
107 |
108 | if Trim(aResponse) = '' then
109 | aResponse := fsErrorMessage;
110 | end;
111 | end;
112 | Finally
113 | FResponseContent.Free;
114 | FSource.Free;
115 | End;
116 | end;
117 |
118 | function TAmazonDelphiRestClient.GetResponseCode: Integer;
119 | begin
120 | Result := FHttpClient.ResponseCode;
121 | end;
122 |
123 | function TAmazonDelphiRestClient.GetResponseText: String;
124 | begin
125 | Result := FHttpClient.ResponseText;
126 | end;
127 |
128 | function TAmazonDelphiRestClient.GetContent_type: string;
129 | begin
130 | Result := fsContent_type;
131 | end;
132 |
133 | function TAmazonDelphiRestClient.GetErrorCode: Integer;
134 | begin
135 | Result := fiErrorCode;
136 | end;
137 |
138 | procedure TAmazonDelphiRestClient.SetContent_type(value: string);
139 | begin
140 | fsContent_type := value;
141 | end;
142 |
143 | function TAmazonDelphiRestClient.GetErrorMessage: String;
144 | begin
145 | Result := fsErrorMessage;
146 | end;
147 |
148 | function TAmazonDelphiRestClient.GetUserAgent: string;
149 | begin
150 | if Trim(fsUserAgent) = '' then
151 | fsUserAgent := cUserAgent;
152 |
153 | Result := fsUserAgent;
154 | end;
155 |
156 | procedure TAmazonDelphiRestClient.SetUserAgent(value: string);
157 | begin
158 | fsUserAgent := value;
159 | end;
160 |
161 | function TAmazonDelphiRestClient.GetAcceptCharset: string;
162 | begin
163 | if Trim(fsAcceptCharset) = '' then
164 | fsAcceptCharset := cAcceptCharset;
165 |
166 | Result := fsAcceptCharset;
167 | end;
168 |
169 | procedure TAmazonDelphiRestClient.SetAcceptCharset(value: string);
170 | begin
171 | fsAcceptCharset := value;
172 | end;
173 |
174 | function TAmazonDelphiRestClient.GetAccept: string;
175 | begin
176 | if Trim(fsAccept) = '' then
177 | fsAccept := cAccept;
178 |
179 | Result := fsAccept;
180 | end;
181 |
182 | procedure TAmazonDelphiRestClient.SetAccept(value: string);
183 | begin
184 | fsAccept := value;
185 | end;
186 |
187 | end.
188 |
--------------------------------------------------------------------------------
/Source/DelphiVersions.inc:
--------------------------------------------------------------------------------
1 | {********************************************************************}
2 | { }
3 | { DelphiVersions.inc }
4 | { }
5 | { Apache License }
6 | { Version 2.0, January 2004 }
7 | { License at http://www.apache.org/licenses/ }
8 | { }
9 | { }
10 | { Copyright (c) 2017 - 2021 Novuslogic Software }
11 | { http://www.novuslogic.com }
12 | { }
13 | {********************************************************************}
14 |
15 |
16 | (* http://docwiki.embarcadero.com/RADStudio/Alexandria/en/Compiler_Versions *)
17 |
18 | (* Delphi 11 / C++Builder Delphi 11 Alexandria / D28)
19 | {$IFDEF VER350}
20 | {$DEFINE DELPHI11}
21 | {$ENDIF}
22 |
23 | (* Delphi 10.4 / C++Builder Sydney / D27 *)
24 | {$IFDEF VER340}
25 | {$DEFINE DELPHI10_4}
26 | {$ENDIF}
27 |
28 | (* Delphi 10.3 / C++Builder Rio / D26 *)
29 | {$IFDEF VER330}
30 | {$DEFINE DELPHI10_3}
31 | {$ENDIF}
32 |
33 | (* Delphi 10.2 Tokyo / C++Builder Tokyo / D25 *)
34 | {$IFDEF VER320}
35 | {$DEFINE DELPHI10_2}
36 | {$ENDIF}
37 |
38 | (* Delphi 10.1 Berlin / C++Builder Berlin / D24 *)
39 | {$IFDEF VER310}
40 | {$DEFINE DELPHI10_1}
41 | {$ENDIF}
42 |
43 | (* Delphi 10 Seattle / C++Builder Seattle / D23 *)
44 | {$IFDEF VER300}
45 | {$DEFINE DELPHI10}
46 | {$ENDIF}
47 |
48 | (* Delphi XE8 / C++Builder XE8 / D22 *)
49 | {$IFDEF VER290}
50 | {$DEFINE DELPHIXE8}
51 | {$ENDIF}
52 |
53 | (* Delphi XE7 / C++Builder XE7 / D21 *)
54 | {$IFDEF VER280}
55 | {$DEFINE DELPHIXE7}
56 | {$ENDIF}
57 |
58 | (* Delphi XE6 / C++Builder XE6 / D20 *)
59 | {$IFDEF VER270}
60 | {$DEFINE DELPHIXE6}
61 | {$ENDIF}
62 |
63 | (* Delphi XE5 / C++Builder XE5 / D19 *)
64 | {$IFDEF VER260}
65 | {$DEFINE DELPHIXE5}
66 | {$ENDIF}
67 |
68 | (* Delphi XE4 / C++Builder XE4 / D18 *)
69 | {$IFDEF VER250}
70 | {$DEFINE DELPHIXE4}
71 | {$ENDIF}
72 |
73 | (* Delphi XE3 / C++Builder XE3 / D17 *)
74 | {$IFDEF VER240}
75 | {$DEFINE DELPHIXE3}
76 | {$ENDIF}
77 |
78 | (* Delphi XE2 / C++Builder XE2 / D16 *)
79 | {$IFDEF VER230}
80 | {$DEFINE DELPHIXE2}
81 | {$ENDIF}
82 |
83 | (* Delphi XE / C++Builder XE (Win32) / D15 *)
84 | {$IFDEF VER220}
85 | {$DEFINE DELPHIXE}
86 | {$ENDIF}
87 |
88 | (* Delphi 2010 / C++Builder 2010 (Win32) / D16 *)
89 | {$IFDEF VER210}
90 | {$DEFINE DELPHI2010}
91 | {$ENDIF}
92 |
93 | (* Delphi 2009 / C++Builder 2009 (Win32) D15 *)
94 | {$IFDEF VER200}
95 | {$DEFINE DELPHI2009}
96 | {$ENDIF}
97 |
98 | (* Delphi 2007 / C++Builder 2007 for Win32 D14 *)
99 | {$IFDEF VER180}
100 | {$DEFINE DELPHI2007}
101 | {$ENDIF}
102 | {$IFDEF VER185}
103 | {$DEFINE DELPHI2007_1}
104 | {$ENDIF}
105 |
106 | {$IFDEF DELPHI11}
107 | {$DEFINE DELPHI11_UP}
108 | {$DEFINE DELPHI10_4_UP}
109 | {$DEFINE DELPHI10_3_UP}
110 | {$DEFINE DELPHI10_2_UP}
111 | {$DEFINE DELPHI10_1_UP}
112 | {$DEFINE DELPHI10_UP}
113 | {$DEFINE DELPHIXE8_UP}
114 | {$DEFINE DELPHIXE7_UP}
115 | {$DEFINE DELPHIXE6_UP}
116 | {$DEFINE DELPHI2009_UP}
117 | {$ENDIF}
118 |
119 |
120 | {$IFDEF DELPHI10_4}
121 | {$DEFINE DELPHI10_4_UP}
122 | {$DEFINE DELPHI10_3_UP}
123 | {$DEFINE DELPHI10_2_UP}
124 | {$DEFINE DELPHI10_1_UP}
125 | {$DEFINE DELPHI10_UP}
126 | {$DEFINE DELPHIXE8_UP}
127 | {$DEFINE DELPHIXE7_UP}
128 | {$DEFINE DELPHIXE6_UP}
129 | {$DEFINE DELPHI2009_UP}
130 | {$ENDIF}
131 |
132 | {$IFDEF DELPHI10_3}
133 | {$DEFINE DELPHI10_3_UP}
134 | {$DEFINE DELPHI10_2_UP}
135 | {$DEFINE DELPHI10_1_UP}
136 | {$DEFINE DELPHI10_UP}
137 | {$DEFINE DELPHIXE8_UP}
138 | {$DEFINE DELPHIXE7_UP}
139 | {$DEFINE DELPHIXE6_UP}
140 | {$DEFINE DELPHI2009_UP}
141 | {$ENDIF}
142 |
143 | {$IFDEF DELPHI10_2}
144 | {$DEFINE DELPHI10_2_UP}
145 | {$DEFINE DELPHI10_1_UP}
146 | {$DEFINE DELPHI10_UP}
147 | {$DEFINE DELPHIXE8_UP}
148 | {$DEFINE DELPHIXE7_UP}
149 | {$DEFINE DELPHIXE6_UP}
150 | {$DEFINE DELPHI2009_UP}
151 | {$ENDIF}
152 |
153 | {$IFDEF DELPHI10_1}
154 | {$DEFINE DELPHI10_1_UP}
155 | {$DEFINE DELPHI10_UP}
156 | {$DEFINE DELPHIXE8_UP}
157 | {$DEFINE DELPHIXE7_UP}
158 | {$DEFINE DELPHIXE6_UP}
159 | {$DEFINE DELPHI2009_UP}
160 | {$ENDIF}
161 |
162 | {$IFDEF DELPHI10}
163 | {$DEFINE DELPHI10_UP}
164 | {$DEFINE DELPHIXE8_UP}
165 | {$DEFINE DELPHIXE7_UP}
166 | {$DEFINE DELPHIXE6_UP}
167 | {$DEFINE DELPHI2009_UP}
168 | {$ENDIF}
169 |
170 | {$IFDEF DELPHIXE8}
171 | {$DEFINE DELPHIXE8_UP}
172 | {$DEFINE DELPHIXE7_UP}
173 | {$DEFINE DELPHIXE6_UP}
174 | {$DEFINE DELPHI2009_UP}
175 | {$ENDIF}
176 |
177 | {$IFDEF DELPHIXE7}
178 | {$DEFINE DELPHIXE7_UP}
179 | {$DEFINE DELPHIXE6_UP}
180 | {$DEFINE DELPHI2009_UP}
181 | {$ENDIF}
182 |
183 | {$IFDEF DELPHIXE6}
184 | {$DEFINE DELPHIXE6_UP}
185 | {$DEFINE DELPHI2009_UP}
186 | {$ENDIF}
187 |
188 | {$IFDEF DELPHIXE5}
189 | {$DEFINE DELPHI2009_UP}
190 | {$ENDIF}
191 |
192 | {$IFDEF DELPHIXE4}
193 | {$DEFINE DELPHI2009_UP}
194 | {$ENDIF}
195 |
196 | {$IFDEF DELPHIXE3}
197 | {$DEFINE DELPHI2009_UP}
198 | {$ENDIF}
199 |
200 | {$IFDEF DELPHIXE2}
201 | {$DEFINE DELPHI2009_UP}
202 | {$ENDIF}
203 |
204 | {$IFDEF DELPHIXE}
205 | {$DEFINE DELPHI2009_UP}
206 | {$ENDIF}
207 |
208 | {$IFDEF DELPHI2010}
209 | {$DEFINE DELPHI2009_UP}
210 | {$ENDIF}
211 |
212 | {$IFDEF DELPHI2009}
213 | {$DEFINE DELPHI2009_UP}
214 | {$ENDIF}
215 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.SignatureV4.pas:
--------------------------------------------------------------------------------
1 | {$I ..\DelphiVersions.Inc}
2 | unit Amazon.SignatureV4;
3 |
4 | interface
5 |
6 | Uses Classes, Amazon.Utils, SysUtils, IdGlobal, Amazon.Interfaces,
7 | Amazon.Request;
8 |
9 | const
10 | awsALGORITHM = 'AWS4-HMAC-SHA256';
11 | awsSIGN = 'AWS4';
12 | awsContent_typeV4 = 'application/x-amz-json-1.0';
13 |
14 |
15 | {$IFDEF DELPHIXE8_UP}
16 | function GetSignatureV4Key(aSecret_Access_Key, adateStamp, aregionName, aserviceName: UTF8String): TBytes;
17 | {$ELSE}
18 | function GetSignatureV4Key(aSecret_Access_Key, adateStamp, aregionName,
19 | aserviceName: UTF8String): TidBytes;
20 | {$ENDIF}
21 |
22 |
23 | {$IFDEF DELPHIXE8_UP}
24 | function GetSignatureV4(aSignatureV4Key: TBytes; aString_to_sign: UTF8String)
25 | : UTF8String;
26 | {$ELSE}
27 | function GetSignatureV4(aSignatureV4Key: TidBytes; aString_to_sign: UTF8String)
28 | : UTF8String;
29 | {$ENDIF}
30 |
31 | type
32 | TAmazonSignatureV4 = class(TInterfacedObject, IAmazonSignature)
33 | protected
34 | private
35 | fsmethod: UTF8String;
36 | fscontent_type: UTF8String;
37 | fsresponse: UTF8String;
38 | fscanonical_uri: UTF8String;
39 | fscanonical_queryString: UTF8String;
40 | fscanonical_headers: UTF8String;
41 | fssigned_headers: UTF8String;
42 | fspayload_hash: UTF8String;
43 | fscanonical_request: UTF8String;
44 | fsalgorithm: UTF8String;
45 | fscredential_scope: UTF8String;
46 | fsString_to_sign: UTF8String;
47 |
48 | {$IFDEF DELPHIXE8_UP}
49 | fSignatureV4Key: TBytes;
50 | {$ELSE}
51 | fSignatureV4Key: TidBytes;
52 | {$ENDIF}
53 |
54 | fsSignature: UTF8String;
55 | fsauthorization_header: UTF8String;
56 |
57 | function getsignature: UTF8String;
58 | function getauthorization_header: UTF8String;
59 | public
60 | procedure Sign(aRequest: IAmazonRequest);
61 | function GetContent_type: UTF8String;
62 |
63 | property Signature: UTF8String read getsignature;
64 | property Authorization_header: UTF8String read getauthorization_header;
65 |
66 | end;
67 |
68 | implementation
69 |
70 | {$IFDEF DELPHIXE8_UP}
71 | function GetSignatureV4Key(aSecret_Access_Key, adateStamp, aregionName,
72 | aserviceName: UTF8String): TBytes;
73 | Var
74 | kService: TBytes;
75 | kRegion: TBytes;
76 | kSecret: TBytes;
77 | kDate: TBytes;
78 | kSigning: TBytes;
79 | begin
80 | kSecret := BytesOf(UTF8Encode(awsSIGN + aSecret_Access_Key));
81 | kDate := HmacSHA256Ex(kSecret, adateStamp);
82 | kRegion := HmacSHA256Ex(kDate, aregionName);
83 | kService := HmacSHA256Ex(kRegion, aserviceName);
84 | kSigning := HmacSHA256Ex(kService, 'aws4_request');
85 |
86 | Result := kSigning;
87 | end;
88 | {$ELSE}
89 | function GetSignatureV4Key(aSecret_Access_Key, adateStamp, aregionName,
90 | aserviceName: UTF8String): TidBytes;
91 | Var
92 | kService: TidBytes;
93 | kRegion: TidBytes;
94 | kSecret: TidBytes;
95 | kDate: TidBytes;
96 | kSigning: TidBytes;
97 | begin
98 | kSecret := ToBytes(UTF8Encode(awsSIGN + aSecret_Access_Key));
99 | kDate := HmacSHA256Ex(kSecret, adateStamp);
100 | kRegion := HmacSHA256Ex(kDate, aregionName);
101 | kService := HmacSHA256Ex(kRegion, aserviceName);
102 | kSigning := HmacSHA256Ex(kService, 'aws4_request');
103 |
104 | Result := kSigning;
105 | end;
106 | {$ENDIF}
107 |
108 |
109 | {$IFDEF DELPHIXE8_UP}
110 | function GetSignatureV4(aSignatureV4Key: TBytes; aString_to_sign: UTF8String)
111 | : UTF8String;
112 | begin
113 | Result := BytesToHex(HmacSHA256Ex(aSignatureV4Key, aString_to_sign));
114 | end;
115 | {$ELSE}
116 | function GetSignatureV4(aSignatureV4Key: TidBytes; aString_to_sign: UTF8String)
117 | : UTF8String;
118 | begin
119 | Result := BytesToHex(HmacSHA256Ex(aSignatureV4Key, aString_to_sign));
120 | end;
121 | {$ENDIF}
122 |
123 | procedure TAmazonSignatureV4.Sign(aRequest: IAmazonRequest);
124 | begin
125 | fsSignature := '';
126 | fsauthorization_header := '';
127 |
128 | fsmethod := 'POST';
129 |
130 | fscontent_type := GetContent_type;
131 |
132 | fscanonical_uri := '/';
133 |
134 | fscanonical_queryString := '';
135 |
136 | fscanonical_headers := 'content-type:' + fscontent_type + char(10) + 'host:' +
137 | aRequest.host + char(10) + 'x-amz-date:' + aRequest.amz_date + char(10) +
138 | 'x-amz-target:' + aRequest.targetPrefix + '.' + aRequest.operationName
139 | + char(10);
140 |
141 | fssigned_headers := 'content-type;host;x-amz-date;x-amz-target';
142 |
143 | fspayload_hash := HashSHA256(aRequest.request_parameters);
144 |
145 | fscanonical_request := fsmethod + char(10) + fscanonical_uri + char(10) +
146 | fscanonical_queryString + char(10) + fscanonical_headers + char(10) +
147 | fssigned_headers + char(10) + fspayload_hash;
148 |
149 | fsalgorithm := awsALGORITHM;
150 | fscredential_scope := aRequest.date_stamp + '/' + aRequest.region + '/' +
151 | aRequest.service + '/' + 'aws4_request';
152 |
153 | fsString_to_sign := fsalgorithm + char(10) + aRequest.amz_date + char(10) +
154 | fscredential_scope + char(10) + HashSHA256(fscanonical_request);
155 |
156 | fSignatureV4Key := GetSignatureV4Key(aRequest.secret_key, aRequest.date_stamp,
157 | aRequest.region, aRequest.service);
158 |
159 | fsSignature := GetSignatureV4(fSignatureV4Key, fsString_to_sign);
160 |
161 | fsauthorization_header := fsalgorithm + ' ' + 'Credential=' +
162 | aRequest.access_key + '/' + fscredential_scope + ', ' + 'SignedHeaders=' +
163 | fssigned_headers + ', ' + 'Signature=' + fsSignature;
164 | end;
165 |
166 | function TAmazonSignatureV4.getsignature: UTF8String;
167 | begin
168 | Result := fsSignature;
169 | end;
170 |
171 | function TAmazonSignatureV4.getauthorization_header: UTF8String;
172 | begin
173 | Result := fsauthorization_header;
174 | end;
175 |
176 | function TAmazonSignatureV4.GetContent_type: UTF8String;
177 | begin
178 | Result := awsContent_typeV4;
179 | end;
180 |
181 | end.
182 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Request.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Request;
2 |
3 | interface
4 |
5 | Uses Amazon.Interfaces;
6 |
7 | type
8 | TAmazonRequest = class(TInterfacedObject, IAmazonRequest)
9 | private
10 | fsAuthorization_header: UTF8String;
11 | fsamz_date: UTF8String;
12 | fsdate_stamp: UTF8String;
13 | fssecret_key: UTF8String;
14 | fsaccess_key: UTF8String;
15 | fsservice: UTF8String;
16 | fsendpoint: UTF8String;
17 | fstargetPrefix: UTF8String;
18 | fsregion: UTF8String;
19 | fsrequest_parameters: UTF8String;
20 | fshost: UTF8String;
21 | fsoperationName: UTF8String;
22 | protected
23 | function gettarget: UTF8String;
24 | function getsecret_key: UTF8String;
25 | procedure setsecret_key(value: UTF8String);
26 | function getaccess_key: UTF8String;
27 | procedure setaccess_key(value: UTF8String);
28 | function gettargetPrefix: UTF8String;
29 | procedure settargetPrefix(value: UTF8String);
30 | function getservice: UTF8String;
31 | procedure setservice(value: UTF8String);
32 | function getendpoint: UTF8String;
33 | procedure setendpoint(value: UTF8String);
34 | function getregion: UTF8String;
35 | procedure setregion(value: UTF8String);
36 | function getrequest_parameters: UTF8String;
37 | procedure setrequest_parameters(value: UTF8String);
38 | function gethost: UTF8String;
39 | procedure sethost(value: UTF8String);
40 | function getamz_date: UTF8String;
41 | procedure setamz_date(value: UTF8String);
42 | function getdate_stamp: UTF8String;
43 | procedure setdate_stamp(value: UTF8String);
44 | function getoperationName: UTF8String;
45 | procedure setoperationName(value: UTF8String);
46 | function getauthorization_header: UTF8String;
47 | procedure setauthorization_header(value: UTF8String);
48 | public
49 | property secret_key: UTF8String read getsecret_key write setsecret_key;
50 | property access_key: UTF8String read getaccess_key write setaccess_key;
51 |
52 | property targetPrefix: UTF8String read gettargetPrefix
53 | write settargetPrefix;
54 | property operationName: UTF8String read getoperationName
55 | write setoperationName;
56 | property service: UTF8String read getservice write setservice;
57 | property endpoint: UTF8String read getendpoint write setendpoint;
58 |
59 | property host: UTF8String read gethost write sethost;
60 | property region: UTF8String read getregion write setregion;
61 | property request_parameters: UTF8String read getrequest_parameters
62 | write setrequest_parameters;
63 |
64 | property amz_date: UTF8String read getamz_date write setamz_date;
65 | property date_stamp: UTF8String read getdate_stamp write setdate_stamp;
66 | property authorization_header: UTF8String read getauthorization_header
67 | write setauthorization_header;
68 |
69 | property target: UTF8String read gettarget;
70 | end;
71 |
72 | implementation
73 |
74 | function TAmazonRequest.getsecret_key: UTF8String;
75 | begin
76 | Result := fssecret_key;
77 | end;
78 |
79 | procedure TAmazonRequest.setsecret_key(value: UTF8String);
80 | begin
81 | fssecret_key := value;
82 | end;
83 |
84 | function TAmazonRequest.getrequest_parameters: UTF8String;
85 | begin
86 | Result := fsrequest_parameters;
87 | end;
88 |
89 | procedure TAmazonRequest.setrequest_parameters(value: UTF8String);
90 | begin
91 | fsrequest_parameters := value;
92 | end;
93 |
94 | function TAmazonRequest.getaccess_key: UTF8String;
95 | begin
96 | Result := fsaccess_key;
97 | end;
98 |
99 | procedure TAmazonRequest.setaccess_key(value: UTF8String);
100 | begin
101 | fsaccess_key := value;
102 | end;
103 |
104 | function TAmazonRequest.gettargetPrefix: UTF8String;
105 | begin
106 | Result := fstargetPrefix;
107 | end;
108 |
109 | procedure TAmazonRequest.settargetPrefix(value: UTF8String);
110 | begin
111 | fstargetPrefix := value;
112 | end;
113 |
114 | function TAmazonRequest.getservice: UTF8String;
115 | begin
116 | Result := fsservice;
117 | end;
118 |
119 | procedure TAmazonRequest.setservice(value: UTF8String);
120 | begin
121 | fsservice := value;
122 | end;
123 |
124 | function TAmazonRequest.getregion: UTF8String;
125 | begin
126 | Result := fsregion;
127 | end;
128 |
129 | procedure TAmazonRequest.setregion(value: UTF8String);
130 | begin
131 | fsregion := value;
132 | end;
133 |
134 | function TAmazonRequest.gethost: UTF8String;
135 | begin
136 | Result := fshost;
137 | end;
138 |
139 | procedure TAmazonRequest.sethost(value: UTF8String);
140 | begin
141 | fshost := value;
142 | end;
143 |
144 | function TAmazonRequest.getendpoint: UTF8String;
145 | begin
146 | Result := fsendpoint;
147 | end;
148 |
149 | procedure TAmazonRequest.setendpoint(value: UTF8String);
150 | begin
151 | fsendpoint := value;
152 | end;
153 |
154 | function TAmazonRequest.getamz_date: UTF8String;
155 | begin
156 | Result := fsamz_date;
157 | end;
158 |
159 | procedure TAmazonRequest.setamz_date(value: UTF8String);
160 | begin
161 | fsamz_date := value;
162 | end;
163 |
164 | function TAmazonRequest.getdate_stamp: UTF8String;
165 | begin
166 | Result := fsdate_stamp;
167 | end;
168 |
169 | procedure TAmazonRequest.setdate_stamp(value: UTF8String);
170 | begin
171 | fsdate_stamp := value;
172 | end;
173 |
174 | function TAmazonRequest.getoperationName: UTF8String;
175 | begin
176 | Result := fsoperationName;
177 | end;
178 |
179 | procedure TAmazonRequest.setoperationName(value: UTF8String);
180 | begin
181 | fsoperationName := value;
182 | end;
183 |
184 | procedure TAmazonRequest.setauthorization_header(value: UTF8String);
185 | begin
186 | fsAuthorization_header := value;
187 | end;
188 |
189 | function TAmazonRequest.getauthorization_header: UTF8String;
190 | begin
191 | Result := fsAuthorization_header;
192 | end;
193 |
194 | function TAmazonRequest.gettarget: UTF8String;
195 | begin
196 | Result := targetPrefix + '.' + operationName;
197 | end;
198 |
199 | end.
200 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.IndyRESTClient.pas:
--------------------------------------------------------------------------------
1 | {$I ..\DelphiVersions.Inc}
2 | unit Amazon.IndyRestClient;
3 |
4 | interface
5 |
6 | uses IdSSLOpenSSL, {IPPeerAPI,} IdHttp, classes, SysUtils, IdStack, IdGlobal,
7 | {IPPeerClient,} Amazon.Interfaces;
8 |
9 | type
10 | TAmazonIndyRestClient = class(TInterfacedObject, IAmazonRestClient)
11 | private
12 | fsAccept: string;
13 | fsAcceptCharset: string;
14 | fsContent_type: string;
15 | fiErrorCode: Integer;
16 | fsErrorMessage: String;
17 | fsUserAgent: string;
18 | //FIdHttp: IIPHTTP;
19 | FIdHttp: TIDHttp;
20 | protected
21 | function GetAcceptCharset: string;
22 | procedure SetAcceptCharset(value: string);
23 | function GetResponseCode: Integer;
24 | function GetResponseText: String;
25 | function GetContent_type: string;
26 | function GetErrorCode: Integer;
27 | procedure SetContent_type(value: string);
28 | function GetErrorMessage: String;
29 | function GetUserAgent: string;
30 | procedure SetUserAgent(value:string);
31 | function GetAccept: string;
32 | procedure SetAccept(value: string);
33 | public
34 | constructor Create;
35 | destructor Destory;
36 |
37 | procedure AddHeader(aName, aValue: UTF8String);
38 |
39 | procedure Post(aUrl: string; aRequest: UTF8String;
40 | var aResponse: UTF8String);
41 |
42 | property ResponseCode: Integer read GetResponseCode;
43 | property ResponseText: string read GetResponseText;
44 | property Content_type: String read GetContent_type write SetContent_type;
45 | property ErrorCode: Integer read GetErrorCode;
46 | property ErrorMessage: String read GetErrorMessage;
47 |
48 | property UserAgent: string read GetUserAgent write SetUserAgent;
49 | property AcceptCharset: string read GetAcceptCharset write SetAcceptCharset;
50 | property Accept: string read GetAccept write SetAccept;
51 | end;
52 |
53 | implementation
54 |
55 | constructor TAmazonIndyRestClient.Create;
56 | begin
57 | fsContent_type := '';
58 | fiErrorCode := 0;
59 | fsErrorMessage := '';
60 |
61 | FIdHttp := tIDHttp.Create(NIL);
62 | FIdHttp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(NIL);
63 |
64 | //FIdHttp := PeerFactory.CreatePeer('', IIPHTTP, nil) as IIPHTTP;
65 | // FIdHttp.IOHandler := PeerFactory.CreatePeer('', IIPSSLIOHandlerSocketOpenSSL,
66 | // nil) as IIPSSLIOHandlerSocketOpenSSL;
67 |
68 | FIdHttp.Request.CustomHeaders.FoldLines := false;
69 |
70 | end;
71 |
72 | destructor TAmazonIndyRestClient.Destory;
73 | begin
74 | FreeandNil(FIdHttp);
75 | end;
76 |
77 | procedure TAmazonIndyRestClient.AddHeader(aName, aValue: UTF8String);
78 | begin
79 | FIdHttp.Request.CustomHeaders.AddValue(aName, aValue);
80 | end;
81 |
82 | procedure TAmazonIndyRestClient.Post(aUrl: string; aRequest: UTF8String;
83 | var aResponse: UTF8String);
84 | Var
85 | FSource, FResponseContent: TStringStream;
86 | begin
87 |
88 | try
89 | {$IFNDEF FPC}
90 | FSource := TStringStream.Create(aRequest, TEncoding.ANSI);
91 | {$ELSE}
92 | FSource := TStringStream.Create(aRequest);
93 | {$ENDIF}
94 |
95 | FSource.Position := 0;
96 |
97 | FResponseContent := TStringStream.Create('');
98 |
99 | FIdHttp.Request.ContentType := Content_type;
100 | {$IFDEF DELPHIXE8_UP}
101 | FIdHttp.Request.UserAgent := UserAgent;
102 | {$ENDIF}
103 |
104 |
105 | FIdHttp.Request.Accept := Accept;
106 | {$IFDEF DELPHIXE8_UP}
107 | FIdHttp.Request.AcceptCharset := AcceptCharset;
108 | {$ENDIF}
109 |
110 | //FIdHttp.DoPost(aUrl, FSource, FResponseContent);
111 | FIdHttp.Post(aUrl, FSource, FResponseContent);
112 |
113 | aResponse := FResponseContent.DataString;
114 |
115 | FResponseContent.Free;
116 | FSource.Free;
117 |
118 | except
119 | on E: EIdHTTPProtocolException do
120 | begin
121 | fiErrorCode := E.ErrorCode;
122 | fsErrorMessage := E.ErrorMessage;
123 |
124 | if Trim(aResponse) = '' then
125 | aResponse := fsErrorMessage;
126 |
127 | FIdHttp.Disconnect;
128 |
129 | end;
130 |
131 | end;
132 | end;
133 |
134 | function TAmazonIndyRestClient.GetResponseCode: Integer;
135 | begin
136 | Result := FIdHttp.ResponseCode;
137 | end;
138 |
139 | function TAmazonIndyRestClient.GetResponseText: String;
140 | begin
141 | Result := FIdHttp.ResponseText;
142 | end;
143 |
144 | function TAmazonIndyRestClient.GetContent_type: string;
145 | begin
146 | Result := fsContent_type;
147 | end;
148 |
149 | function TAmazonIndyRestClient.GetErrorCode: Integer;
150 | begin
151 | Result := fiErrorCode;
152 | end;
153 |
154 | procedure TAmazonIndyRestClient.SetContent_type(value: string);
155 | begin
156 | fsContent_type := value;
157 | end;
158 |
159 | function TAmazonIndyRestClient.GetErrorMessage: String;
160 | begin
161 | Result := fsErrorMessage;
162 | end;
163 |
164 | function TAmazonIndyRestClient.GetUserAgent: string;
165 | begin
166 | if (Trim(fsUserAgent) = '') then
167 | begin
168 | {$IFDEF DELPHIXE8_UP}
169 | if Assigned(FIdHttp.Request) then
170 | fsUserAgent := FIdHttp.Request.UserAgent;
171 | {$ENDIF}
172 | end;
173 |
174 | Result := fsUserAgent;
175 | end;
176 |
177 | procedure TAmazonIndyRestClient.SetUserAgent(value:string);
178 | begin
179 | fsUserAgent := value;
180 | end;
181 |
182 | function TAmazonIndyRestClient.GetAcceptCharset: string;
183 | begin
184 | if Trim(fsAcceptCharset) = '' then
185 | begin
186 | {$IFDEF DELPHIXE8_UP}
187 | if Assigned(FIdHttp.Request) then
188 | fsAcceptCharset := FIdHttp.Request.AcceptCharSet;
189 | {$ENDIF}
190 | end;
191 |
192 | Result := fsAcceptCharset;
193 | end;
194 |
195 | procedure TAmazonIndyRestClient.SetAcceptCharset(value:string);
196 | begin
197 | fsAcceptCharset := value;
198 | end;
199 |
200 |
201 | function TAmazonIndyRestClient.GetAccept: string;
202 | begin
203 | if Trim(fsAcceptCharset) = '' then
204 | begin
205 | if Assigned(FIdHttp.Request) then
206 | fsAccept := FIdHttp.Request.Accept;
207 | end;
208 |
209 | Result := fsAccept;
210 | end;
211 |
212 | procedure TAmazonIndyRestClient.SetAccept(value:string);
213 | begin
214 | fsAccept := value;
215 | end;
216 |
217 |
218 |
219 | end.
220 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Utils.pas:
--------------------------------------------------------------------------------
1 | {$I ..\DelphiVersions.Inc}
2 | unit Amazon.Utils;
3 |
4 | interface
5 |
6 | uses Classes,
7 |
8 | {$IFDEF DELPHIXE8_UP}
9 | System.Hash,
10 | System.JSON,
11 | {$ENDIF}
12 | {$IFNDEF FPC}
13 | System.SysUtils,
14 | System.DateUtils,
15 | Soap.XSBuiltIns,
16 | Data.DBXJSONReflect,
17 | Data.DBXJSON,
18 | {$ELSE}
19 | SysUtils,
20 | DateUtils,
21 |
22 | {$ENDIF}
23 | IdDateTimeStamp,
24 | idGlobal,
25 | IdHMACSHA1, IdSSLOpenSSL, IdHashSHA, IdHashMessageDigest, idHash;
26 |
27 |
28 |
29 |
30 |
31 | //function DateTimeToISO8601(const aDateTime: TDateTime): string;
32 | procedure GetAWSDate_Stamp(const aDateTime: TDateTime;
33 | var aamz_date, adate_stamp: UTF8String);
34 | function UTCNow: TDateTime;
35 |
36 |
37 | {$IFDEF DELPHIXE8_UP}
38 | function HmacSHA256Ex(const AKey: TBytes; aStr: UTF8String): TBytes;
39 | {$ELSE}
40 | function HmacSHA256Ex(const AKey: TidBytes; aStr: UTF8String): TidBytes;
41 | {$ENDIF}
42 |
43 | function BytesToHex(const Bytes: array of byte): string;
44 | function HexToBytes(const S: String): TidBytes;
45 | function HashSHA256(aStr: String): String;
46 | function GetAWSUserDir: UTF8String;
47 | function GetAWSHost(aendpoint: UTF8String): UTF8String;
48 | function DoubleQuotedStr(const S: UTF8String): UTF8String;
49 | // function DeepCopy(aValue: TObject): TObject;
50 |
51 | implementation
52 |
53 | function DoubleQuotedStr(const S: UTF8String): UTF8String;
54 | begin
55 | Result := S;
56 | Result := '"' + Result + '"';
57 | end;
58 |
59 |
60 | (*
61 |
62 |
63 | function DateTimeToISO8601(const aDateTime: TDateTime): string;
64 | Var
65 | D: TXSDateTime;
66 | Year, Month, Day: Word;
67 | Hour, Min, Sec, MSec: Word;
68 | FDateTime: TDateTime;
69 | begin
70 | DecodeDate(aDateTime, Year, Month, Day);
71 | DecodeTime(aDateTime, Hour, Min, Sec, MSec);
72 |
73 | FDateTime := EncodeDateTime(Year, Month, Day, Hour, Min, Sec, MSec);
74 |
75 | D := TXSDateTime.Create;
76 | D.AsDateTime := FDateTime;
77 |
78 | Result := D.NativeToXS;
79 |
80 | D.Free;
81 | end;
82 | *)
83 |
84 | // http://docs.aws.amazon.com/general/latest/gr/sigv4-date-handling.html
85 |
86 | procedure GetAWSDate_Stamp(const aDateTime: TDateTime;
87 | var aamz_date, adate_stamp: UTF8String);
88 | begin
89 | aamz_date := FormatDateTime('YYYYMMDD"T"HHMMSS"Z"', aDateTime);
90 |
91 | adate_stamp := FormatDateTime('YYYYMMDD', aDateTime);
92 | end;
93 |
94 | function UTCNow: TDateTime;
95 | begin
96 | {$IFNDEF FPC}
97 | Result := TTimeZone.Local.ToUniversalTime(Now);
98 | {$ELSE}
99 | Result := LocalTimeToUniversal(Now);
100 | {$ENDIF}
101 | end;
102 |
103 |
104 | {$IFDEF DELPHIXE8_UP}
105 | function HmacSHA256Ex(const AKey: TBytes; aStr: UTF8String): TBytes;
106 | Var
107 | FHash: THashSHA2;
108 | FData: TBytes;
109 | begin
110 | FHash := THashSHA2.Create(SHA256);
111 | FData := BytesOf(aStr);
112 | Result := FHash.GetHMACAsBytes(FData, aKey, SHA256);
113 | end;
114 | {$ELSE}
115 | function HmacSHA256Ex(const AKey: TidBytes; aStr: UTF8String): TidBytes;
116 | Var
117 | FHMACSHA256: TIdHMACSHA256;
118 | begin
119 | if not IdSSLOpenSSL.LoadOpenSSLLibrary then
120 | Exit;
121 |
122 | FHMACSHA256 := TIdHMACSHA256.Create;
123 | try
124 | FHMACSHA256.Key := AKey;
125 |
126 | Result := FHMACSHA256.HashValue(ToBytes(aStr));
127 | finally
128 | FHMACSHA256.Free;
129 | end;
130 | end;
131 | {$ENDIF}
132 |
133 |
134 | function BytesToHex(const Bytes: array of byte): string;
135 | const
136 | HexSymbols = '0123456789ABCDEF';
137 | var
138 | i: integer;
139 | lsOutput: String;
140 | begin
141 | SetLength(lsOutput, 2 * Length(Bytes));
142 | for i := 0 to Length(Bytes) - 1 do
143 | begin
144 | lsOutput[1 + 2 * i + 0] := HexSymbols[1 + Bytes[i] shr 4];
145 | lsOutput[1 + 2 * i + 1] := HexSymbols[1 + Bytes[i] and $0F];
146 | end;
147 |
148 | Result := Lowercase(lsOutput);
149 | end;
150 |
151 | function HexToBytes(const S: String): TidBytes;
152 | begin
153 | SetLength(Result, Length(S) div 2);
154 | SetLength(Result, HexToBin(PChar(S), Pointer(Result), Length(Result)));
155 | end;
156 |
157 | {$IFDEF DELPHIXE8_UP}
158 | function HashSHA256(aStr: String): String;
159 | var
160 | FHash: THashSHA2;
161 | LBytes: TArray;
162 | FBuffer: PByte;
163 | BufLen: Integer;
164 | Readed: Integer;
165 | FStream: TStringStream;
166 | begin
167 | BufLen := Length(aStr) * (4 * 1024);
168 |
169 | FBuffer := AllocMem(BufLen);
170 | FHash := THashSHA2.Create;
171 | FStream := TStringStream.Create(aStr);
172 | try
173 | while FStream.Position < FStream.Size do
174 | begin
175 | Readed := FStream.Read(FBuffer^, BufLen);
176 | if Readed > 0 then
177 | FHash.update(FBuffer^, Readed);
178 | end;
179 | finally
180 | FStream.Free;
181 | FreeMem(FBuffer);
182 | end;
183 |
184 | Result := FHash.HashAsString;
185 | end;
186 | {$ELSE}
187 | function HashSHA256(aStr: String): String;
188 | var
189 | FHashSHA256: TIdHashSHA256;
190 | begin
191 |
192 | if not IdSSLOpenSSL.LoadOpenSSLLibrary then
193 | Exit;
194 |
195 | FHashSHA256 := TIdHashSHA256.Create;
196 | try
197 | Result := Lowercase(FHashSHA256.HashStringAsHex(UTF8String(aStr)));
198 | finally
199 | FHashSHA256.Free;
200 | end;
201 | end;
202 | {$ENDIF}
203 |
204 |
205 | function GetAWSUserDir: UTF8String;
206 | begin
207 | Result := GetEnvironmentVariable('USERPROFILE') + '\.aws';
208 |
209 | if Not DirectoryExists(Result) then
210 | Result := '';
211 |
212 | end;
213 |
214 | function GetAWSHost(aendpoint: UTF8String): UTF8String;
215 | var
216 | fsnewhost: UTF8String;
217 | begin
218 | fsnewhost := StringReplace(aendpoint, 'http://', '',
219 | [rfReplaceAll, rfIgnoreCase]);
220 |
221 | fsnewhost := StringReplace(fsnewhost, 'https://', '',
222 | [rfReplaceAll, rfIgnoreCase]);
223 |
224 | Result := StringReplace(fsnewhost, '/', '', [rfReplaceAll, rfIgnoreCase]);
225 |
226 | end;
227 |
228 | (*
229 | function DeepCopy(aValue: TObject): TObject;
230 | var
231 | MarshalObj: TJSONMarshal;
232 | UnMarshalObj: TJSONUnMarshal;
233 | JSONValue: TJSONValue;
234 | begin
235 | Result := nil;
236 | MarshalObj := TJSONMarshal.Create;
237 | UnMarshalObj := TJSONUnMarshal.Create;
238 | try
239 | JSONValue := MarshalObj.Marshal(aValue);
240 | try
241 | if Assigned(JSONValue) then
242 | Result := UnMarshalObj.Unmarshal(JSONValue);
243 | finally
244 | JSONValue.Free;
245 | end;
246 | finally
247 | MarshalObj.Free;
248 | UnMarshalObj.Free;
249 | end;
250 | end;
251 | *)
252 |
253 | end.
254 |
--------------------------------------------------------------------------------
/Source/SDK/DynamoDB/Amazon.DynamoDB.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.DynamoDB;
2 |
3 | interface
4 |
5 | uses Amazon.Client, Amazon.Request, System.Classes, System.Generics.Collections,
6 | Amazon.Response, Amazon.Utils, Amazon.Marshaller, System.Rtti, System.TypInfo,
7 | Amazon.Interfaces, System.AnsiStrings, System.SysUtils;
8 |
9 | Const
10 | cDynamoDB_targetPrefix = 'DynamoDB_20120810';
11 | cDynamoDB_service = 'dynamodb';
12 |
13 | type
14 | TAmazonDynamoDBRequest = class(TAmazonRequest)
15 | protected
16 | private
17 | public
18 | Constructor Create; virtual;
19 | end;
20 |
21 | TAmazonDynamoDBMarshaller = class(TAmazonMarshaller)
22 | protected
23 | private
24 | public
25 | function AmazonDynamoDBRequestToJSON(aAmazonDynamoDBRequest
26 | : TAmazonDynamoDBRequest): UTF8String;
27 |
28 | end;
29 |
30 | TAmazonDynamoDBResponse = class(TAmazonResponse)
31 | protected
32 | private
33 | public
34 | constructor Create(aAmazonResponse: IAmazonResponse);
35 | end;
36 |
37 | TAmazonDynamoDBClient = class(TAmazonClient)
38 | protected
39 | private
40 | public
41 | procedure InitClient(aprofile: UTF8String; asecret_key: UTF8String;
42 | aaccess_key: UTF8String; aregion: UTF8String); override;
43 |
44 | [TAmazonMarshallerAttribute('CreateTable')]
45 | function CreateTable(aAmazonDynamoDBRequest: TAmazonDynamoDBRequest)
46 | : TAmazonDynamoDBResponse;
47 | end;
48 |
49 | [TAmazonMarshallerAttribute('ProvisionedThroughput')]
50 | TProvisionedThroughput = class(TObject)
51 | protected
52 | private
53 | fsReadCapacityUnits: Integer;
54 | fsWriteCapacityUnits: Integer;
55 | public
56 | published
57 | [TAmazonMarshallerAttribute('ReadCapacityUnits')]
58 | property ReadCapacityUnits: Integer read fsReadCapacityUnits
59 | write fsReadCapacityUnits;
60 | [TAmazonMarshallerAttribute('WriteCapacityUnits')]
61 | property WriteCapacityUnits: Integer read fsWriteCapacityUnits
62 | write fsWriteCapacityUnits;
63 | end;
64 |
65 | [TAmazonMarshallerAttribute('KeySchemaElement')]
66 | TKeySchemaElement = class(TObject)
67 | protected
68 | private
69 | fsAttributeName: UTF8String;
70 | fsKeyType: UTF8String;
71 | public
72 | constructor Create(aAttributeName: UTF8String = '';
73 | aKeyType: UTF8String = '');
74 | published
75 | [TAmazonMarshallerAttribute('AttributeName')]
76 | property AttributeName: UTF8String read fsAttributeName
77 | write fsAttributeName;
78 | [TAmazonMarshallerAttribute('KeyType')]
79 | property KeyType: UTF8String read fsKeyType write fsKeyType;
80 | end;
81 |
82 | [TAmazonMarshallerAttribute('AttributeDefinition')]
83 | TAttributeDefinition = class(TObject)
84 | protected
85 | private
86 | fsAttributeName: UTF8String;
87 | fsAttributeType: UTF8String;
88 | public
89 | constructor Create(aAttributeName: UTF8String = '';
90 | aAttributeType: UTF8String = '');
91 |
92 | published
93 | [TAmazonMarshallerAttribute('AttributeName')]
94 | property AttributeName: UTF8String read fsAttributeName
95 | write fsAttributeName;
96 | [TAmazonMarshallerAttribute('AttributeType')]
97 | property AttributeType: UTF8String read fsAttributeType
98 | write fsAttributeType;
99 | end;
100 |
101 | TCreateTableRequest = class(TAmazonDynamoDBRequest)
102 | protected
103 | private
104 | fsTableName: UTF8String;
105 | FAttributeDefinitions: TList;
106 | FKeySchema: TList;
107 | FProvisionedThroughput: TProvisionedThroughput;
108 | public
109 | constructor Create; override;
110 | destructor Destory;
111 |
112 | published
113 | [TAmazonMarshallerAttribute('TableName')]
114 | property TableName: UTF8String read fsTableName write fsTableName;
115 | [TAmazonMarshallerAttribute('AttributeDefinitions')]
116 | property AttributeDefinitions: TList
117 | read FAttributeDefinitions write FAttributeDefinitions;
118 | [TAmazonMarshallerAttribute('KeySchema')]
119 | property KeySchema: TList read FKeySchema
120 | write FKeySchema;
121 | [TAmazonMarshallerAttribute('ProvisionedThroughput')]
122 | property ProvisionedThroughput: TProvisionedThroughput
123 | read FProvisionedThroughput write FProvisionedThroughput;
124 | end;
125 |
126 | implementation
127 |
128 | Constructor TAmazonDynamoDBRequest.Create;
129 | begin
130 | targetPrefix := cDynamoDB_targetPrefix;
131 | end;
132 |
133 | constructor TKeySchemaElement.Create(aAttributeName: UTF8String = '';
134 | aKeyType: UTF8String = '');
135 | begin
136 | fsAttributeName := aAttributeName;
137 | fsKeyType := aKeyType;
138 | end;
139 |
140 | constructor TAttributeDefinition.Create(aAttributeName: UTF8String = '';
141 | aAttributeType: UTF8String = '');
142 | begin
143 | fsAttributeName := aAttributeName;
144 | fsAttributeType := aAttributeType;
145 | end;
146 |
147 | constructor TCreateTableRequest.Create;
148 | begin
149 | inherited;
150 |
151 | FAttributeDefinitions := TList.Create;
152 | FKeySchema := TList.Create;
153 | ProvisionedThroughput := TProvisionedThroughput.Create;
154 | end;
155 |
156 | destructor TCreateTableRequest.Destory;
157 | begin
158 | FProvisionedThroughput.Free;
159 | FKeySchema.Free;
160 | FAttributeDefinitions.Free;
161 | end;
162 |
163 | procedure TAmazonDynamoDBClient.InitClient(aprofile: UTF8String;
164 | asecret_key: UTF8String; aaccess_key: UTF8String; aregion: UTF8String);
165 | begin
166 | inherited InitClient(aprofile, asecret_key, aaccess_key, aregion);
167 |
168 | service := cDynamoDB_service;
169 | end;
170 |
171 | function TAmazonDynamoDBClient.CreateTable(aAmazonDynamoDBRequest
172 | : TAmazonDynamoDBRequest): TAmazonDynamoDBResponse;
173 | var
174 | FAmazonDynamoDBMarshaller: TAmazonDynamoDBMarshaller;
175 | FAmazonResponse: IAmazonResponse;
176 | begin
177 | Try
178 | aAmazonDynamoDBRequest.operationName := 'CreateTable';
179 | FAmazonDynamoDBMarshaller := TAmazonDynamoDBMarshaller.Create;
180 |
181 | aAmazonDynamoDBRequest.request_parameters :=
182 | FAmazonDynamoDBMarshaller.AmazonDynamoDBRequestToJSON
183 | (aAmazonDynamoDBRequest);
184 |
185 | FAmazonResponse := MakeRequest(aAmazonDynamoDBRequest, FAmazonRESTClient);
186 |
187 | Result := TAmazonDynamoDBResponse.Create(FAmazonResponse);
188 |
189 | Finally
190 | FAmazonDynamoDBMarshaller := NIL;
191 | FAmazonResponse := NIl;
192 | End;
193 | end;
194 |
195 | function TAmazonDynamoDBMarshaller.AmazonDynamoDBRequestToJSON
196 | (aAmazonDynamoDBRequest: TAmazonDynamoDBRequest): UTF8String;
197 | var
198 | Fctx: TRttiContext;
199 | FJSON: tStringList;
200 | begin
201 | Try
202 | Fctx := TRttiContext.Create;
203 |
204 | FJSON := tStringList.Create;
205 |
206 | GetSubRttiAttributekeys(FJSON, '', Fctx, aAmazonDynamoDBRequest);
207 |
208 | Result := '{' + StringReplace(FJSON.Text, #13#10, '', [rfReplaceAll]) + '}';
209 | Finally
210 | FJSON.Free;
211 |
212 | Fctx.Free;
213 | End;
214 | end;
215 |
216 | constructor TAmazonDynamoDBResponse.Create(aAmazonResponse: IAmazonResponse);
217 | begin
218 | ResponseText := aAmazonResponse.ResponseText;
219 | ResponseCode := aAmazonResponse.ResponseCode;
220 | Response := aAmazonResponse.Response;
221 | end;
222 |
223 | end.
224 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Marshaller.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Marshaller;
2 |
3 | interface
4 |
5 | uses System.Rtti, System.TypInfo, System.Classes, System.StrUtils,
6 | System.SysUtils,
7 | Amazon.Utils, Amazon.Interfaces, Generics.Collections;
8 |
9 | type
10 | TAmazonMarshallerAttribute = class(TCustomAttribute)
11 | private
12 | fsTagName: string;
13 | public
14 | constructor Create(const aTagName: string);
15 | property TagName: string read fsTagName write fsTagName;
16 | end;
17 |
18 | TAmazonMarshaller = class(TInterfacedObject, IAmazonMarshaller)
19 | protected
20 | private
21 | procedure CloseJSONArray(var aJSON: TStringList;
22 | aCloseBracket: UTF8String = ']'; aIsClass: Boolean = false);
23 | procedure OpenJSONArray(var aJSON: TStringList; aParentTagName: UTF8String;
24 | aOpenBracket: UTF8String = '[');
25 | procedure AddJSONArray(var aJSON: TStringList;
26 | fsTagName, fsTagValue: UTF8String);
27 | procedure AddJSONString(aTypeKind: TTypeKind; var aJSON: TStringList;
28 | aTagName, aTagValue: UTF8String; aIsClass: Boolean;
29 | var aIsOpenBracket: Boolean; aIsListJSONArray: Boolean = false;
30 | aIsSubOpenBracket: Boolean = false);
31 | function IsAnyKindOfGenericList(AType: TRttiType): Boolean;
32 | public
33 | procedure GetSubRttiAttributekeys(var aJSON: TStringList;
34 | aParentTagName: string; aCtx: TRttiContext; aObject: TObject;
35 | aIsClass: Boolean = false; aIsOpenBracket: Boolean = false;
36 | aIsListJSONArray: Boolean = false);
37 |
38 | end;
39 |
40 | implementation
41 |
42 | constructor TAmazonMarshallerAttribute.Create(const aTagName: string);
43 | begin
44 | fsTagName := aTagName;
45 | end;
46 |
47 | procedure TAmazonMarshaller.GetSubRttiAttributekeys(var aJSON: TStringList;
48 | aParentTagName: string; aCtx: TRttiContext; aObject: TObject;
49 | aIsClass: Boolean = false; aIsOpenBracket: Boolean = false;
50 | aIsListJSONArray: Boolean = false);
51 | var
52 | I: Integer;
53 | prop: TRttiProperty;
54 | fsTagName, fsTagValue, fsPropName: UTF8String;
55 | a: TCustomAttribute;
56 | fRttiType: TRttiType;
57 | val: TValue;
58 | // FList: Tlist;
59 | FObject: TObject;
60 | FIsSubOpenBracket: Boolean;
61 | FObjectList: TObjectList;
62 | begin
63 | FIsSubOpenBracket := false;
64 |
65 | if aIsClass then
66 | begin
67 | if IsAnyKindOfGenericList(aCtx.GetType(aObject.ClassType)) then
68 | begin
69 | // FList := Tlist(aObject);
70 | FObjectList := TObjectList(aObject);
71 |
72 | OpenJSONArray(aJSON, aParentTagName);
73 |
74 | for I := 0 to FObjectList.Count - 1 do
75 | begin
76 | FObject := FObjectList[I];
77 |
78 | // FObject := TObject(FList.Items[i]);
79 |
80 | GetSubRttiAttributekeys(aJSON, aParentTagName, aCtx, FObject, false,
81 | true, true);
82 | end;
83 |
84 | CloseJSONArray(aJSON);
85 |
86 | Exit;
87 | end
88 | else
89 | begin
90 | OpenJSONArray(aJSON, aParentTagName, '{');
91 | aIsOpenBracket := true;
92 | end;
93 | end
94 | else if aIsListJSONArray then
95 | begin
96 | OpenJSONArray(aJSON, '', '{');
97 | FIsSubOpenBracket := true;
98 | aIsOpenBracket := false;
99 | end;
100 |
101 | for prop in aCtx.GetType(aObject.ClassType).GetProperties do
102 | begin
103 | fsPropName := prop.Name;
104 |
105 | for a in prop.GetAttributes do
106 | begin
107 | fsTagName := TAmazonMarshallerAttribute(a).TagName;
108 |
109 | fRttiType := prop.PropertyType;
110 |
111 | case fRttiType.TypeKind of
112 | tkInteger, tkLString, tkWString, tkString:
113 | begin
114 | val := prop.GetValue(aObject);
115 |
116 | fsTagValue := val.ToString;
117 |
118 | AddJSONString(fRttiType.TypeKind, aJSON, fsTagName, fsTagValue,
119 | aIsClass, aIsOpenBracket, aIsListJSONArray, FIsSubOpenBracket);
120 |
121 | end;
122 |
123 | tkClass:
124 | begin
125 | val := prop.GetValue(aObject);
126 |
127 | GetSubRttiAttributekeys(aJSON, fsTagName, aCtx, val.AsObject, true);
128 | end;
129 |
130 | end;
131 |
132 | FIsSubOpenBracket := false;
133 | end;
134 | end;
135 |
136 | if aIsClass then
137 | CloseJSONArray(aJSON, '}', aIsClass)
138 | else if aIsListJSONArray then
139 | begin
140 | FIsSubOpenBracket := false;
141 | CloseJSONArray(aJSON, '}', false);
142 | end;
143 |
144 | end;
145 |
146 | function TAmazonMarshaller.IsAnyKindOfGenericList(AType: TRttiType): Boolean;
147 | begin
148 | Result := false;
149 | while AType <> nil do
150 | begin
151 | Result := StartsText('TList<', AType.Name);
152 | if Result then
153 | Exit;
154 | AType := AType.BaseType;
155 | end;
156 | end;
157 |
158 | procedure TAmazonMarshaller.AddJSONString(aTypeKind: TTypeKind;
159 | var aJSON: TStringList; aTagName, aTagValue: UTF8String; aIsClass: Boolean;
160 | var aIsOpenBracket: Boolean; aIsListJSONArray: Boolean = false;
161 | aIsSubOpenBracket: Boolean = false);
162 | Var
163 | lsJSONLine: UTF8String;
164 | begin
165 | case aTypeKind of
166 | tkInteger:
167 | begin
168 | lsJSONLine := DoubleQuotedStr(aTagName) + ':' + aTagValue;
169 | end
170 |
171 | else
172 | lsJSONLine := DoubleQuotedStr(aTagName) + ':' + DoubleQuotedStr(aTagValue);
173 | end;
174 |
175 | If not aIsClass then
176 | begin
177 | if aJSON.Count > 0 then
178 | begin
179 | if aIsListJSONArray then
180 | begin
181 | if not aIsSubOpenBracket then
182 | aJSON.Strings[aJSON.Count - 1] := aJSON.Strings[aJSON.Count - 1] + ','
183 |
184 | end
185 | else if Not aIsOpenBracket then
186 | aJSON.Strings[aJSON.Count - 2] := aJSON.Strings[aJSON.Count - 2] + ','
187 |
188 | end;
189 |
190 | aJSON.Add(lsJSONLine);
191 |
192 | end
193 | else
194 | begin
195 | if aIsOpenBracket then
196 | begin
197 | aJSON.Strings[aJSON.Count - 1] := aJSON.Strings[aJSON.Count - 1] +
198 | lsJSONLine;
199 | aIsOpenBracket := false;
200 | end
201 | else
202 | aJSON.Strings[aJSON.Count - 1] := aJSON.Strings[aJSON.Count - 1] + ',' +
203 | lsJSONLine;
204 | end;
205 |
206 | end;
207 |
208 | procedure TAmazonMarshaller.AddJSONArray(var aJSON: TStringList;
209 | fsTagName, fsTagValue: UTF8String);
210 | Var
211 | lsJSONLine: UTF8String;
212 | begin
213 | lsJSONLine := '{' + DoubleQuotedStr(fsTagName) + ':' +
214 | DoubleQuotedStr(fsTagValue) + '}';
215 |
216 | aJSON.Add(lsJSONLine);
217 | end;
218 |
219 | procedure TAmazonMarshaller.OpenJSONArray(var aJSON: TStringList;
220 | aParentTagName: UTF8String; aOpenBracket: UTF8String = '[');
221 | Var
222 | lsJSONLine: UTF8String;
223 | begin
224 | if aParentTagName <> '' then
225 | begin
226 | lsJSONLine := '"' + aParentTagName + '": ' + aOpenBracket;
227 |
228 | if aJSON.Count > 0 then
229 | begin
230 | aJSON.Strings[aJSON.Count - 1] := aJSON.Strings[aJSON.Count - 1] + ',';
231 |
232 | end
233 | end
234 | else
235 | lsJSONLine := aOpenBracket;
236 |
237 | aJSON.Add(lsJSONLine);
238 | end;
239 |
240 | procedure TAmazonMarshaller.CloseJSONArray(var aJSON: TStringList;
241 | aCloseBracket: UTF8String = ']'; aIsClass: Boolean = false);
242 | begin
243 | if Not aIsClass then
244 | aJSON.Add(aCloseBracket)
245 | else
246 | aJSON.Strings[aJSON.Count - 1] := aJSON.Strings[aJSON.Count - 1] +
247 | aCloseBracket;
248 | end;
249 |
250 | end.
251 |
--------------------------------------------------------------------------------
/Source/Core/Amazon.Client.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.Client;
2 |
3 | interface
4 |
5 | uses Amazon.Interfaces,
6 | {$IFNDEF FPC}
7 | System.SysUtils,
8 | {$ELSE}
9 | SysUtils,
10 | {$ENDIF}
11 | Amazon.Credentials,
12 | Amazon.Utils, Amazon.Response, //System.Rtti,
13 | Amazon.Request, Amazon.SignatureV4;
14 |
15 | type
16 | TAmazonClient = class(TInterfacedObject, IAmazonClient)
17 | protected
18 | FAmazonRESTClient: IAmazonRESTClient;
19 | FAmazonCredentials: tAmazonCredentials;
20 | fsendpoint: UTF8String;
21 | fsservice: UTF8String;
22 | fshost: UTF8String;
23 | fsAuthorization_header: UTF8String;
24 | private
25 | function getsecret_key: UTF8String;
26 | procedure setsecret_key(value: UTF8String);
27 | function getaccess_key: UTF8String;
28 | procedure setaccess_key(value: UTF8String);
29 | function getregion: UTF8String;
30 | procedure setregion(value: UTF8String);
31 | function getprofile: UTF8String;
32 | procedure setprofile(value: UTF8String);
33 | function getcredential_file: UTF8String;
34 | procedure setcredential_file(value: UTF8String);
35 | function getendpoint: UTF8String;
36 | procedure setendpoint(value: UTF8String);
37 | function getservice: UTF8String;
38 | procedure setservice(value: UTF8String);
39 | function gethost: UTF8String;
40 | procedure sethost(value: UTF8String);
41 | public
42 | constructor Create; overload;
43 | constructor Create(aAmazonRESTClient: IAmazonRESTClient); overload;
44 | constructor Create(aAmazonRESTClient: IAmazonRESTClient; asecret_key: UTF8String; aaccess_key: UTF8String;
45 | aregion: UTF8String); overload;
46 | constructor Create(aAmazonRESTClient: IAmazonRESTClient;
47 | aprofile: UTF8String); overload;
48 | constructor Create(aAmazonRESTClient: IAmazonRESTClient;
49 | aprofile: UTF8String; asecret_key: UTF8String; aaccess_key: UTF8String;
50 | aregion: UTF8String); overload;
51 |
52 | destructor Destory;
53 |
54 | procedure InitClient(aprofile: UTF8String; asecret_key: UTF8String;
55 | aaccess_key: UTF8String; aregion: UTF8String); virtual;
56 |
57 | property profile: UTF8String read getprofile write setprofile;
58 | property credential_file: UTF8String read getcredential_file
59 | write setcredential_file;
60 | property region: UTF8String read getregion write setregion;
61 | property secret_key: UTF8String read getsecret_key write setsecret_key;
62 | property access_key: UTF8String read getaccess_key write setaccess_key;
63 |
64 | property endpoint: UTF8String read getendpoint write setendpoint;
65 | property service: UTF8String read getservice write setservice;
66 | property host: UTF8String read gethost write sethost;
67 |
68 | function MakeRequest(aAmazonRequest: IAmazonRequest;
69 | aAmazonRESTClient: IAmazonRESTClient): IAmazonResponse;
70 |
71 | function execute(aAmazonRequest: IAmazonRequest;
72 | aAmazonSignature: IAmazonSignature; aAmazonRESTClient: IAmazonRESTClient)
73 | : IAmazonResponse; virtual;
74 | end;
75 |
76 | implementation
77 |
78 | constructor TAmazonClient.Create;
79 | begin
80 | InitClient('', '', '', '');
81 | end;
82 |
83 | constructor TAmazonClient.Create(aAmazonRESTClient: IAmazonRESTClient);
84 | begin
85 | FAmazonRESTClient := aAmazonRESTClient;
86 | InitClient('', '', '', '');
87 | end;
88 |
89 | constructor TAmazonClient.Create(aAmazonRESTClient: IAmazonRESTClient;asecret_key: UTF8String;
90 | aaccess_key: UTF8String; aregion: UTF8String);
91 | begin
92 | FAmazonRESTClient := aAmazonRESTClient;
93 | InitClient('', asecret_key, aaccess_key, aregion);
94 | end;
95 |
96 | constructor TAmazonClient.Create(aAmazonRESTClient: IAmazonRESTClient;
97 | aprofile: UTF8String);
98 | begin
99 | FAmazonRESTClient := aAmazonRESTClient;
100 | InitClient(aprofile, '', '', '');
101 | end;
102 |
103 | constructor TAmazonClient.Create(aAmazonRESTClient: IAmazonRESTClient;
104 | aprofile: UTF8String; asecret_key: UTF8String; aaccess_key: UTF8String;
105 | aregion: UTF8String);
106 | begin
107 | FAmazonRESTClient := aAmazonRESTClient;
108 | InitClient(aprofile, asecret_key, aaccess_key, aregion);
109 | end;
110 |
111 | destructor TAmazonClient.Destory;
112 | begin
113 | FreeandNil(FAmazonCredentials);
114 | end;
115 |
116 | procedure TAmazonClient.InitClient(aprofile: UTF8String;
117 | asecret_key: UTF8String; aaccess_key: UTF8String; aregion: UTF8String);
118 | begin
119 | FAmazonCredentials := tAmazonCredentials.Create;
120 |
121 | fsendpoint := '';
122 | fsservice := '';
123 | fshost := '';
124 |
125 | FAmazonCredentials.profile := aprofile;
126 | FAmazonCredentials.access_key := aaccess_key;
127 | FAmazonCredentials.secret_key := asecret_key;
128 | FAmazonCredentials.region := aregion;
129 |
130 | if (aaccess_key = '') and (asecret_key = '') then
131 | begin
132 | if FAmazonCredentials.Iscredential_file then
133 | begin
134 | if FAmazonCredentials.profile = '' then
135 | FAmazonCredentials.profile := 'default';
136 |
137 | FAmazonCredentials.Loadcredential_file;
138 | end
139 | else
140 | FAmazonCredentials.GetEnvironmentVariables;
141 | end;
142 | end;
143 |
144 | function TAmazonClient.getregion: UTF8String;
145 | begin
146 | result := '';
147 |
148 | if Assigned(FAmazonCredentials) then
149 | result := FAmazonCredentials.region;
150 |
151 | end;
152 |
153 | procedure TAmazonClient.setregion(value: UTF8String);
154 | begin
155 | if Assigned(FAmazonCredentials) then
156 | FAmazonCredentials.region := value;
157 | end;
158 |
159 | function TAmazonClient.getaccess_key: UTF8String;
160 | begin
161 | result := '';
162 |
163 | if Assigned(FAmazonCredentials) then
164 | result := FAmazonCredentials.access_key;
165 | end;
166 |
167 | procedure TAmazonClient.setaccess_key(value: UTF8String);
168 | begin
169 | if Assigned(FAmazonCredentials) then
170 | FAmazonCredentials.access_key := value;
171 | end;
172 |
173 | function TAmazonClient.getsecret_key: UTF8String;
174 | begin
175 | result := '';
176 | if Assigned(FAmazonCredentials) then
177 | result := FAmazonCredentials.secret_key;
178 | end;
179 |
180 | procedure TAmazonClient.setsecret_key(value: UTF8String);
181 | begin
182 | if Assigned(FAmazonCredentials) then
183 | FAmazonCredentials.secret_key := value;
184 | end;
185 |
186 | function TAmazonClient.getprofile: UTF8String;
187 | begin
188 | result := '';
189 |
190 | if Assigned(FAmazonCredentials) then
191 | result := FAmazonCredentials.profile;
192 | end;
193 |
194 | procedure TAmazonClient.setprofile(value: UTF8String);
195 | begin
196 | if Assigned(FAmazonCredentials) then
197 | FAmazonCredentials.profile := value;
198 | end;
199 |
200 | function TAmazonClient.getcredential_file: UTF8String;
201 | begin
202 | result := '';
203 |
204 | if Assigned(FAmazonCredentials) then
205 | result := FAmazonCredentials.credential_file;
206 | end;
207 |
208 | procedure TAmazonClient.setcredential_file(value: UTF8String);
209 | begin
210 | if Assigned(FAmazonCredentials) then
211 | FAmazonCredentials.credential_file := value;
212 | end;
213 |
214 | function TAmazonClient.getendpoint: UTF8String;
215 | begin
216 | result := fsendpoint;
217 | end;
218 |
219 | procedure TAmazonClient.setendpoint(value: UTF8String);
220 | begin
221 | fsendpoint := value;
222 | end;
223 |
224 | function TAmazonClient.getservice: UTF8String;
225 | begin
226 | result := fsservice;
227 | end;
228 |
229 | procedure TAmazonClient.setservice(value: UTF8String);
230 | begin
231 | fsservice := value;
232 | end;
233 |
234 | function TAmazonClient.gethost: UTF8String;
235 | begin
236 | result := fshost;
237 | end;
238 |
239 | procedure TAmazonClient.sethost(value: UTF8String);
240 | begin
241 | fshost := value;
242 | end;
243 |
244 | function TAmazonClient.execute(aAmazonRequest: IAmazonRequest;
245 | aAmazonSignature: IAmazonSignature; aAmazonRESTClient: IAmazonRESTClient)
246 | : IAmazonResponse;
247 | var
248 | amz_date: UTF8String;
249 | date_stamp: UTF8String;
250 | content_type: UTF8String;
251 | fsresponse: UTF8String;
252 | FAmazonResponse: tAmazonResponse;
253 | begin
254 | result := NIL;
255 |
256 | if (secret_key = '') or (access_key = '') then
257 | raise Exception.Create('secret_key or access_key not assigned.');
258 |
259 | if Not Assigned(aAmazonRESTClient) then
260 | raise Exception.Create('IAmazonRESTClient not assigned.');
261 |
262 | if region = '' then
263 | raise Exception.Create('region not assigned.');
264 |
265 | Try
266 | GetAWSDate_Stamp(UTCNow, amz_date, date_stamp);
267 | content_type := aAmazonSignature.GetContent_type;
268 |
269 | aAmazonRequest.secret_key := secret_key;
270 | aAmazonRequest.access_key := access_key;
271 |
272 | aAmazonRequest.service := service;
273 | aAmazonRequest.endpoint := endpoint;
274 | if host = '' then
275 | aAmazonRequest.host := GetAWSHost(aAmazonRequest.endpoint)
276 | else
277 | aAmazonRequest.host := host;
278 |
279 | aAmazonRequest.region := region;
280 |
281 | aAmazonRequest.amz_date := amz_date;
282 | aAmazonRequest.date_stamp := date_stamp;
283 |
284 | aAmazonSignature.Sign(aAmazonRequest);
285 |
286 | aAmazonRESTClient.content_type := content_type;
287 |
288 | aAmazonRESTClient.AddHeader('X-Amz-Date', amz_date);
289 | aAmazonRESTClient.AddHeader('X-Amz-Target', aAmazonRequest.target);
290 | aAmazonRESTClient.AddHeader('Authorization',
291 | aAmazonSignature.Authorization_header);
292 |
293 | fsresponse := '';
294 |
295 | aAmazonRESTClient.Post(endpoint, aAmazonRequest.request_parameters,
296 | fsresponse);
297 |
298 | Finally
299 | FAmazonResponse := tAmazonResponse.Create;
300 |
301 | FAmazonResponse.Response := fsresponse;
302 | FAmazonResponse.ResponseCode := aAmazonRESTClient.ResponseCode;
303 | FAmazonResponse.ResponseText := aAmazonRESTClient.ResponseText;
304 |
305 | result := FAmazonResponse;
306 | End;
307 |
308 | end;
309 |
310 | function TAmazonClient.MakeRequest(aAmazonRequest: IAmazonRequest;
311 | aAmazonRESTClient: IAmazonRESTClient): IAmazonResponse;
312 | var
313 | // FAmazonRESTClient: TAmazonRESTClient;
314 | FAmazonSignatureV4: TAmazonSignatureV4;
315 | begin
316 | Try
317 | FAmazonSignatureV4 := TAmazonSignatureV4.Create;
318 | // FAmazonRESTClient := TAmazonRESTClient.Create;
319 |
320 | result := execute(aAmazonRequest, FAmazonSignatureV4, aAmazonRESTClient);
321 | Finally
322 | FAmazonSignatureV4 := NIL;
323 | // FAmazonRESTClient := NIL;
324 | End;
325 | end;
326 |
327 | end.
328 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Lazarus/CreateTable1/CreateTable1.lps:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Source/SDK/DynamoDB/Amazon.DynamoDB2.pas:
--------------------------------------------------------------------------------
1 | unit Amazon.DynamoDB;
2 |
3 | interface
4 |
5 | uses Amazon.Client, Amazon.Request, System.Classes, System.Generics.Collections,
6 | Amazon.Response, Amazon.Utils, Amazon.Marshaller, System.Rtti, System.TypInfo,
7 | Amazon.Interfaces, System.AnsiStrings, System.SysUtils;
8 |
9 |
10 | Const
11 | cDynamoDB_targetPrefix = 'DynamoDB_20120810';
12 | cDynamoDB_endpointPrefix = 'dynamodb';
13 |
14 | type
15 | [TAmazonMarshallerAttribute('AttributeDefinition')]
16 | TAttributeDefinition=class(tobject)
17 | protected
18 | private
19 | public
20 | end;
21 |
22 | [TAmazonMarshallerAttribute('AttributeValue')]
23 | TAttributeValue=class(tobject)
24 | protected
25 | private
26 | public
27 | end;
28 |
29 | [TAmazonMarshallerAttribute('AttributeValueUpdate')]
30 | TAttributeValueUpdate=class(tobject)
31 | protected
32 | private
33 | public
34 | end;
35 |
36 | [TAmazonMarshallerAttribute('AutoScalingPolicyDescription')]
37 | TAutoScalingPolicyDescription=class(tobject)
38 | protected
39 | private
40 | public
41 | end;
42 |
43 | [TAmazonMarshallerAttribute('AutoScalingPolicyUpdate')]
44 | TAutoScalingPolicyUpdate=class(tobject)
45 | protected
46 | private
47 | public
48 | end;
49 |
50 | [TAmazonMarshallerAttribute('AutoScalingSettingsDescription')]
51 | TAutoScalingSettingsDescription=class(tobject)
52 | protected
53 | private
54 | public
55 | end;
56 |
57 | [TAmazonMarshallerAttribute('AutoScalingSettingsUpdate')]
58 | TAutoScalingSettingsUpdate=class(tobject)
59 | protected
60 | private
61 | public
62 | end;
63 |
64 | [TAmazonMarshallerAttribute('AutoScalingTargetTrackingScalingPolicyConfigurationDescription')]
65 | TAutoScalingTargetTrackingScalingPolicyConfigurationDescription=class(tobject)
66 | protected
67 | private
68 | public
69 | end;
70 |
71 | [TAmazonMarshallerAttribute('AutoScalingTargetTrackingScalingPolicyConfigurationUpdate')]
72 | TAutoScalingTargetTrackingScalingPolicyConfigurationUpdate=class(tobject)
73 | protected
74 | private
75 | public
76 | end;
77 |
78 | [TAmazonMarshallerAttribute('BackupDescription')]
79 | TBackupDescription=class(tobject)
80 | protected
81 | private
82 | public
83 | end;
84 |
85 | [TAmazonMarshallerAttribute('BackupDetails')]
86 | TBackupDetails=class(tobject)
87 | protected
88 | private
89 | public
90 | end;
91 |
92 | [TAmazonMarshallerAttribute('BackupInUseException')]
93 | TBackupInUseException=class(tobject)
94 | protected
95 | private
96 | public
97 | end;
98 |
99 | [TAmazonMarshallerAttribute('BackupNotFoundException')]
100 | TBackupNotFoundException=class(tobject)
101 | protected
102 | private
103 | public
104 | end;
105 |
106 | [TAmazonMarshallerAttribute('BackupSummary')]
107 | TBackupSummary=class(tobject)
108 | protected
109 | private
110 | public
111 | end;
112 |
113 | [TAmazonMarshallerAttribute('BatchGetItemInput')]
114 | TBatchGetItemInput=class(tobject)
115 | protected
116 | private
117 | public
118 | end;
119 |
120 | [TAmazonMarshallerAttribute('BatchGetItemOutput')]
121 | TBatchGetItemOutput=class(tobject)
122 | protected
123 | private
124 | public
125 | end;
126 |
127 | [TAmazonMarshallerAttribute('BatchWriteItemInput')]
128 | TBatchWriteItemInput=class(tobject)
129 | protected
130 | private
131 | public
132 | end;
133 |
134 | [TAmazonMarshallerAttribute('BatchWriteItemOutput')]
135 | TBatchWriteItemOutput=class(tobject)
136 | protected
137 | private
138 | public
139 | end;
140 |
141 | [TAmazonMarshallerAttribute('Capacity')]
142 | TCapacity=class(tobject)
143 | protected
144 | private
145 | public
146 | end;
147 |
148 | [TAmazonMarshallerAttribute('Condition')]
149 | TCondition=class(tobject)
150 | protected
151 | private
152 | public
153 | end;
154 |
155 | [TAmazonMarshallerAttribute('ConditionalCheckFailedException')]
156 | TConditionalCheckFailedException=class(tobject)
157 | protected
158 | private
159 | public
160 | end;
161 |
162 | [TAmazonMarshallerAttribute('ConsumedCapacity')]
163 | TConsumedCapacity=class(tobject)
164 | protected
165 | private
166 | public
167 | end;
168 |
169 | [TAmazonMarshallerAttribute('ContinuousBackupsDescription')]
170 | TContinuousBackupsDescription=class(tobject)
171 | protected
172 | private
173 | public
174 | end;
175 |
176 | [TAmazonMarshallerAttribute('ContinuousBackupsUnavailableException')]
177 | TContinuousBackupsUnavailableException=class(tobject)
178 | protected
179 | private
180 | public
181 | end;
182 |
183 | [TAmazonMarshallerAttribute('CreateBackupInput')]
184 | TCreateBackupInput=class(tobject)
185 | protected
186 | private
187 | public
188 | end;
189 |
190 | [TAmazonMarshallerAttribute('CreateBackupOutput')]
191 | TCreateBackupOutput=class(tobject)
192 | protected
193 | private
194 | public
195 | end;
196 |
197 | [TAmazonMarshallerAttribute('CreateGlobalSecondaryIndexAction')]
198 | TCreateGlobalSecondaryIndexAction=class(tobject)
199 | protected
200 | private
201 | public
202 | end;
203 |
204 | [TAmazonMarshallerAttribute('CreateGlobalTableInput')]
205 | TCreateGlobalTableInput=class(tobject)
206 | protected
207 | private
208 | public
209 | end;
210 |
211 | [TAmazonMarshallerAttribute('CreateGlobalTableOutput')]
212 | TCreateGlobalTableOutput=class(tobject)
213 | protected
214 | private
215 | public
216 | end;
217 |
218 | [TAmazonMarshallerAttribute('CreateReplicaAction')]
219 | TCreateReplicaAction=class(tobject)
220 | protected
221 | private
222 | public
223 | end;
224 |
225 | [TAmazonMarshallerAttribute('CreateTableInput')]
226 | TCreateTableInput=class(tobject)
227 | protected
228 | private
229 | public
230 | end;
231 |
232 | [TAmazonMarshallerAttribute('CreateTableOutput')]
233 | TCreateTableOutput=class(tobject)
234 | protected
235 | private
236 | public
237 | end;
238 |
239 | [TAmazonMarshallerAttribute('DeleteBackupInput')]
240 | TDeleteBackupInput=class(tobject)
241 | protected
242 | private
243 | public
244 | end;
245 |
246 | [TAmazonMarshallerAttribute('DeleteBackupOutput')]
247 | TDeleteBackupOutput=class(tobject)
248 | protected
249 | private
250 | public
251 | end;
252 |
253 | [TAmazonMarshallerAttribute('DeleteGlobalSecondaryIndexAction')]
254 | TDeleteGlobalSecondaryIndexAction=class(tobject)
255 | protected
256 | private
257 | public
258 | end;
259 |
260 | [TAmazonMarshallerAttribute('DeleteItemInput')]
261 | TDeleteItemInput=class(tobject)
262 | protected
263 | private
264 | public
265 | end;
266 |
267 | [TAmazonMarshallerAttribute('DeleteItemOutput')]
268 | TDeleteItemOutput=class(tobject)
269 | protected
270 | private
271 | public
272 | end;
273 |
274 | [TAmazonMarshallerAttribute('DeleteReplicaAction')]
275 | TDeleteReplicaAction=class(tobject)
276 | protected
277 | private
278 | public
279 | end;
280 |
281 | [TAmazonMarshallerAttribute('DeleteRequest')]
282 | TDeleteRequest=class(tobject)
283 | protected
284 | private
285 | public
286 | end;
287 |
288 | [TAmazonMarshallerAttribute('DeleteTableInput')]
289 | TDeleteTableInput=class(tobject)
290 | protected
291 | private
292 | public
293 | end;
294 |
295 | [TAmazonMarshallerAttribute('DeleteTableOutput')]
296 | TDeleteTableOutput=class(tobject)
297 | protected
298 | private
299 | public
300 | end;
301 |
302 | [TAmazonMarshallerAttribute('DescribeBackupInput')]
303 | TDescribeBackupInput=class(tobject)
304 | protected
305 | private
306 | public
307 | end;
308 |
309 | [TAmazonMarshallerAttribute('DescribeBackupOutput')]
310 | TDescribeBackupOutput=class(tobject)
311 | protected
312 | private
313 | public
314 | end;
315 |
316 | [TAmazonMarshallerAttribute('DescribeContinuousBackupsInput')]
317 | TDescribeContinuousBackupsInput=class(tobject)
318 | protected
319 | private
320 | public
321 | end;
322 |
323 | [TAmazonMarshallerAttribute('DescribeContinuousBackupsOutput')]
324 | TDescribeContinuousBackupsOutput=class(tobject)
325 | protected
326 | private
327 | public
328 | end;
329 |
330 | [TAmazonMarshallerAttribute('DescribeEndpointsRequest')]
331 | TDescribeEndpointsRequest=class(tobject)
332 | protected
333 | private
334 | public
335 | end;
336 |
337 | [TAmazonMarshallerAttribute('DescribeEndpointsResponse')]
338 | TDescribeEndpointsResponse=class(tobject)
339 | protected
340 | private
341 | public
342 | end;
343 |
344 | [TAmazonMarshallerAttribute('DescribeGlobalTableInput')]
345 | TDescribeGlobalTableInput=class(tobject)
346 | protected
347 | private
348 | public
349 | end;
350 |
351 | [TAmazonMarshallerAttribute('DescribeGlobalTableOutput')]
352 | TDescribeGlobalTableOutput=class(tobject)
353 | protected
354 | private
355 | public
356 | end;
357 |
358 | [TAmazonMarshallerAttribute('DescribeGlobalTableSettingsInput')]
359 | TDescribeGlobalTableSettingsInput=class(tobject)
360 | protected
361 | private
362 | public
363 | end;
364 |
365 | [TAmazonMarshallerAttribute('DescribeGlobalTableSettingsOutput')]
366 | TDescribeGlobalTableSettingsOutput=class(tobject)
367 | protected
368 | private
369 | public
370 | end;
371 |
372 | [TAmazonMarshallerAttribute('DescribeLimitsInput')]
373 | TDescribeLimitsInput=class(tobject)
374 | protected
375 | private
376 | public
377 | end;
378 |
379 | [TAmazonMarshallerAttribute('DescribeLimitsOutput')]
380 | TDescribeLimitsOutput=class(tobject)
381 | protected
382 | private
383 | public
384 | end;
385 |
386 | [TAmazonMarshallerAttribute('DescribeTableInput')]
387 | TDescribeTableInput=class(tobject)
388 | protected
389 | private
390 | public
391 | end;
392 |
393 | [TAmazonMarshallerAttribute('DescribeTableOutput')]
394 | TDescribeTableOutput=class(tobject)
395 | protected
396 | private
397 | public
398 | end;
399 |
400 | [TAmazonMarshallerAttribute('DescribeTimeToLiveInput')]
401 | TDescribeTimeToLiveInput=class(tobject)
402 | protected
403 | private
404 | public
405 | end;
406 |
407 | [TAmazonMarshallerAttribute('DescribeTimeToLiveOutput')]
408 | TDescribeTimeToLiveOutput=class(tobject)
409 | protected
410 | private
411 | public
412 | end;
413 |
414 | [TAmazonMarshallerAttribute('Endpoint')]
415 | TEndpoint=class(tobject)
416 | protected
417 | private
418 | public
419 | end;
420 |
421 | [TAmazonMarshallerAttribute('ExpectedAttributeValue')]
422 | TExpectedAttributeValue=class(tobject)
423 | protected
424 | private
425 | public
426 | end;
427 |
428 | [TAmazonMarshallerAttribute('GetItemInput')]
429 | TGetItemInput=class(tobject)
430 | protected
431 | private
432 | public
433 | end;
434 |
435 | [TAmazonMarshallerAttribute('GetItemOutput')]
436 | TGetItemOutput=class(tobject)
437 | protected
438 | private
439 | public
440 | end;
441 |
442 | [TAmazonMarshallerAttribute('GlobalSecondaryIndex')]
443 | TGlobalSecondaryIndex=class(tobject)
444 | protected
445 | private
446 | public
447 | end;
448 |
449 | [TAmazonMarshallerAttribute('GlobalSecondaryIndexDescription')]
450 | TGlobalSecondaryIndexDescription=class(tobject)
451 | protected
452 | private
453 | public
454 | end;
455 |
456 | [TAmazonMarshallerAttribute('GlobalSecondaryIndexInfo')]
457 | TGlobalSecondaryIndexInfo=class(tobject)
458 | protected
459 | private
460 | public
461 | end;
462 |
463 | [TAmazonMarshallerAttribute('GlobalSecondaryIndexUpdate')]
464 | TGlobalSecondaryIndexUpdate=class(tobject)
465 | protected
466 | private
467 | public
468 | end;
469 |
470 | [TAmazonMarshallerAttribute('GlobalTable')]
471 | TGlobalTable=class(tobject)
472 | protected
473 | private
474 | public
475 | end;
476 |
477 | [TAmazonMarshallerAttribute('GlobalTableAlreadyExistsException')]
478 | TGlobalTableAlreadyExistsException=class(tobject)
479 | protected
480 | private
481 | public
482 | end;
483 |
484 | [TAmazonMarshallerAttribute('GlobalTableDescription')]
485 | TGlobalTableDescription=class(tobject)
486 | protected
487 | private
488 | public
489 | end;
490 |
491 | [TAmazonMarshallerAttribute('GlobalTableGlobalSecondaryIndexSettingsUpdate')]
492 | TGlobalTableGlobalSecondaryIndexSettingsUpdate=class(tobject)
493 | protected
494 | private
495 | public
496 | end;
497 |
498 | [TAmazonMarshallerAttribute('GlobalTableNotFoundException')]
499 | TGlobalTableNotFoundException=class(tobject)
500 | protected
501 | private
502 | public
503 | end;
504 |
505 | [TAmazonMarshallerAttribute('IndexNotFoundException')]
506 | TIndexNotFoundException=class(tobject)
507 | protected
508 | private
509 | public
510 | end;
511 |
512 | [TAmazonMarshallerAttribute('InternalServerError')]
513 | TInternalServerError=class(tobject)
514 | protected
515 | private
516 | public
517 | end;
518 |
519 | [TAmazonMarshallerAttribute('InvalidRestoreTimeException')]
520 | TInvalidRestoreTimeException=class(tobject)
521 | protected
522 | private
523 | public
524 | end;
525 |
526 | [TAmazonMarshallerAttribute('ItemCollectionMetrics')]
527 | TItemCollectionMetrics=class(tobject)
528 | protected
529 | private
530 | public
531 | end;
532 |
533 | [TAmazonMarshallerAttribute('ItemCollectionSizeLimitExceededException')]
534 | TItemCollectionSizeLimitExceededException=class(tobject)
535 | protected
536 | private
537 | public
538 | end;
539 |
540 | [TAmazonMarshallerAttribute('KeySchemaElement')]
541 | TKeySchemaElement=class(tobject)
542 | protected
543 | private
544 | public
545 | end;
546 |
547 | [TAmazonMarshallerAttribute('KeysAndAttributes')]
548 | TKeysAndAttributes=class(tobject)
549 | protected
550 | private
551 | public
552 | end;
553 |
554 | [TAmazonMarshallerAttribute('LimitExceededException')]
555 | TLimitExceededException=class(tobject)
556 | protected
557 | private
558 | public
559 | end;
560 |
561 | [TAmazonMarshallerAttribute('ListBackupsInput')]
562 | TListBackupsInput=class(tobject)
563 | protected
564 | private
565 | public
566 | end;
567 |
568 | [TAmazonMarshallerAttribute('ListBackupsOutput')]
569 | TListBackupsOutput=class(tobject)
570 | protected
571 | private
572 | public
573 | end;
574 |
575 | [TAmazonMarshallerAttribute('ListGlobalTablesInput')]
576 | TListGlobalTablesInput=class(tobject)
577 | protected
578 | private
579 | public
580 | end;
581 |
582 | [TAmazonMarshallerAttribute('ListGlobalTablesOutput')]
583 | TListGlobalTablesOutput=class(tobject)
584 | protected
585 | private
586 | public
587 | end;
588 |
589 | [TAmazonMarshallerAttribute('ListTablesInput')]
590 | TListTablesInput=class(tobject)
591 | protected
592 | private
593 | public
594 | end;
595 |
596 | [TAmazonMarshallerAttribute('ListTablesOutput')]
597 | TListTablesOutput=class(tobject)
598 | protected
599 | private
600 | public
601 | end;
602 |
603 | [TAmazonMarshallerAttribute('ListTagsOfResourceInput')]
604 | TListTagsOfResourceInput=class(tobject)
605 | protected
606 | private
607 | public
608 | end;
609 |
610 | [TAmazonMarshallerAttribute('ListTagsOfResourceOutput')]
611 | TListTagsOfResourceOutput=class(tobject)
612 | protected
613 | private
614 | public
615 | end;
616 |
617 | [TAmazonMarshallerAttribute('LocalSecondaryIndex')]
618 | TLocalSecondaryIndex=class(tobject)
619 | protected
620 | private
621 | public
622 | end;
623 |
624 | [TAmazonMarshallerAttribute('LocalSecondaryIndexDescription')]
625 | TLocalSecondaryIndexDescription=class(tobject)
626 | protected
627 | private
628 | public
629 | end;
630 |
631 | [TAmazonMarshallerAttribute('LocalSecondaryIndexInfo')]
632 | TLocalSecondaryIndexInfo=class(tobject)
633 | protected
634 | private
635 | public
636 | end;
637 |
638 | [TAmazonMarshallerAttribute('PointInTimeRecoveryDescription')]
639 | TPointInTimeRecoveryDescription=class(tobject)
640 | protected
641 | private
642 | public
643 | end;
644 |
645 | [TAmazonMarshallerAttribute('PointInTimeRecoverySpecification')]
646 | TPointInTimeRecoverySpecification=class(tobject)
647 | protected
648 | private
649 | public
650 | end;
651 |
652 | [TAmazonMarshallerAttribute('PointInTimeRecoveryUnavailableException')]
653 | TPointInTimeRecoveryUnavailableException=class(tobject)
654 | protected
655 | private
656 | public
657 | end;
658 |
659 | [TAmazonMarshallerAttribute('Projection')]
660 | TProjection=class(tobject)
661 | protected
662 | private
663 | public
664 | end;
665 |
666 | [TAmazonMarshallerAttribute('ProvisionedThroughput')]
667 | TProvisionedThroughput=class(tobject)
668 | protected
669 | private
670 | public
671 | end;
672 |
673 | [TAmazonMarshallerAttribute('ProvisionedThroughputDescription')]
674 | TProvisionedThroughputDescription=class(tobject)
675 | protected
676 | private
677 | public
678 | end;
679 |
680 | [TAmazonMarshallerAttribute('ProvisionedThroughputExceededException')]
681 | TProvisionedThroughputExceededException=class(tobject)
682 | protected
683 | private
684 | public
685 | end;
686 |
687 | [TAmazonMarshallerAttribute('PutItemInput')]
688 | TPutItemInput=class(tobject)
689 | protected
690 | private
691 | public
692 | end;
693 |
694 | [TAmazonMarshallerAttribute('PutItemOutput')]
695 | TPutItemOutput=class(tobject)
696 | protected
697 | private
698 | public
699 | end;
700 |
701 | [TAmazonMarshallerAttribute('PutRequest')]
702 | TPutRequest=class(tobject)
703 | protected
704 | private
705 | public
706 | end;
707 |
708 | [TAmazonMarshallerAttribute('QueryInput')]
709 | TQueryInput=class(tobject)
710 | protected
711 | private
712 | public
713 | end;
714 |
715 | [TAmazonMarshallerAttribute('QueryOutput')]
716 | TQueryOutput=class(tobject)
717 | protected
718 | private
719 | public
720 | end;
721 |
722 | [TAmazonMarshallerAttribute('Replica')]
723 | TReplica=class(tobject)
724 | protected
725 | private
726 | public
727 | end;
728 |
729 | [TAmazonMarshallerAttribute('ReplicaAlreadyExistsException')]
730 | TReplicaAlreadyExistsException=class(tobject)
731 | protected
732 | private
733 | public
734 | end;
735 |
736 | [TAmazonMarshallerAttribute('ReplicaDescription')]
737 | TReplicaDescription=class(tobject)
738 | protected
739 | private
740 | public
741 | end;
742 |
743 | [TAmazonMarshallerAttribute('ReplicaGlobalSecondaryIndexSettingsDescription')]
744 | TReplicaGlobalSecondaryIndexSettingsDescription=class(tobject)
745 | protected
746 | private
747 | public
748 | end;
749 |
750 | [TAmazonMarshallerAttribute('ReplicaGlobalSecondaryIndexSettingsUpdate')]
751 | TReplicaGlobalSecondaryIndexSettingsUpdate=class(tobject)
752 | protected
753 | private
754 | public
755 | end;
756 |
757 | [TAmazonMarshallerAttribute('ReplicaNotFoundException')]
758 | TReplicaNotFoundException=class(tobject)
759 | protected
760 | private
761 | public
762 | end;
763 |
764 | [TAmazonMarshallerAttribute('ReplicaSettingsDescription')]
765 | TReplicaSettingsDescription=class(tobject)
766 | protected
767 | private
768 | public
769 | end;
770 |
771 | [TAmazonMarshallerAttribute('ReplicaSettingsUpdate')]
772 | TReplicaSettingsUpdate=class(tobject)
773 | protected
774 | private
775 | public
776 | end;
777 |
778 | [TAmazonMarshallerAttribute('ReplicaUpdate')]
779 | TReplicaUpdate=class(tobject)
780 | protected
781 | private
782 | public
783 | end;
784 |
785 | [TAmazonMarshallerAttribute('ResourceInUseException')]
786 | TResourceInUseException=class(tobject)
787 | protected
788 | private
789 | public
790 | end;
791 |
792 | [TAmazonMarshallerAttribute('ResourceNotFoundException')]
793 | TResourceNotFoundException=class(tobject)
794 | protected
795 | private
796 | public
797 | end;
798 |
799 | [TAmazonMarshallerAttribute('RestoreSummary')]
800 | TRestoreSummary=class(tobject)
801 | protected
802 | private
803 | public
804 | end;
805 |
806 | [TAmazonMarshallerAttribute('RestoreTableFromBackupInput')]
807 | TRestoreTableFromBackupInput=class(tobject)
808 | protected
809 | private
810 | public
811 | end;
812 |
813 | [TAmazonMarshallerAttribute('RestoreTableFromBackupOutput')]
814 | TRestoreTableFromBackupOutput=class(tobject)
815 | protected
816 | private
817 | public
818 | end;
819 |
820 | [TAmazonMarshallerAttribute('RestoreTableToPointInTimeInput')]
821 | TRestoreTableToPointInTimeInput=class(tobject)
822 | protected
823 | private
824 | public
825 | end;
826 |
827 | [TAmazonMarshallerAttribute('RestoreTableToPointInTimeOutput')]
828 | TRestoreTableToPointInTimeOutput=class(tobject)
829 | protected
830 | private
831 | public
832 | end;
833 |
834 | [TAmazonMarshallerAttribute('SSEDescription')]
835 | TSSEDescription=class(tobject)
836 | protected
837 | private
838 | public
839 | end;
840 |
841 | [TAmazonMarshallerAttribute('SSESpecification')]
842 | TSSESpecification=class(tobject)
843 | protected
844 | private
845 | public
846 | end;
847 |
848 | [TAmazonMarshallerAttribute('ScanInput')]
849 | TScanInput=class(tobject)
850 | protected
851 | private
852 | public
853 | end;
854 |
855 | [TAmazonMarshallerAttribute('ScanOutput')]
856 | TScanOutput=class(tobject)
857 | protected
858 | private
859 | public
860 | end;
861 |
862 | [TAmazonMarshallerAttribute('SourceTableDetails')]
863 | TSourceTableDetails=class(tobject)
864 | protected
865 | private
866 | public
867 | end;
868 |
869 | [TAmazonMarshallerAttribute('SourceTableFeatureDetails')]
870 | TSourceTableFeatureDetails=class(tobject)
871 | protected
872 | private
873 | public
874 | end;
875 |
876 | [TAmazonMarshallerAttribute('StreamSpecification')]
877 | TStreamSpecification=class(tobject)
878 | protected
879 | private
880 | public
881 | end;
882 |
883 | [TAmazonMarshallerAttribute('TableAlreadyExistsException')]
884 | TTableAlreadyExistsException=class(tobject)
885 | protected
886 | private
887 | public
888 | end;
889 |
890 | [TAmazonMarshallerAttribute('TableDescription')]
891 | TTableDescription=class(tobject)
892 | protected
893 | private
894 | public
895 | end;
896 |
897 | [TAmazonMarshallerAttribute('TableInUseException')]
898 | TTableInUseException=class(tobject)
899 | protected
900 | private
901 | public
902 | end;
903 |
904 | [TAmazonMarshallerAttribute('TableNotFoundException')]
905 | TTableNotFoundException=class(tobject)
906 | protected
907 | private
908 | public
909 | end;
910 |
911 | [TAmazonMarshallerAttribute('Tag')]
912 | TTag=class(tobject)
913 | protected
914 | private
915 | public
916 | end;
917 |
918 | [TAmazonMarshallerAttribute('TagResourceInput')]
919 | TTagResourceInput=class(tobject)
920 | protected
921 | private
922 | public
923 | end;
924 |
925 | [TAmazonMarshallerAttribute('TimeToLiveDescription')]
926 | TTimeToLiveDescription=class(tobject)
927 | protected
928 | private
929 | public
930 | end;
931 |
932 | [TAmazonMarshallerAttribute('TimeToLiveSpecification')]
933 | TTimeToLiveSpecification=class(tobject)
934 | protected
935 | private
936 | public
937 | end;
938 |
939 | [TAmazonMarshallerAttribute('UntagResourceInput')]
940 | TUntagResourceInput=class(tobject)
941 | protected
942 | private
943 | public
944 | end;
945 |
946 | [TAmazonMarshallerAttribute('UpdateContinuousBackupsInput')]
947 | TUpdateContinuousBackupsInput=class(tobject)
948 | protected
949 | private
950 | public
951 | end;
952 |
953 | [TAmazonMarshallerAttribute('UpdateContinuousBackupsOutput')]
954 | TUpdateContinuousBackupsOutput=class(tobject)
955 | protected
956 | private
957 | public
958 | end;
959 |
960 | [TAmazonMarshallerAttribute('UpdateGlobalSecondaryIndexAction')]
961 | TUpdateGlobalSecondaryIndexAction=class(tobject)
962 | protected
963 | private
964 | public
965 | end;
966 |
967 | [TAmazonMarshallerAttribute('UpdateGlobalTableInput')]
968 | TUpdateGlobalTableInput=class(tobject)
969 | protected
970 | private
971 | public
972 | end;
973 |
974 | [TAmazonMarshallerAttribute('UpdateGlobalTableOutput')]
975 | TUpdateGlobalTableOutput=class(tobject)
976 | protected
977 | private
978 | public
979 | end;
980 |
981 | [TAmazonMarshallerAttribute('UpdateGlobalTableSettingsInput')]
982 | TUpdateGlobalTableSettingsInput=class(tobject)
983 | protected
984 | private
985 | public
986 | end;
987 |
988 | [TAmazonMarshallerAttribute('UpdateGlobalTableSettingsOutput')]
989 | TUpdateGlobalTableSettingsOutput=class(tobject)
990 | protected
991 | private
992 | public
993 | end;
994 |
995 | [TAmazonMarshallerAttribute('UpdateItemInput')]
996 | TUpdateItemInput=class(tobject)
997 | protected
998 | private
999 | public
1000 | end;
1001 |
1002 | [TAmazonMarshallerAttribute('UpdateItemOutput')]
1003 | TUpdateItemOutput=class(tobject)
1004 | protected
1005 | private
1006 | public
1007 | end;
1008 |
1009 | [TAmazonMarshallerAttribute('UpdateTableInput')]
1010 | TUpdateTableInput=class(tobject)
1011 | protected
1012 | private
1013 | public
1014 | end;
1015 |
1016 | [TAmazonMarshallerAttribute('UpdateTableOutput')]
1017 | TUpdateTableOutput=class(tobject)
1018 | protected
1019 | private
1020 | public
1021 | end;
1022 |
1023 | [TAmazonMarshallerAttribute('UpdateTimeToLiveInput')]
1024 | TUpdateTimeToLiveInput=class(tobject)
1025 | protected
1026 | private
1027 | public
1028 | end;
1029 |
1030 | [TAmazonMarshallerAttribute('UpdateTimeToLiveOutput')]
1031 | TUpdateTimeToLiveOutput=class(tobject)
1032 | protected
1033 | private
1034 | public
1035 | end;
1036 |
1037 | [TAmazonMarshallerAttribute('WriteRequest')]
1038 | TWriteRequest=class(tobject)
1039 | protected
1040 | private
1041 | public
1042 | end;
1043 |
1044 |
1045 |
1046 |
1047 | TAmazonDynamoDBClient = class(TAmazonClient)
1048 | protected
1049 | private
1050 | public
1051 | procedure InitClient(aprofile: UTF8String; asecret_key: UTF8String;
1052 | aaccess_key: UTF8String; aregion: UTF8String); override;
1053 | [TAmazonMarshallerAttribute('BatchGetItem')]
1054 | function BatchGetItem(aBatchGetItemInput: tBatchGetItemInput):tBatchGetItemOutput;
1055 | [TAmazonMarshallerAttribute('BatchWriteItem')]
1056 | function BatchWriteItem(aBatchWriteItemInput: tBatchWriteItemInput):tBatchWriteItemOutput;
1057 | [TAmazonMarshallerAttribute('CreateBackup')]
1058 | function CreateBackup(aCreateBackupInput: tCreateBackupInput):tCreateBackupOutput;
1059 | [TAmazonMarshallerAttribute('CreateGlobalTable')]
1060 | function CreateGlobalTable(aCreateGlobalTableInput: tCreateGlobalTableInput):tCreateGlobalTableOutput;
1061 | [TAmazonMarshallerAttribute('CreateTable')]
1062 | function CreateTable(aCreateTableInput: tCreateTableInput):tCreateTableOutput;
1063 | [TAmazonMarshallerAttribute('DeleteBackup')]
1064 | function DeleteBackup(aDeleteBackupInput: tDeleteBackupInput):tDeleteBackupOutput;
1065 | [TAmazonMarshallerAttribute('DeleteItem')]
1066 | function DeleteItem(aDeleteItemInput: tDeleteItemInput):tDeleteItemOutput;
1067 | [TAmazonMarshallerAttribute('DeleteTable')]
1068 | function DeleteTable(aDeleteTableInput: tDeleteTableInput):tDeleteTableOutput;
1069 | [TAmazonMarshallerAttribute('DescribeBackup')]
1070 | function DescribeBackup(aDescribeBackupInput: tDescribeBackupInput):tDescribeBackupOutput;
1071 | [TAmazonMarshallerAttribute('DescribeContinuousBackups')]
1072 | function DescribeContinuousBackups(aDescribeContinuousBackupsInput: tDescribeContinuousBackupsInput):tDescribeContinuousBackupsOutput;
1073 | [TAmazonMarshallerAttribute('DescribeEndpoints')]
1074 | function DescribeEndpoints(aDescribeEndpointsRequest: tDescribeEndpointsRequest):tDescribeEndpointsResponse;
1075 | [TAmazonMarshallerAttribute('DescribeGlobalTable')]
1076 | function DescribeGlobalTable(aDescribeGlobalTableInput: tDescribeGlobalTableInput):tDescribeGlobalTableOutput;
1077 | [TAmazonMarshallerAttribute('DescribeGlobalTableSettings')]
1078 | function DescribeGlobalTableSettings(aDescribeGlobalTableSettingsInput: tDescribeGlobalTableSettingsInput):tDescribeGlobalTableSettingsOutput;
1079 | [TAmazonMarshallerAttribute('DescribeLimits')]
1080 | function DescribeLimits(aDescribeLimitsInput: tDescribeLimitsInput):tDescribeLimitsOutput;
1081 | [TAmazonMarshallerAttribute('DescribeTable')]
1082 | function DescribeTable(aDescribeTableInput: tDescribeTableInput):tDescribeTableOutput;
1083 | [TAmazonMarshallerAttribute('DescribeTimeToLive')]
1084 | function DescribeTimeToLive(aDescribeTimeToLiveInput: tDescribeTimeToLiveInput):tDescribeTimeToLiveOutput;
1085 | [TAmazonMarshallerAttribute('GetItem')]
1086 | function GetItem(aGetItemInput: tGetItemInput):tGetItemOutput;
1087 | [TAmazonMarshallerAttribute('ListBackups')]
1088 | function ListBackups(aListBackupsInput: tListBackupsInput):tListBackupsOutput;
1089 | [TAmazonMarshallerAttribute('ListGlobalTables')]
1090 | function ListGlobalTables(aListGlobalTablesInput: tListGlobalTablesInput):tListGlobalTablesOutput;
1091 | [TAmazonMarshallerAttribute('ListTables')]
1092 | function ListTables(aListTablesInput: tListTablesInput):tListTablesOutput;
1093 | [TAmazonMarshallerAttribute('ListTagsOfResource')]
1094 | function ListTagsOfResource(aListTagsOfResourceInput: tListTagsOfResourceInput):tListTagsOfResourceOutput;
1095 | [TAmazonMarshallerAttribute('PutItem')]
1096 | function PutItem(aPutItemInput: tPutItemInput):tPutItemOutput;
1097 | [TAmazonMarshallerAttribute('Query')]
1098 | function Query(aQueryInput: tQueryInput):tQueryOutput;
1099 | [TAmazonMarshallerAttribute('RestoreTableFromBackup')]
1100 | function RestoreTableFromBackup(aRestoreTableFromBackupInput: tRestoreTableFromBackupInput):tRestoreTableFromBackupOutput;
1101 | [TAmazonMarshallerAttribute('RestoreTableToPointInTime')]
1102 | function RestoreTableToPointInTime(aRestoreTableToPointInTimeInput: tRestoreTableToPointInTimeInput):tRestoreTableToPointInTimeOutput;
1103 | [TAmazonMarshallerAttribute('Scan')]
1104 | function Scan(aScanInput: tScanInput):tScanOutput;
1105 | [TAmazonMarshallerAttribute('TagResource')]
1106 | procedure TagResource(aTagResourceInput: tTagResourceInput);
1107 | [TAmazonMarshallerAttribute('UntagResource')]
1108 | procedure UntagResource(aUntagResourceInput: tUntagResourceInput);
1109 | [TAmazonMarshallerAttribute('UpdateContinuousBackups')]
1110 | function UpdateContinuousBackups(aUpdateContinuousBackupsInput: tUpdateContinuousBackupsInput):tUpdateContinuousBackupsOutput;
1111 | [TAmazonMarshallerAttribute('UpdateGlobalTable')]
1112 | function UpdateGlobalTable(aUpdateGlobalTableInput: tUpdateGlobalTableInput):tUpdateGlobalTableOutput;
1113 | [TAmazonMarshallerAttribute('UpdateGlobalTableSettings')]
1114 | function UpdateGlobalTableSettings(aUpdateGlobalTableSettingsInput: tUpdateGlobalTableSettingsInput):tUpdateGlobalTableSettingsOutput;
1115 | [TAmazonMarshallerAttribute('UpdateItem')]
1116 | function UpdateItem(aUpdateItemInput: tUpdateItemInput):tUpdateItemOutput;
1117 | [TAmazonMarshallerAttribute('UpdateTable')]
1118 | function UpdateTable(aUpdateTableInput: tUpdateTableInput):tUpdateTableOutput;
1119 | end;
1120 |
1121 | implementation
1122 |
1123 | procedure TAmazonDynamoDBClient.InitClient(aprofile: UTF8String;
1124 | asecret_key: UTF8String; aaccess_key: UTF8String; aregion: UTF8String);
1125 | begin
1126 | inherited InitClient(aprofile, asecret_key, aaccess_key, aregion);
1127 |
1128 | service := cdynamodb_endpointPrefix;
1129 | end;
1130 |
1131 | function TAmazonDynamoDBClient.BatchGetItem(aBatchGetItemInput: tBatchGetItemInput):tBatchGetItemOutput;
1132 | begin
1133 |
1134 | end;
1135 |
1136 | function TAmazonDynamoDBClient.BatchWriteItem(aBatchWriteItemInput: tBatchWriteItemInput):tBatchWriteItemOutput;
1137 | begin
1138 |
1139 | end;
1140 |
1141 | function TAmazonDynamoDBClient.CreateBackup(aCreateBackupInput: tCreateBackupInput):tCreateBackupOutput;
1142 | begin
1143 |
1144 | end;
1145 |
1146 | function TAmazonDynamoDBClient.CreateGlobalTable(aCreateGlobalTableInput: tCreateGlobalTableInput):tCreateGlobalTableOutput;
1147 | begin
1148 |
1149 | end;
1150 |
1151 | function TAmazonDynamoDBClient.CreateTable(aCreateTableInput: tCreateTableInput):tCreateTableOutput;
1152 | begin
1153 |
1154 | end;
1155 |
1156 | function TAmazonDynamoDBClient.DeleteBackup(aDeleteBackupInput: tDeleteBackupInput):tDeleteBackupOutput;
1157 | begin
1158 |
1159 | end;
1160 |
1161 | function TAmazonDynamoDBClient.DeleteItem(aDeleteItemInput: tDeleteItemInput):tDeleteItemOutput;
1162 | begin
1163 |
1164 | end;
1165 |
1166 | function TAmazonDynamoDBClient.DeleteTable(aDeleteTableInput: tDeleteTableInput):tDeleteTableOutput;
1167 | begin
1168 |
1169 | end;
1170 |
1171 | function TAmazonDynamoDBClient.DescribeBackup(aDescribeBackupInput: tDescribeBackupInput):tDescribeBackupOutput;
1172 | begin
1173 |
1174 | end;
1175 |
1176 | function TAmazonDynamoDBClient.DescribeContinuousBackups(aDescribeContinuousBackupsInput: tDescribeContinuousBackupsInput):tDescribeContinuousBackupsOutput;
1177 | begin
1178 |
1179 | end;
1180 |
1181 | function TAmazonDynamoDBClient.DescribeEndpoints(aDescribeEndpointsRequest: tDescribeEndpointsRequest):tDescribeEndpointsResponse;
1182 | begin
1183 |
1184 | end;
1185 |
1186 | function TAmazonDynamoDBClient.DescribeGlobalTable(aDescribeGlobalTableInput: tDescribeGlobalTableInput):tDescribeGlobalTableOutput;
1187 | begin
1188 |
1189 | end;
1190 |
1191 | function TAmazonDynamoDBClient.DescribeGlobalTableSettings(aDescribeGlobalTableSettingsInput: tDescribeGlobalTableSettingsInput):tDescribeGlobalTableSettingsOutput;
1192 | begin
1193 |
1194 | end;
1195 |
1196 | function TAmazonDynamoDBClient.DescribeLimits(aDescribeLimitsInput: tDescribeLimitsInput):tDescribeLimitsOutput;
1197 | begin
1198 |
1199 | end;
1200 |
1201 | function TAmazonDynamoDBClient.DescribeTable(aDescribeTableInput: tDescribeTableInput):tDescribeTableOutput;
1202 | begin
1203 |
1204 | end;
1205 |
1206 | function TAmazonDynamoDBClient.DescribeTimeToLive(aDescribeTimeToLiveInput: tDescribeTimeToLiveInput):tDescribeTimeToLiveOutput;
1207 | begin
1208 |
1209 | end;
1210 |
1211 | function TAmazonDynamoDBClient.GetItem(aGetItemInput: tGetItemInput):tGetItemOutput;
1212 | begin
1213 |
1214 | end;
1215 |
1216 | function TAmazonDynamoDBClient.ListBackups(aListBackupsInput: tListBackupsInput):tListBackupsOutput;
1217 | begin
1218 |
1219 | end;
1220 |
1221 | function TAmazonDynamoDBClient.ListGlobalTables(aListGlobalTablesInput: tListGlobalTablesInput):tListGlobalTablesOutput;
1222 | begin
1223 |
1224 | end;
1225 |
1226 | function TAmazonDynamoDBClient.ListTables(aListTablesInput: tListTablesInput):tListTablesOutput;
1227 | begin
1228 |
1229 | end;
1230 |
1231 | function TAmazonDynamoDBClient.ListTagsOfResource(aListTagsOfResourceInput: tListTagsOfResourceInput):tListTagsOfResourceOutput;
1232 | begin
1233 |
1234 | end;
1235 |
1236 | function TAmazonDynamoDBClient.PutItem(aPutItemInput: tPutItemInput):tPutItemOutput;
1237 | begin
1238 |
1239 | end;
1240 |
1241 | function TAmazonDynamoDBClient.Query(aQueryInput: tQueryInput):tQueryOutput;
1242 | begin
1243 |
1244 | end;
1245 |
1246 | function TAmazonDynamoDBClient.RestoreTableFromBackup(aRestoreTableFromBackupInput: tRestoreTableFromBackupInput):tRestoreTableFromBackupOutput;
1247 | begin
1248 |
1249 | end;
1250 |
1251 | function TAmazonDynamoDBClient.RestoreTableToPointInTime(aRestoreTableToPointInTimeInput: tRestoreTableToPointInTimeInput):tRestoreTableToPointInTimeOutput;
1252 | begin
1253 |
1254 | end;
1255 |
1256 | function TAmazonDynamoDBClient.Scan(aScanInput: tScanInput):tScanOutput;
1257 | begin
1258 |
1259 | end;
1260 |
1261 | procedure TAmazonDynamoDBClient.TagResource(aTagResourceInput: tTagResourceInput);
1262 | begin
1263 |
1264 | end;
1265 |
1266 | procedure TAmazonDynamoDBClient.UntagResource(aUntagResourceInput: tUntagResourceInput);
1267 | begin
1268 |
1269 | end;
1270 |
1271 | function TAmazonDynamoDBClient.UpdateContinuousBackups(aUpdateContinuousBackupsInput: tUpdateContinuousBackupsInput):tUpdateContinuousBackupsOutput;
1272 | begin
1273 |
1274 | end;
1275 |
1276 | function TAmazonDynamoDBClient.UpdateGlobalTable(aUpdateGlobalTableInput: tUpdateGlobalTableInput):tUpdateGlobalTableOutput;
1277 | begin
1278 |
1279 | end;
1280 |
1281 | function TAmazonDynamoDBClient.UpdateGlobalTableSettings(aUpdateGlobalTableSettingsInput: tUpdateGlobalTableSettingsInput):tUpdateGlobalTableSettingsOutput;
1282 | begin
1283 |
1284 | end;
1285 |
1286 | function TAmazonDynamoDBClient.UpdateItem(aUpdateItemInput: tUpdateItemInput):tUpdateItemOutput;
1287 | begin
1288 |
1289 | end;
1290 |
1291 | function TAmazonDynamoDBClient.UpdateTable(aUpdateTableInput: tUpdateTableInput):tUpdateTableOutput;
1292 | begin
1293 |
1294 | end;
1295 |
1296 |
1297 |
1298 | end.
1299 |
--------------------------------------------------------------------------------
/Samples/DynamoDB/Delphi/CreateTable1/DynamoDBCreateTable.dproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | {C8DE3069-2A24-45ED-BDA7-8AEA55E3AFE4}
4 | 18.4
5 | None
6 | DynamoDBCreateTable.dpr
7 | True
8 | Debug
9 | Win32
10 | 1
11 | Console
12 |
13 |
14 | true
15 |
16 |
17 | true
18 | Base
19 | true
20 |
21 |
22 | true
23 | Base
24 | true
25 |
26 |
27 | true
28 | Base
29 | true
30 |
31 |
32 | true
33 | Base
34 | true
35 |
36 |
37 | true
38 | Base
39 | true
40 |
41 |
42 | true
43 | Cfg_1
44 | true
45 | true
46 |
47 |
48 | true
49 | Base
50 | true
51 |
52 |
53 | DynamoDBCreateTable
54 | System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
55 | .\$(Platform)\$(Config)
56 | .\$(Platform)\$(Config)
57 | false
58 | false
59 | false
60 | false
61 | false
62 | $(BDS)\bin\delphi_PROJECTICON.ico
63 | $(BDS)\bin\delphi_PROJECTICNS.icns
64 |
65 |
66 | $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
67 | $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
68 | $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
69 | $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
70 | $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
71 | $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
72 | $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
73 | $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
74 | $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
75 | $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
76 | $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
77 | $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
78 | DBXInterBaseDriver;DataSnapCommon;DbxCommonDriver;dbxcds;CustomIPTransport;dsnap;IndyCore;CloudService;FmxTeeUI;bindcompfmx;dbrtl;bindcomp;xmlrtl;ibxpress;bindengine;soaprtl;FMXTee;inet;dbexpress;IndyIPClient;DBXSqliteDriver;fmx;IndySystem;DataSnapClient;DataSnapProviderClient;fmxase;IndyIPCommon;rtl;DbxClientDriver;IndyProtocols;bindcompdbx;$(DCC_UsePackage)
79 |
80 |
81 | DBXInterBaseDriver;DataSnapServer;DataSnapCommon;DataAbstract_SpiderMonkeyScripting_D18;DbxCommonDriver;dbxcds;CustomIPTransport;dsnap;IndyIPServer;IndyCore;CloudService;FmxTeeUI;RemObjects_Indy_D18;bindcompfmx;dbrtl;bindcomp;inetdb;xmlrtl;ibxpress;bindengine;soaprtl;FMXTee;DBXInformixDriver;DBXFirebirdDriver;inet;DBXSybaseASADriver;dbexpress;IndyIPClient;DataAbstract_DBXDriver_Pro_D18;DBXSqliteDriver;fmx;IndySystem;DataSnapClient;RemObjects_WebBroker_D18;DataSnapProviderClient;DBXOracleDriver;DataAbstract_DBXDriver_Enterprise_D18;fmxase;IndyIPCommon;inetdbxpress;rtl;DbxClientDriver;IndyProtocols;DBXMySQLDriver;bindcompdbx;fmxobj;fmxdae;DataSnapIndy10ServerTransport;$(DCC_UsePackage)
82 | true
83 | CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts
84 | Debug
85 |
86 |
87 | 1033
88 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
89 | CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
90 | true
91 | dxBarRS18;JvGlobus;dxPSCoreRS18;JvMM;JvManagedThreads;cxTreeListRS18;frxDB18;dxDockingRS18;NovusDevNETVCL_WebApp_D18;dxThemeRS18;dxPSdxOCLnkRS18;JvCrypt;NovusCodeLibraryPlus_Core_D18;DBXInterBaseDriver;DataSnapServer;DataSnapCommon;DataAbstract_SpiderMonkeyScripting_D18;cxTreeListdxBarPopupMenuRS18;NovusDevNETVCL_RODA_D18;JvNet;JvDotNetCtrls;dxGaugeControlRS18;DbxCommonDriver;DataAbstract_SQLiteDriver_D18;vclimg;dbxcds;DatasnapConnectorsFreePascal;JvXPCtrls;vcldb;cxExportRS18;BrowserClickD18;Hydra_FMX_D18;CustomIPTransport;dsnap;IndyIPServer;IndyCore;cxVerticalGridRS18;CloudService;dxPSdxDBOCLnkRS18;FmxTeeUI;dxADOServerModeRS18;RemObjects_Indy_D18;cxSchedulerRibbonStyleEventEditorRS18;dxPScxExtCommonRS18;JvDB;JvRuntimeDesign;cxEditorsRS18;cxSchedulerRS18;dxSpellCheckerRS18;dxPScxVGridLnkRS18;JclDeveloperTools;NovusCodeLibrary_Core_D18;dxRibbonRS18;NovusDevNETVCL_ROWebApp_D18;bindcompfmx;Hydra_RO_D18;vcldbx;cxBarEditItemRS18;cxPageControlRS18;dbrtl;dxMapControlRS18;bindcomp;inetdb;JvPluginSystem;SqlDir180;DBXOdbcDriver;dxPSdxSpreadSheetLnkRS18;JvCmp;JvTimeFramework;xmlrtl;ibxpress;dxBarExtItemsRS18;frxe18;vclactnband;bindengine;soaprtl;FMXTee;bindcompvcl;dxPsPrVwAdvRS18;cxPivotGridRS18;vclie;Jcl;dxmdsRS18;dxBarDBNavRS18;dxTileControlRS18;dxComnRS18;dxBarExtDBItemsRS18;DBXInformixDriver;dxWizardControlRS18;Intraweb;dxPScxSchedulerLnkRS18;dxNavBarRS18;dsnapcon;DBXFirebirdDriver;inet;DataAbstract_SDDriver_D18;dxPScxCommonRS18;JvPascalInterpreter;vclx;DBXSybaseASADriver;dxorgcRS18;dbexpress;JvBDE;IndyIPClient;DataAbstract_DBXDriver_Pro_D18;dxGDIPlusRS18;dxLayoutControlRS18;ZComponent;DBXSqliteDriver;tmswizdXE4;DataAbstract_ActiveScripting_D18;fmx;JvDlgs;IndySystem;TeeDB;frx18;inetdbbde;vclib;DataSnapClient;dxPScxTLLnkRS18;RemObjects_WebBroker_D18;cxSchedulerGridRS18;dxtrmdRS18;DataSnapProviderClient;DBXSybaseASEDriver;RemObjects_Synapse_D18;dxTabbedMDIRS18;MetropolisUILiveTile;dxPSLnksRS18;vcldsnap;NovusCodeLibrary_Parser_D18;dxPScxPivotGridLnkRS18;DBXDb2Driver;DBXOracleDriver;dxServerModeRS18;JvCore;DataAbstract_DBXDriver_Enterprise_D18;vclribbon;dxdborRS18;fmxase;vcl;IndyIPCommon;DBXMSSQLDriver;CodeSiteExpressPkg;NovusDevNETVCL_RO_D18;DataAbstract_IDE_D18;cxPivotGridChartRS18;JvAppFrm;inetdbxpress;webdsnap;dxPScxGridLnkRS18;cxLibraryRS18;JvDocking;adortl;JvWizards;dxPSdxDBTVLnkRS18;JvHMI;dxSpreadSheetRS18;tmsdXE4;JvBands;ZDbc;rtl;DbxClientDriver;ZPlain;Tee;DelphiXE4_RestApi;JclContainers;JvSystem;svnui;Hydra_Core_D18;JvControls;dxDBXServerModeRS18;IndyProtocols;DBXMySQLDriver;dxFlowChartRS18;bindcompdbx;TeeUI;JvJans;JvPrintPreview;JvPageComps;JvStdCtrls;JvCustom;ZCore;vcltouch;dxPSPrVwRibbonRS18;dxPSdxFCLnkRS18;tmsexdXE4;VclSmp;cxGridRS18;cxSchedulerTreeBrowserRS18;DataSnapConnectors;dxdbtrRS18;tmsxlsdXE4;dxCoreRS18;fmxobj;JclVcl;Hydra_VCL_D18;ZParseSql;svn;dxPSdxLCLnkRS18;fmxdae;cxPivotGridOLAPRS18;cxDataRS18;bdertl;EmbeddedWebBrowser_DXE4;DataSnapIndy10ServerTransport;$(DCC_UsePackage)
92 |
93 |
94 | NovusCodeLibraryPlus_Core_D18;DBXInterBaseDriver;DataSnapServer;DataSnapCommon;DataAbstract_SpiderMonkeyScripting_D18;DbxCommonDriver;DataAbstract_SQLiteDriver_D18;vclimg;dbxcds;DatasnapConnectorsFreePascal;vcldb;Hydra_FMX_D18;CustomIPTransport;dsnap;IndyIPServer;IndyCore;CloudService;FmxTeeUI;RemObjects_Indy_D18;NovusCodeLibrary_Core_D18;bindcompfmx;dbrtl;bindcomp;inetdb;SqlDir180;DBXOdbcDriver;xmlrtl;ibxpress;vclactnband;bindengine;soaprtl;FMXTee;bindcompvcl;vclie;DBXInformixDriver;Intraweb;dsnapcon;DBXFirebirdDriver;inet;vclx;DBXSybaseASADriver;dbexpress;IndyIPClient;DataAbstract_DBXDriver_Pro_D18;ZComponent;DBXSqliteDriver;fmx;IndySystem;TeeDB;vclib;DataSnapClient;RemObjects_WebBroker_D18;DataSnapProviderClient;DBXSybaseASEDriver;RemObjects_Synapse_D18;MetropolisUILiveTile;vcldsnap;DBXDb2Driver;DBXOracleDriver;DataAbstract_DBXDriver_Enterprise_D18;vclribbon;fmxase;vcl;IndyIPCommon;DBXMSSQLDriver;inetdbxpress;webdsnap;adortl;tmsdXE4;ZDbc;rtl;DbxClientDriver;ZPlain;Tee;DelphiXE4_RestApi;Hydra_Core_D18;IndyProtocols;DBXMySQLDriver;bindcompdbx;TeeUI;ZCore;vcltouch;tmsexdXE4;VclSmp;DataSnapConnectors;tmsxlsdXE4;fmxobj;Hydra_VCL_D18;ZParseSql;fmxdae;DataSnapIndy10ServerTransport;$(DCC_UsePackage)
95 | true
96 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
97 | Debug
98 | CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
99 | 1033
100 |
101 |
102 | DEBUG;$(DCC_Define)
103 | true
104 | false
105 | true
106 | true
107 | true
108 |
109 |
110 | false
111 |
112 |
113 | false
114 | RELEASE;$(DCC_Define)
115 | 0
116 | 0
117 |
118 |
119 |
120 | MainSource
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | Cfg_2
135 | Base
136 |
137 |
138 | Base
139 |
140 |
141 | Cfg_1
142 | Base
143 |
144 |
145 |
146 | Delphi.Personality.12
147 |
148 |
149 |
150 |
151 | DynamoDBCreateTable.dpr
152 |
153 |
154 | False
155 | False
156 | 1
157 | 0
158 | 0
159 | 0
160 | False
161 | False
162 | False
163 | False
164 | False
165 | 3081
166 | 1252
167 |
168 |
169 |
170 |
171 | 1.0.0.0
172 |
173 |
174 |
175 |
176 |
177 | 1.0.0.0
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 | true
199 |
200 |
201 |
202 |
203 | DynamoDBCreateTable.exe
204 | true
205 |
206 |
207 |
208 |
209 | .\
210 | true
211 |
212 |
213 |
214 |
215 | DynamoDBCreateTable
216 | true
217 |
218 |
219 |
220 |
221 | Contents\Resources\StartUp\
222 | true
223 |
224 |
225 |
226 |
227 | true
228 |
229 |
230 |
231 |
232 |
233 | true
234 |
235 |
236 |
237 |
238 | true
239 |
240 |
241 |
242 |
243 | 1
244 |
245 |
246 | Contents\MacOS
247 | 0
248 |
249 |
250 |
251 |
252 | classes
253 | 1
254 |
255 |
256 |
257 |
258 | library\lib\armeabi-v7a
259 | 1
260 |
261 |
262 |
263 |
264 | library\lib\armeabi
265 | 1
266 |
267 |
268 |
269 |
270 | library\lib\mips
271 | 1
272 |
273 |
274 |
275 |
276 | library\lib\armeabi-v7a
277 | 1
278 |
279 |
280 |
281 |
282 | res\drawable
283 | 1
284 |
285 |
286 |
287 |
288 | res\values
289 | 1
290 |
291 |
292 |
293 |
294 | res\drawable
295 | 1
296 |
297 |
298 |
299 |
300 | res\drawable-xxhdpi
301 | 1
302 |
303 |
304 |
305 |
306 | res\drawable-ldpi
307 | 1
308 |
309 |
310 |
311 |
312 | res\drawable-mdpi
313 | 1
314 |
315 |
316 |
317 |
318 | res\drawable-hdpi
319 | 1
320 |
321 |
322 |
323 |
324 | res\drawable-xhdpi
325 | 1
326 |
327 |
328 |
329 |
330 | res\drawable-small
331 | 1
332 |
333 |
334 |
335 |
336 | res\drawable-normal
337 | 1
338 |
339 |
340 |
341 |
342 | res\drawable-large
343 | 1
344 |
345 |
346 |
347 |
348 | res\drawable-xlarge
349 | 1
350 |
351 |
352 |
353 |
354 | 1
355 |
356 |
357 | 1
358 |
359 |
360 | 0
361 |
362 |
363 |
364 |
365 | 1
366 | .framework
367 |
368 |
369 | 0
370 |
371 |
372 |
373 |
374 | 1
375 | .dylib
376 |
377 |
378 | 0
379 | .dll;.bpl
380 |
381 |
382 |
383 |
384 | 1
385 | .dylib
386 |
387 |
388 | 1
389 | .dylib
390 |
391 |
392 | 1
393 | .dylib
394 |
395 |
396 | 1
397 | .dylib
398 |
399 |
400 | 0
401 | .bpl
402 |
403 |
404 |
405 |
406 | 0
407 |
408 |
409 | 0
410 |
411 |
412 | 0
413 |
414 |
415 | 0
416 |
417 |
418 | 0
419 |
420 |
421 | 0
422 |
423 |
424 |
425 |
426 | 1
427 |
428 |
429 | 1
430 |
431 |
432 | 1
433 |
434 |
435 |
436 |
437 | 1
438 |
439 |
440 | 1
441 |
442 |
443 | 1
444 |
445 |
446 |
447 |
448 | 1
449 |
450 |
451 | 1
452 |
453 |
454 | 1
455 |
456 |
457 |
458 |
459 | 1
460 |
461 |
462 | 1
463 |
464 |
465 | 1
466 |
467 |
468 |
469 |
470 | 1
471 |
472 |
473 | 1
474 |
475 |
476 | 1
477 |
478 |
479 |
480 |
481 | 1
482 |
483 |
484 | 1
485 |
486 |
487 | 1
488 |
489 |
490 |
491 |
492 | 1
493 |
494 |
495 | 1
496 |
497 |
498 | 1
499 |
500 |
501 |
502 |
503 | 1
504 |
505 |
506 |
507 |
508 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
509 | 1
510 |
511 |
512 | ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
513 | 1
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 | 1
522 |
523 |
524 | 1
525 |
526 |
527 | 1
528 |
529 |
530 |
531 |
532 |
533 |
534 | Contents\Resources
535 | 1
536 |
537 |
538 |
539 |
540 | library\lib\armeabi-v7a
541 | 1
542 |
543 |
544 | 1
545 |
546 |
547 | 1
548 |
549 |
550 | 1
551 |
552 |
553 | 1
554 |
555 |
556 | 1
557 |
558 |
559 | 0
560 |
561 |
562 |
563 |
564 | 1
565 |
566 |
567 | 1
568 |
569 |
570 |
571 |
572 | Assets
573 | 1
574 |
575 |
576 | Assets
577 | 1
578 |
579 |
580 |
581 |
582 | Assets
583 | 1
584 |
585 |
586 | Assets
587 | 1
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 | False
601 | False
602 | True
603 | False
604 |
605 |
606 | 12
607 |
608 |
609 |
610 |
611 |
612 |
--------------------------------------------------------------------------------