Yedek Depolama
Yedeklerin gönderileceği depolama hedeflerini kuran, sınayan ve kaldıran dokuz uç.
Genel Bakış
Depolama hedefi, yedeklerin nereye gönderileceğini tanımlar. Dokuz uç bu hedefleri kurar, sınar ve kaldırır. Yedeklerin ne zaman alınacağı ayrı bir konudur.
Sağlayıcılar iki gruba ayrılır. Sunucu tipi olanlar adres ve şifreyle kurulur. Bulut tipi olanlar ise kullanıcının tarayıcıda onay vermesini bekler. O yolda üç adım vardır: onay adresi al, kullanıcıyı gönder, dönen belirteçle hedefi oluştur.
Bir hedef kaydedilmeden önce gerçekten bağlanılır. Yanlış şifre yedek gecesinde değil, hedefi yazdığınız anda ortaya çıkar.
Referans
Sağlayıcıları Listeleme
Yedeklerin gönderilebileceği kurulu depolama sağlayıcılarını döndürür.
curl 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/providers' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage/providers', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/providers');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Sunucu-tipi saglayici ayarla kurulur; bulut saglayici KULLANICI ONAYI ister.
$providers = Api::Settings()->GetBackupStorageProviders()['data'];
$simple = array_filter($providers, fn ($p) => ! $p['oauth']);Bağlantıyı Sınama
Bir yapılandırmayı kaydetmeden bağlantı sınamasından geçirir.
curl -X POST 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/validate' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"type":"FTP","config":{"host":"ftp.ornek.com","username":"backup","password":"gizli"}}'const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage/validate', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'FTP',
config: { host: 'ftp.example.com', username: 'backup', password: secret },
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/validate');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'type' => 'FTP',
'config' => ['host' => 'ftp.example.com', 'username' => 'backup', 'password' => $secret],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Sinama HICBIR SEY KAYDETMEZ: gecmesi hedefin olustugu anlamina gelmez.
$check = Api::Settings()->ValidateBackupStorage([
'type' => 'FTP',
'config' => $config,
])['data'];
if ($check['validated']) Api::Settings()->CreateBackupStorage($payload);Onay Adresi Alma
Bulut sağlayıcılar için kullanıcının onay vereceği adresi üretir.
curl -X POST 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/oauth-url' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"type":"GoogleDrive"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage/oauth-url', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ type: 'GoogleDrive' }),
});
const { data } = await res.json();
window.location.href = data.authorize_url;$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/oauth-url');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['type' => 'GoogleDrive']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Adres tek basina yetmez: kullanici onay verip donmeden hedef OLUSTURULAMAZ.
$url = Api::Settings()->GetBackupOauthUrl(['type' => 'GoogleDrive'])['data']['authorize_url'];Bunny Alanlarını Getirme
Verilen hesap anahtarına bağlı Bunny depolama alanlarını döndürür.
curl -X POST 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/bunny-zones' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"account_api_key":"'"$BUNNY_KEY"'"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage/bunny-zones', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ account_api_key: bunnyKey }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/bunny-zones');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['account_api_key' => $bunnyKey]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Kayitli hedefin anahtari maskeli doner; maskeyi geri gonderirken KIMLIGI de verin.
$zones = Api::Settings()->GetBunnyZones([
'account_api_key' => '*****',
'id' => $storageId,
])['data']['zones'];Hedefleri Listeleme
Tanımlı yedek depolama hedeflerini döndürür.
curl 'https://panel.ornek.com/api/v1/admin/settings/backup/storage' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Son sinama ani ESKI olabilir: sifre o gunden beri degismis olabilir.
$targets = Api::Settings()->GetBackupStorages()['data'];
$stale = array_filter($targets, fn ($t) => $t['validated_at'] === null);Hedef Oluşturma
Yeni bir depolama hedefi kurar; kaydetmeden önce bağlanmayı dener.
ssl (FTPS) alanı panel formunda açık gelir; bağlantının şifreli kalması için "ssl": 1 gönderin.curl -X POST 'https://panel.ornek.com/api/v1/admin/settings/backup/storage' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"Uzak FTP","type":"FTP","config":{"host":"ftp.ornek.com","username":"backup","password":"gizli","folder_path":"/backups"}}'const res = await fetch('https://panel.ornek.com/api/v1/admin/settings/backup/storage', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Offsite FTP',
type: 'FTP',
config: {
host: 'ftp.example.com',
username: 'backup',
password: secret,
folder_path: '/backups',
},
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Offsite FTP',
'type' => 'FTP',
'config' => [
'host' => 'ftp.example.com',
'username' => 'backup',
'password' => $secret,
'folder_path' => '/backups',
],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Maske burada ISE YARAMAZ: korunacak eski deger yok, gercek sifreyi gonderin.
Api::Settings()->CreateBackupStorage([
'name' => 'Offsite FTP',
'type' => 'FTP',
'config' => ['host' => $host, 'username' => $user, 'password' => $secret],
]);Hedef Detayı
Tek bir hedefi ayarlarıyla birlikte döndürür.
curl 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/12' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.ornek.com/api/v1/admin/settings/backup/storage/${id}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Okudugunuzu OLDUGU GIBI baska bir hedef olusturmak icin kullanmayin: sifre maskelidir.
$target = Api::Settings()->GetBackupStorage(['id' => $id])['data'];Hedefi Güncelleme
Hedefin adını ve ayarlarını değiştirir.
***** şifreli alanın eski değerini korur.curl -X PATCH 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/12' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"Uzak FTP (AB)","config":{"folder_path":"/backups-eu","password":"*****"}}'const res = await fetch(`https://panel.ornek.com/api/v1/admin/settings/backup/storage/${id}`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Offsite FTP (EU)',
config: { folder_path: '/backups-eu', password: '*****' },
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Offsite FTP (EU)',
'config' => ['folder_path' => '/backups-eu', 'password' => '*****'],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Yol degisirse baglanti YENIDEN sinanir; yeni klasor yoksa guncelleme reddedilir.
Api::Settings()->UpdateBackupStorage([
'id' => $id,
'config' => ['folder_path' => '/backups-eu', 'password' => '*****'],
]);Hedefi Silme
Bir depolama hedefini kaldırır.
curl -X DELETE 'https://panel.ornek.com/api/v1/admin/settings/backup/storage/12' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.ornek.com/api/v1/admin/settings/backup/storage/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/settings/backup/storage/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Bulut hedefte silme ONAYI da geri alir: ayni hesabi yeniden eklemek yeni onay ister.
Api::Settings()->DeleteBackupStorage(['id' => $id]);Tuzaklar
Detay ve liste uçları gizli alanları maskeyle döndürür. Güncellemede maskeyi geri göndermek eski değeri korur. Oluşturmada ise korunacak eski değer yoktur: okuduğunuzu olduğu gibi yeni bir hedefe verirseniz şifre olarak maskenin kendisi kaydedilir ve bağlantı sınaması düşer.
Sınama ucu hiçbir şey kaydetmez; yalnız bağlantıyı dener. Geçmesi hedefin oluştuğu anlamına gelmez. Panelde iki adım arka arkaya göründüğü için bu karışır: sınama başarılı çıkar, oluşturma çağrısı unutulur ve zamanlamaya verecek bir hedef bulunamaz.
Onay isteyen bir sağlayıcıda ayarları yazmak yetmez: kullanıcının tarayıcıda erişim vermesi gerekir. Belirteç olmadan oluşturma çağrısı onay eksik diyerek düşer. Sağlayıcı listesindeki onay alanı, hangi sağlayıcının bu üç adımlı yolu istediğini önceden söyler.
Bir zamanlama hedefe bağlıyken silme çağrısı reddedilir. Önce zamanlamayı başka bir hedefe taşıyın ya da kaldırın. Bu koruma kasıtlıdır: hedefi sessizce silmek, zamanlamayı her gece boşa çalışan bir işe çevirirdi.
Bulut hedefi silinirken sağlayıcıdaki erişim izni de iptal edilir. Aynı hesabı yeniden eklemek yeni bir onay turu ister; eski belirteç işe yaramaz. İptal elden geldiğince denenir, yani sağlayıcıya ulaşılamazsa hedef yine de silinir ve izin sağlayıcı tarafında kalabilir.
İlgili Makaleler
Geri bildiriminiz için teşekkürler!
Yukarıda bulamadığınız her şey için destek ekibimiz her zaman yanınızda.