def move_blob()

in code/main.py [0:0]


def move_blob(bucket_name, blob_name):
    """Moves a blob from one bucket to another with a new name."""
    destination_bucket_name = os.environ['GCS_ARCHIVE_BUCKET']

    storage_client = storage.Client()
    source_bucket = storage_client.bucket(bucket_name)
    src_blob = source_bucket.blob(blob_name)
    dst_bucket = storage_client.bucket(destination_bucket_name)

    blob_copy = source_bucket.copy_blob(src_blob, dst_bucket, blob_name)
    source_bucket.delete_blob(blob_name)

    print(
        "Blob {} in bucket {} moved to blob {} in bucket {}.".format(
            src_blob.name,
            source_bucket.name,
            blob_copy.name,
            dst_bucket.name,
        )
    )