AWS Options
Options allow you to configure clients in code. Configuration via options takes precedence over all other configuration sources.
Basic usage
Each client has an accompanying options interface and class e.g. ISQSOptions and TSQSOptions for use with the TSQSClient class.
var
Options: ISQSOptions;
begin
Options := TSQSOptions.Create;
Options.RetryLimit := 5;
SQS := TSQSClient.Create(Options);
end.
Common options
Every options interface extends IAWSOptions which defines the options common to all clients, such as credentials, region, retry behaviour, and endpoints.
Service-scoped options
Options created with a service-specific class like TS3Options are scoped to that service. This allows you to build a single options object where most clients use common defaults but specific services are configured differently.
For example, to point S3 at a third-party provider while all other services use the default AWS endpoints:
var
S3Opts: IS3Options;
Options: IAWSOptions;
begin
S3Opts := TS3Options.Create;
S3Opts.EndpointUrl := 'https://s3.example.com';
Options := TAWSOptions.Create(S3Opts);
// S3 clients will use s3.example.com
S3 := TS3Client.Create(Options);
// Other clients will use the default AWS endpoints
SQS := TSQSClient.Create(Options);
end.
All options classes accept an IAWSOptions in their constructor. The merge logic handles scoping automatically so service-specific values only apply to their respective clients.
Note that all clients accept IAWSOptions, not just their
own options type. If you pass an ISNSOptions to an S3
client, the SNS-scoped values will be ignored and only
common values from IAWSOptions will apply. To configure a
specific client, use the matching options class for that
service, or a TAWSOptions which will apply to any client.