Data.Cloud.AmazonAPI.TAmazonStorageService

From RAD Studio API Documentation
Jump to: navigation, search

Data.Cloud.AmazonAPI.TAmazonServiceData.Cloud.CloudAPI.TCloudServiceSystem.TObjectTAmazonStorageService

Delphi

TAmazonStorageService = class(TAmazonService)

C++

class PASCALIMPLEMENTATION TAmazonStorageService : public TAmazonService

Properties

Type Visibility Source Unit Parent
class public
Data.Cloud.AmazonAPI.pas
Data.Cloud.AmazonAPI.hpp
Data.Cloud.AmazonAPI Data.Cloud.AmazonAPI

Description

Allows you to connect to the Amazon Simple Storage Service (S3) service.

This class provides methods that allow you to manage buckets and objects. Some of the more important methods are:

See the TAmazonStorageService API documentation for a list of all available methods.

For more information about the Amazon Simple Storage Service (S3) API, see the official Amazon Simple Storage Service Documentation.

Note: There is no concept of folder in Amazon Simple Storage Service (S3). There are ways to manage objects so that they appear to use the "folder structure". Read Objects:Object Key and Metadata for more information.

The following code snippet demonstrates how to create a new bucket using the TAmazonStorageService API:

Delphi:

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;

C++:

TCloudResponseInfo *ResponseInfo;
String BucketName;
TAmazonStorageService *StorageService;
BucketName = "my-bucket-name-vjsep967w37"; // the bucket name must be unique
StorageService = new TAmazonStorageService(AmazonConnectionInfo1);
ResponseInfo = new TCloudResponseInfo;
try
{
  if (StorageService->CreateBucket(BucketName, amzbaNotSpecified, amzrNotSpecified, ResponseInfo))
  {
    Memo1->Lines->Append("Success! Bucket: " + BucketName + " created.");
  }
  else
  {
    TVarRec args[1] = {ResponseInfo->StatusMessage};
    Memo1->Lines->Append(Format("Failure! %s", args, 0));
  }
}
__finally
{
  delete StorageService;
  delete ResponseInfo;
}

See Also