diff --git a/v2/CHANGELOG.md b/v2/CHANGELOG.md index a87f089d..c28d83db 100644 --- a/v2/CHANGELOG.md +++ b/v2/CHANGELOG.md @@ -16,6 +16,7 @@ - Switch to Go 1.21.8 - multi_delimiter analyzer support - Wildcard analyzer support +- Backup API support ## [2.0.3](https://github.com/arangodb/go-driver/tree/v2.0.3) (2023-10-31) diff --git a/v2/arangodb/client_admin.go b/v2/arangodb/client_admin.go index 9c1ad343..7a6d5af5 100644 --- a/v2/arangodb/client_admin.go +++ b/v2/arangodb/client_admin.go @@ -1,7 +1,7 @@ // // DISCLAIMER // -// Copyright 2023 ArangoDB GmbH, Cologne, Germany +// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -43,12 +43,10 @@ type ClientAdmin interface { SetServerMode(ctx context.Context, mode ServerMode) error } -type ClientAdminBackup interface { -} - type ClientAdminLog interface { // GetLogLevels returns log levels for topics. GetLogLevels(ctx context.Context, opts *LogLevelsGetOptions) (LogLevels, error) + // SetLogLevels sets log levels for a given topics. SetLogLevels(ctx context.Context, logLevels LogLevels, opts *LogLevelsSetOptions) error } diff --git a/v2/arangodb/client_admin_backup.go b/v2/arangodb/client_admin_backup.go new file mode 100644 index 00000000..30360f10 --- /dev/null +++ b/v2/arangodb/client_admin_backup.go @@ -0,0 +1,137 @@ +// +// DISCLAIMER +// +// Copyright 2024 ArangoDB GmbH, Cologne, Germany +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright holder is ArangoDB GmbH, Cologne, Germany +// + +package arangodb + +import ( + "context" + "time" +) + +type ClientAdminBackup interface { + // BackupCreate creates a new backup and returns its id + BackupCreate(ctx context.Context, opt *BackupCreateOptions) (BackupResponse, error) + + // BackupRestore restores the backup with given id + BackupRestore(ctx context.Context, id string) (BackupRestoreResponse, error) + + // BackupDelete deletes the backup with given id + BackupDelete(ctx context.Context, id string) error + + // BackupList returns meta data about some/all backups available + BackupList(ctx context.Context, opt *BackupListOptions) (ListBackupsResponse, error) + + // BackupUpload triggers an upload of backup into the remote repository using the given config + BackupUpload(ctx context.Context, backupId string, remoteRepository string, config interface{}) (TransferMonitor, error) + + // BackupDownload triggers a download of backup into the remote repository using the given config + BackupDownload(ctx context.Context, backupId string, remoteRepository string, config interface{}) (TransferMonitor, error) +} + +type TransferMonitor interface { + // Progress returns the progress of the transfer (upload/download) + Progress(ctx context.Context) (BackupTransferProgressResponse, error) + + // Abort the transfer (upload/download) + Abort(ctx context.Context) error +} + +type BackupCreateOptions struct { + // The label for this backup. + // The label is used together with a timestamp string create a unique backup identifier, _