objectstore
Experimental. For evaluation. Interfaces, configuration, and behavior may change incompatibly.
Stores workflow files and creates signed upload and download requests through S3-compatible storage or GCS.
Prerequisites
- Existing S3-compatible or GCS bucket reachable by the worker.
- S3 access keys or GCS application-default credentials with access to the bucket. GCS signed download/upload requests require signing-capable credentials. With user ADC or credentials without a private signing key, configure
signer_service_account_email, grant the calling identityiam.serviceAccounts.signBlobon that service account, and enable the IAM Service Account Credentials API.
Setup
- For S3-compatible storage:
- Set
regionif required by the storage service. - For GCS with application-default credentials:
This module must be enabled in your Remediation Orchestrator config before it is available to scripts.
This module provides utilities for interacting with object storage.
Members
- create_read_only_presigned_request
- create_write_presigned_post
- get_file
- list
- upload_file
- upload_text
create_read_only_presigned_request
objectstore.create_read_only_presigned_request(file_path, duration?)Create a read-only presigned request for a file in object storage.
Parameters
file_pathstringThe path to the file in object storage which should be readable via the generated presigned URL.duration?optionalstringThe Go-style duration for which the presigned URL should be valid. Duration cannot exceed ‘168h’ or 7 days. Default value is ‘1h’.Returns
requestobjectstore.PresignedRequestThe presigned request for the file.create_write_presigned_post
objectstore.create_write_presigned_post(path, duration?)Create a write presigned post request, which allows uploading multiple files in object storage.
Parameters
pathstringThe object storage path where files will be uploaded to using the generated presigned post.duration?optionalstringThe Go-style duration for which the presigned post should be valid. Duration cannot exceed ‘168h’ or 7 days. Default value is ‘1h’.Returns
postobjectstore.PresignedPostThe presigned post.get_file
objectstore.get_file(file_path)Get a file from object storage.
Parameters
file_pathstringThe path to the file in object storage.Returns
filescriptrt.FileThe file object.list
objectstore.list(prefix)List objects in object storage.
Parameters
prefixstringThe prefix to list objects for.Returns
fileslist[string]The list of file paths.upload_file
objectstore.upload_file(file, prefix)Upload a file to object storage.
Parameters
filescriptrt.FileThe file object.prefixstringThe path to the file in object storage.Returns
file_pathstringThe path to the file in object storage.upload_text
objectstore.upload_text(text, path)Write a string to object storage.
Parameters
textstringThe text to write. It cannot be empty or larger than 1 MiB.pathstringThe path of the object in object storage.Returns
file_pathstringThe path to the file in object storage.