Skip to content

API Documentation .NET Framework

David Pallmann edited this page Jan 31, 2019 · 7 revisions

PolyCloud.Storage API - .NET Framework Documentation

Overview

PolyCloud.Storage is a unified API for accessing cloud storage on multiple cloud platforms. The API provides basic operations for working with folders (buckets on AWS and GCP; containers on Azure) and files (objects on AWS and GCP; blobs on Azure). The API focuses on common operations available for the three cloud platforms; to get at features specific to only one platform, you'll need to write your own code.

Classes

The primary classes in the PolyCloud.Storage namespace are Storage (an abstract class) and three derived classes for each cloud platform: AWSStorage, AzureStorage, and GCPStorage.

Connecting

To connect to a particular platform, call the appropriate xxxxStorage class and pass in credentials. The credential arguments are different for each platform. Then call the Open method to open the connection. After performing storage operations, call Close to close the connection.

Example:

AWSStorage storage = new AWSStorage(accessKey, secretKey, endpointName);

storage.Open();

List<CloudFolder> folders = storage.ListFolders();

storage.Close();

AWS

To connect to an AWS S3 account, construct an instance of AWSStorage, specifying access key, secretkey, and S3 region name, such as "us-east-1".

AWSStorage storage = new AWSStorage(accessKey, secretKey, endpointName); // Explicit authentication

Note that if your code will be running on EC2, you may specify null for access key and secret key; this will use implicit credentials based on the role assigned to your EC2 instance. This is an AWS security best practice, but if your code is not running on AWS (on your desktop PC for example) then you'll need to specify an access key and secret key.

AWSStorage storage = new AWSStorage(null, null, endpointName); // Implicit authentication on EC2

Azure

To con

Clone this wiki locally