def do_app_backup(self, storage, path): """ Top level function for doing source code backups. Args: storage: A str, one of the StorageTypes class members. path: A str, the name of the backup file to be created. Returns: A JSON string to return to the client. """ if not backup_recovery_helper.app_backup(storage, path): return self.bad_request("Source code backup failed!") logging.info("Successful source code backup!") return json.dumps({'success': True, 'reason': ''})
def backup_apps(storage, bucket): """ Triggers a backup of the source code of deployed apps. Args: storage: A str, one of the StorageTypes class members. bucket: A str, the name of the remote bucket where the backups will be stored. Returns: True on success, False otherwise. """ full_bucket_name = '' if storage == StorageTypes.GCS: full_bucket_name = 'gs://{0}'.format(bucket) return BR.app_backup(storage, full_bucket_name=full_bucket_name)