genvid.toolbox.AzureStorageAccount

class genvid.toolbox.AzureStorageAccount(bastionAPI, default_region=None)

Bases: object

Utilities to create and manipulate Azure Storage Account.

NAME = 'Azure Storage Account'
DESCRIPTION = 'Utilities to create and manipulate Azure Storage Account.'
AZURE_STORAGE_ACCOUNT
AZURE_RESOURCE_GROUP
AZURE_DEFAULT_REGION
Returns:The default region name.
get_storage_account_name()

Retrieves the name of storage account to use.

Note

Name of storage acount must be unique, between 3 to 24 characters, and can only contain numbers and lowercase letters.

Returns:self.AZURE_STORAGE_ACCOUNT if the environment variable is set. Otherwise, a manipulated storage account name is returned.
get_access_token()

Retrieves Access token for Azure Account.

:raises RuntimeError : If Access token could not be retrieved. :return: Access Token

create_storage_account(storage_account: str)

Creates storage account if it doesn’t exists.

The create command will create the account if it does not exist. Othervise, the command will be ignored.

Parameters:storage_account – The name of storage account to create.

:raises RuntimeError : If storage account cannot be created.

get_connection_string(storage_account: str) → str

Get the connection string for the storage account.

Parameters:storage_account – The name of storage account for which connection string needs to be retrieved.
Returns:Connection String for storage account.
Raises:RuntimeError – If connection string could not be retrieved.
create_resource_group(region: str = None)

Creates Resource Group if it doesn’t exists.

If the resource group already exists, nothing will be done. Othervise, a resource gorup in specified region will be created.

Parameters:region – Region in which resource group needs to be created.

:raises RuntimeError : If resource group cannot be created.

class azure_storage.AzureStorageAccount

Implementation of genvid.toolbox.AzureStorageAccount