Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Rapidly Create Cloud Aware Native Applications

rapidly create cloud aware native applications

You get built-in components to work with Microsoft Azure and Amazon Web Services. For instance, Data.Cloud.AmazonAPI contains classes that implement the API for using the Amazon services (such as queue, table). And the TAmazonStorageService class allows you to connect to the Amazon Simple Storage Service (S3) service easily.

Here are some of the methods that allow you to manage buckets and objects:

var
  ResponseInfo: TCloudResponseInfo;
  StorageService: TAmazonStorageService;
  BucketName:String;
begin
  BucketName := 'my-bucket-name-vjsep967w37'; // the bucket name must be unique
  StorageService := TAmazonStorageService.Create(AmazonConnectionInfo1);
  ResponseInfo := TCloudResponseInfo.Create;
  try
    if StorageService.CreateBucket(BucketName, amzbaNotSpecified, amzrNotSpecified, ResponseInfo) then
      Memo1.Lines.Append('Success! Bucket: ' + BucketName + ' created.')
    else
      Memo1.Lines.Append(Format('Failure! %s', [ResponseInfo.StatusMessage]));
  finally
    StorageService.Free;
    ResponseInfo.Free;
  end;
end;

You can find full documentation on the docwiki portal.

In addition to that, some tech partners of the Embarcadero provide a set of components to access services like Amazon S3, Digital Ocean Spaces, and more.

To be more clear, apart from getting complete implementation of the Amazon S3 interface, you get support for all major S3 storage providers.

What is the S3 Library?

Easily connect to Amazon S3 and other S3-compatible storage providers such as Digital Ocean Spaces, Wasabi, Backblaze B2, IBM Cloud Object Storage, Oracle Cloud, Linode, and others.

S3 Library Features

procedure TFormS3client.bGoClick(Sender: TObject);
var inputStr:string;
begin
  try
    Screen.Cursor := crHourGlass;
    is3S3Client1.AccessKey := tAccessKey.Text;
    is3S3Client1.SecretKey := tSecretKey.Text;

    if cboProvider.ItemIndex = -1 then
      cboProvider.ItemIndex := 0;

    if cboProvider.ItemIndex = 10 then
      is3S3Client1.ServiceProvider := Tis3ServiceProviders(255)
    Else
      is3S3Client1.ServiceProvider := Tis3ServiceProviders(cboProvider.ItemIndex);

    if is3S3Client1.ServiceProvider = Tis3ServiceProviders.spCustom then
      if InputQuery('Enter Custom URL', 'Custom URL?', inputStr) then
        is3S3Client1.Config('URL='+inputStr);

    if is3S3Client1.ServiceProvider = Tis3ServiceProviders.spOracle then
      if InputQuery('Enter Oracle Namespace', 'Oracle Namespace?', inputStr) then
        is3S3Client1.Config('OracleNamespace='+inputStr);

    lvwBuckets.Items.Clear();
    is3S3Client1.ListBuckets();
  except on ex: EIPWorksS3 do
    ShowMessage('Exception: ' + ex.Message);
  end;
  Screen.Cursor := crDefault;
end;

How to get the IPWorks S3 Library?

You can head over and check out the S3 Library on the GetIt portal and download it in the IDE using the GetIt Package Manager.

Next, learn how you can append to String Python and answer other questions about String Operations in C++ software in this article.

Exit mobile version