genvid.toolbox.AzureStorageAccount¶
-
class
genvid.toolbox.
AzureStorageAccount
(bastionAPI, default_region=None)¶ ベースクラス:
object
Azure ストレージアカウントを作成して操作するためのユーティリティ。
-
AZURE_STORAGE_ACCOUNT
¶ AZURE_STORAGE_ACCOUNT
のミラーで、Azure ストレージアカウントの名前を指定します。
-
AZURE_RESOURCE_GROUP
¶ AZURE_RESOURCE_GROUP
のミラーで、Azure リソースグループ名を指定します。
-
AZURE_DEFAULT_REGION
¶ 戻り値: デフォルトの領域名。
-
get_storage_account_name
()¶ 使用するストレージアカウント名を取得します。
注釈
ストレージアカウントの名前は、3 文字以上 24 文字以下でユニークである必要があり、数字と小文字のみを使用することができます。
戻り値: 環境変数が設定されている場合は、self.AZURE_STORAGE_ACCOUNT。それ以外の場合は、操作されたストレージアカウント名が返されます。
-
create_storage_account
(storage_account: str, resource_group: str = None)¶ ストレージアカウントが存在しない場合に作成します。
create コマンドは、アカウントが存在しない場合にアカウントを作成します。アカウントが存在する場合は、このコマンドは無視されます。
パラメータ: - storage_account – 作成するストレージアカウント名。
- resource_group – 使用するリソースグループ。
-
list_storage_accounts
(resource_group: str = None) → list¶ リソースグループのストレージアカウントを一覧表示します。
パラメータ: resource_group – 使用するリソースグループ。
-
get_connection_string
(storage_account: str, resource_group: str = None) → str¶ ストレージアカウントの接続文字列を取得します。
パラメータ: - storage_account – 接続文字列の取得が必要なストレージアカウントの名前。
- resource_group – 使用するリソースグループ。
戻り値: ストレージアカウントの接続文字列。
-
create_resource_group
(region: str = None, resource_group: str = None)¶ リソースグループが存在しない場合に作成します。
リソースグループが存在する場合は、何の処理も行いません。それ以外の場合は、指定の領域にリソースグループが作成されます。
パラメータ: - region – リソースグループの作成が必要な領域。
- resource_group – 作成するリソースグループ。
-
check_resource_group_exist
(resource_group: str = None)¶ リソースグループが存在するかをチェックします。
パラメータ: resource_group – チェックするリソースグループ。 戻り値: リソースグループが存在する場合は True、存在しない場合は False。
-
get_tenant_id
()¶ azure アカウントのテナント ID を取得します。
戻り値: azureアカウントのテナントID。
-
upload_blob
(storage_account: str, container_name: str, blob_name: str, filepath: typing.Union[str, pathlib.Path])¶ Azure コンテナに特定の blob をアップロードします。
パラメータ: - storage_account – ストレージアカウント名。
- container_name – 処理を行うコンテナ名。
- blob_name – アップロードする blob 名
- filepath – アップロードするファイルのパス。
-
add_allowed_ip
(storage_account: str, ip: str)¶ IP アドレスを許可リストに追加します。
パラメータ: - storage_account – ストレージアカウント名。
- ip – 追加する IP アドレス。
-
delete_blob
(storage_account: str, container_name: str, blob_name: str)¶ Azure コンテナに特定の blob を削除します。
パラメータ: - storage_account – ストレージアカウント名。
- container_name – 処理を行うコンテナ名。
- blob_name – 削除する blob 名
-
create_container
(storage_account: str, container_name: str, access_level: str = 'blob')¶ Azure コンテナを作成します。
パラメータ: - storage_account – ストレージアカウント名。
- container_name – 処理を行うコンテナ名。
- access_level – blob のアクセスレベル。
-
list_containers
(storage_account: str)¶ ストレージアカウントのコンテナを一覧表示します。
パラメータ: storage_account – ストレージアカウント名。
-
list_allowed_ips
(storage_account: str) → list¶ ストレージアカウントに許可されている IP アドレスを一覧表示します。
パラメータ: storage_account – ストレージアカウント名。 戻り値: 許可された IP アドレスの一覧。
-
list_images
(storage_account: str, container_name: str, prefix: str)¶ コンテナ内の特定のパスの画像の一覧です。
パラメータ: - storage_account – ストレージアカウント名。
- container_name – 処理を行うコンテナ名。
- prefix – image/blob のプレフィックス。
戻り値: Images/blobs の一覧。
-
-
class
azure_storage.
AzureStorageAccount
¶