This repository contains addons to allow integration with GCP Cloud Storage via Open Task Framework (OTF)
Open Task Framework (OTF) is a Python based framework to make it easy to run predefined file transfers and scripts/commands on remote machines.
This addons allows pushes and pulls of Files from (and to) GCP Cloud Storage Buckets.
GCP SA Credentials
This package uses google-auth to get OAuth2.0 creds for the GCP Token API. This includes access_token.
Prior to using this framework, a GCP IAM Service Account should be created through gcloud CLI or Web portal. The JSON credentials for the Service account should be exported and stored locally. (currently the .gitignore excludes any .json in the tests folder by default)
The Service account crednetials should be included in tests/testFiles and require only the following properties:
{
private_key= "-----BEGIN PRIVATE KEY-----\nMIIEv ....",
client_email= "file.upload@projectName.iam.gserviceaccount.com",
token_uri= "https://oauth2.googleapis.com/token"
}
The rest of the keys can be removed.
Running this OTF Addon, requires test files being placed in the src/tmp directory. Running the tests will perform an upload and download from/to GCP Cloud Storage.
Each request will generate a new Service Account Token, token refresh/state-keeping through AWS SSM or local cache has not been implemented yet.
Transfers
Transfers require a few additional arguments to work. These are:
- bucket: The bucket name of the Cloud Storage instance
- credentials: JSON object containing the above 3 credential properties.
Supported features
- File transfer: ingress/egress from/to Cloud Storage
- Renaming functionality
- PostCopy functionality
- fileWatch functionality
Configuration
JSON configs for transfers can be defined as follows:
Example file upload
"destination": {
"bucket": "bucketname",
"directory": "directory/nested",
"protocol": {
"name": "opentaskpy.addons.gcp.remotehandlers.bucket.BucketTransfer",
"credentials": "{LOOKUP DEFINITION FOR SA CREDENTIALS}",
},
"rename":{
"pattern":"Hithere",
"sub": "Hi"
}
}
Example file download
"source": {
"bucket": "bucketname",
"directory": "directory/nested",
"protocol": {
"name": "opentaskpy.addons.gcp.remotehandlers.bucket.BucketTransfer",
"credentials": "{LOOKUP DEFINITION FOR SA CREDENTIALS}",
},
"postCopyAction":{
"action":"move",
"destination": "directory/nested/processed",
"pattern" : "(?<![^ ])(?=[^ ])(?!ab)", ## Regex for prefixing
"sub" : "Archived_"
},
"fileRegex": ".*//.txt$" ## accepts re module matching
}
Metadata
Release files for otf-addons-gcp 24.37.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| otf_addons_gcp-24.37.0.tar.gz | 28.3 kB | Without provenance | Details for otf_addons_gcp-24.37.0.tar.gz |
Release files / otf_addons_gcp-24.37.0.tar.gz
| Download URL | otf_addons_gcp-24.37.0.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07a25bc42e2ad9dd3d4b52231f658a13768dc6bcb283d0eea72b29d63ac47910
|
|
BLAKE2b-256 checksum How to use checksums |
5f03f16879b62fe42cc03428bfe37373528c6914012b15474cca4637c4e07ccc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.4
|
Security for otf-addons-gcp 24.37.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.