or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/gcloud@0.7.x
tile.json

tessl/pypi-gcloud

tessl install tessl/pypi-gcloud@0.7.0

Python client library for Google Cloud Platform services including Datastore, Storage, and Pub/Sub

Agent Success

Agent success rate when using this tile

93%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

78%

task.mdevals/scenario-8/

File Backup Manager

A utility for backing up local files to cloud storage and restoring them when needed.

Overview

Build a simple file backup manager that uploads local files to a cloud storage bucket and can download them back to the local filesystem. The system should handle text files, track their content types, and provide a straightforward interface for backup and restore operations.

Requirements

Backup Functionality

The system must support uploading files to cloud storage:

  • Accept a local file path and a destination name in the cloud bucket
  • Read the file content from the local filesystem
  • Upload the file content to the specified cloud storage location
  • Preserve the original file's content type during upload

Restore Functionality

The system must support downloading files from cloud storage:

  • Accept a cloud storage file name and a local destination path
  • Download the file content from cloud storage
  • Write the content to the specified local file path
  • Ensure the downloaded content matches what was originally uploaded

File Listing

The system must provide a way to list all backed-up files in the storage bucket to help users see what files are available for restoration.

Implementation

@generates

API

def backup_file(bucket_name, local_file_path, cloud_file_name):
    """
    Backs up a local file to cloud storage.

    Args:
        bucket_name: The name of the storage bucket
        local_file_path: Path to the local file to backup
        cloud_file_name: Destination name for the file in cloud storage
    """
    pass

def restore_file(bucket_name, cloud_file_name, local_file_path):
    """
    Restores a file from cloud storage to the local filesystem.

    Args:
        bucket_name: The name of the storage bucket
        cloud_file_name: Name of the file in cloud storage
        local_file_path: Destination path for the restored file
    """
    pass

def list_backup_files(bucket_name):
    """
    Lists all files currently backed up in the storage bucket.

    Args:
        bucket_name: The name of the storage bucket

    Returns:
        A list of file names stored in the bucket
    """
    pass

Test Cases

  • Uploading a text file and then downloading it results in identical content @test
  • Listing files in a bucket returns the names of all uploaded files @test
  • A file uploaded with a specific name can be downloaded using that same name @test

Dependencies { .dependencies }

gcloud { .dependency }

Provides cloud storage capabilities for file backup and retrieval.