genvid.toolbox.AzureTool

class genvid.toolbox.AzureTool(bastionAPI)

Bases: object

Utilities to access and manipulate Azure resources.

NAME = 'Azure'
DESCRIPTION = 'Utilities to access and manipulate Azure resources.'
azure_format_container_key(key: str) str

Ensure the format of the key is correct.

More specifically, we remove any leading “/” and add a trailing “/” if the key is not empty.

Parameters

key (str) – Key to format.

Returns

Potentially reformated key.

get_azure_images_config(container: str, key_prefix='/', region=None) dict

Retrieve images configurations from an Azure Container.

Important

The image names must match DockerTool.RE_IMAGE_IMAGEID to be selected.

Parameters
  • container – The container identifier to operate on.

  • key_prefix – Container Key Prefix.

  • region (str) – The region in which the container resides.

Returns

A Dictionary with configuration.

add_ip_address_to_firewall(public_ips)

Add Public IP’s to list to allow access in Firewall and virtual networks of azure storage account.

Parameters

public_ips – Lists of List IP’s to be added.

upload_blob_to_container(container_name, blob_name: str, filepath: Union[str, Path], *, region=None)

Upload specific blob to an Azure Container.

Parameters
  • container_name – The name of container to operate on.

  • blob_name – Name of the blob to be uploaded

  • filepath (str) – Path to the file to be uploaded.

  • region (str) – Lookup region .

update_azure_storage_images(prefixes: List[str], container_name: str, key_prefix: str, images_folder: Optional[Union[Path, str]] = None, *, region=None)

Update images in an Azure Container.

Parameters
  • container_name – The Container name to operate on.

  • key_prefix – The prefix key where to upload the files.

  • prefixes – Update only files with these prefixes.

  • images_folder – The directory containing the source images.

  • region (str) – Region in which the container resides.

get_azure_container_id()

Get the Azure Container ID for images. :return: Container ID

add_external_ip_to_azure()

Add your external IP to azure firewall settings.

class azure_tool.AzureTool

Implementation of genvid.toolbox.AzureTool