Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devwithkrishna/python-storage-containers
azure storage blob modifications using python sdk and create workflow
https://github.com/devwithkrishna/python-storage-containers
azure-sdk-for-python azure-storage-acount blob github-workflow python
Last synced: about 2 months ago
JSON representation
azure storage blob modifications using python sdk and create workflow
- Host: GitHub
- URL: https://github.com/devwithkrishna/python-storage-containers
- Owner: devwithkrishna
- License: mit
- Created: 2023-12-10T10:48:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-10T16:03:48.000Z (4 months ago)
- Last Synced: 2024-09-10T17:54:00.776Z (4 months ago)
- Topics: azure-sdk-for-python, azure-storage-acount, blob, github-workflow, python
- Language: Python
- Homepage:
- Size: 222 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-storage-blob
azure storage container modifications using python sdk and create workflow
## Pre requesites
* this program expects the storage account access key to be configured as a secret in kv
- This is a best practice to not hardcode any sensitive values into public repositories and
leverage key vault.## What does the code do?
* It can create container in storage account
* it can delete a container from storage account
* It can create a SAS token for an expiry time using SP credentials
* it can recover a deleted container (soft delete enabled on storage account) from name
* it can recover all deleted containers in storage account
* it can list all containers and last modified date
* it can copy contents of a container to another (blob contents alone)## What is the new features to be added?
* * --> this will be done in a seperate repo for blob operations
* Uploading a blobs / directory
* deleting blobs / directory inside container
* Listing blobs / directory inside container
* Downloading blobs / directory
* Copying blobs / directory## Parameters
| parameter name| positional params| optional params | description |
|---------------|------------------|-----------------|---------------------------------------------------------------------------------------------------------------|
|storage_account| yes | no | storage account we are dealing with |
|time_limit_of_sas_token| yes | no | time limit for SAS token to be alive in hours |
|keyvault_name | yes | no | keyvault in which storage account key is stored as a secret |
|secret_name | yes | no | secret name of storage account access key in key vault |
|container_name| no | yes | used for creating / deleting a container/ recovering a deleted container |
|action | yes | no | create_container / delete_container / list_containers / recover_container / recover_all_deleted_containers / copy_data_from_one_container_to_another |## How to run the code
- Program is still in development, will add later
```
pipenv run python3 storage_containers.py --keyvault_name architects-keyvault \
--secret_name ARM-ACCESS-KEY \
--time_limit_of_sas_token 0.5 \
--storage_account techarchitectssa \
--container_name test2 \
--action recover_all_deleted_containers
``````
pipenv run python3 storage_containers.py --keyvault_name --secret_name --time_limit_of_sas_token --storage_account --container_name --action
```### Jira ticket associated
[jira story - DEVOPS-16](https://devwithkrishna.atlassian.net/jira/software/projects/DEVOPS/boards/1?selectedIssue=DEVOPS-16)