Storage Connections

Description

Storage is an Alpha Anywhere abstraction for dealing with different types of storage using a standard interface. Currently, 3 type of storage are supported - Amazon S3, Azure and Disk storage.

Discussion

Storage is used for storing files.

To work with Storage you will need a storage connection string to 'connect' to the storage object.

Named connection strings are typically used (in much the same way that named AlphaDAO connection strings are used when you connect to a SQL database).

To create a named storage connection string, select the Tools, Storage Connection strings menu item from the Tools menu when the Web Control Panel has focus.

This will open a dialog where you can create as many named storage connection strings as you want.

When you create or edit a named storage connection string, the Connection String dialog is shown:

Named storage connection strings are published in the a5_application.a5i file when you publish your application.

 Named Storage Connection String Builder Settings

The Named Storage Connection String Builder is used to build a named connection string to a storage container stored in Amazon S3, Azure, or on disk. A description of general settings and settings for each storage type are listed below.

  •  General Storage Connection Settings

    These are general settings that apply to all storage types.

    Property
    Description
    Storage Provider

    Where the files are stored. Files can be stored on Amazon S3, Azure or on Disk on the server hosting the Alpha Anywhere Application Server.

    Triple-DES Object Encryption Key (optional)

    If specified, used to encrypt the data in transit and at rest in the data container. Encryption takes place in the Alpha Anywhere Application Server. Click Generate a New Key to generate a random encryption key.

    Encrypt Connection String

    If checked, storage connection string will be encrypted using the specified passphrase.

    Encryption Passphrase

    The passphrase used to encrypt the connection string.

    Container Must Exist

    Check if the specified container must exist.

    Request Timeout (milliseconds)

    The timeout length specified as milliseconds. Used when connecting to or communicating with the storage container. If no response is received after the specified timeout, the operation is cancelled.

  •  Amazon S3 Storage Connection Settings

    When configuring a storage connection string for Amazon S3, you will have access to the settings below:

    Property
    Description
    Region

    The region where the Amazon S3 bucket is located.

    Access Key

    Your Amazon S3 access key.

    Secret Key

    The secret key for your Amazon S3 account.

    Show Secret Key

    If checked, shows the secret key in plaintext.

    Container Name

    The name of the Amazon S3 or Azure container where files are stored.

  •  Azure Storage Connection Settings

    These settings are for configuring an Azure storage connection.

    Property
    Description
    Use Test Storage

    If checked, uses the test storage container for Azure. Test Storage does not require an Account or Access Key.

    Account

    Your Azure account name.

    Access Key

    Your access key for your Azure account.

    Show Access Key

    If checked, shows the access key in plaintext.

    Container Name

    The name of the Amazon S3 or Azure container where files are stored.

  •  Disk Storage Connection Settings

    A "Disk" storage connection can be used to store files outside the webroot on the server running the Alpha Anywhere Application Sever. Using a storage connection is preferred to accessing directories directly using the FILE object in Xbasic, especially if you are using the Application Server for IIS.

    Property
    Description
    User Name

    The user name for accessing a network share. For deployed web applications, grant the machine and account access to the share instead of putting a user name and password into a connection string. This will simplify management and reduce the chance of someone gaining access to the user name and password.

    Password

    The password for your user name.

    Show Password

    If checked, shows the password in plaintext.

    Parent Path

    The base path on the server to the directory where files are stored.

 Xbasic Functions for Working with Storage

Several Xbasic helper functions make it easy to work with the storage. These helper functions are written on top of the low level storage objects are listed below.

Function
Description
a5Storage_saveFile()

saves a file in storage

a5Storage_saveData()

saves binary data in storage

a5Storage_getItemProperties()

gets information about a file in storage

a5Storage_getItem_as_blob()

retrieves an item from storage to a variable

a5Storage_getItem_as_file()

retrieves an item from storage and stores it as a local file

a5Storage_listItems()

create a CRLF delimited list of items in storage

a5Storage_deleteItem()

deletes an item from storage