Sunucu Grupları
Ürünlerin tek sunucu yerine havuza kurulmasını sağlayan sunucu gruplarını yöneten beş uç.
Genel Bakış
Sunucu grubu, bir ürünün tek bir sunucu yerine bir havuza kurulmasını sağlar. Ürün grubu gösterir, yeni hizmetin hangi sunucuya düşeceğine doldurma stratejisi karar verir.
Grubun tipi kendi alanı değildir: üye sunuculardan gelir. Bu yüzden bir gruba yalnız aynı tipteki ve aynı modüldeki sunucular girebilir; karışık bir liste baştan reddedilir.
Referans
Grupları Listeleme
Sunucu gruplarını döndürür.
hosting ya da server. Üye sunuculardan gelir, siz vermezsiniz.curl 'https://panel.ornek.com/api/v1/admin/products/server-groups' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/server-groups', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/server-groups');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->GetServerGroups();{
"data": [
{
"id": 2,
"name": "Shared Pool",
"type": "hosting",
"fill_type": 1,
"server_ids": [34, 35],
"server_count": 2
}
],
"meta": { "total": 1, "page": 1, "limit": 25, "next_page": 0 }
}Grup Detayı
Tek bir sunucu grubunu döndürür. Şema liste öğesiyle aynıdır.
hosting ya da server. Üye sunuculardan gelir, siz vermezsiniz.curl 'https://panel.ornek.com/api/v1/admin/products/server-groups/2' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/server-groups/2', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/server-groups/2');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Products()->GetServerGroup(['id' => 2]);Grup Oluşturma
Sunucu grubu açar. Üyelerin tümü aynı tipi ve aynı modülü paylaşmak zorundadır.
hosting ya da server. Üye sunuculardan gelir, bu yüzden istekte hiç yer almaz.name boş.curl -X POST 'https://panel.ornek.com/api/v1/admin/products/server-groups' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"Shared Pool","servers":[34,35],"fill_type":1}'const res = await fetch('https://panel.ornek.com/api/v1/admin/products/server-groups', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Shared Pool',
servers: [34, 35],
fill_type: 1,
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/server-groups');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Shared Pool',
'servers' => [34, 35],
'fill_type' => 1,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Tip ve modul uyusmazligini once kendiniz eleyin: karisik liste tumden reddedilir.
$servers = Api::Products()->GetServers([], ['limit' => 100])['data'];
$cpanel = array_column(
array_filter($servers, fn (array $s): bool => $s['type'] === 'cPanel'),
'id',
);
Api::Products()->CreateServerGroup([
'name' => 'Shared Pool',
'servers' => $cpanel,
]);Grubu Güncelleme
Gönderdiğiniz alanları uygular. Üye listesini gönderirseniz grup o listeye eşitlenir.
hosting ya da server. Üye sunuculardan gelir, siz vermezsiniz.curl -X PATCH 'https://panel.ornek.com/api/v1/admin/products/server-groups/2' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"servers":[34,35,36]}'const res = await fetch('https://panel.ornek.com/api/v1/admin/products/server-groups/2', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ servers: [34, 35, 36] }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/server-groups/2');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['servers' => [34, 35, 36]]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Sunucu EKLEMEK icin mevcut listeyi de gonderin, yoksa digerleri gruptan cikar.
$group = Api::Products()->GetServerGroup(['id' => 2])['data'];
Api::Products()->UpdateServerGroup([
'id' => 2,
'servers' => [...$group['server_ids'], 36],
]);Grubu Silme
Sunucu grubunu siler. Bir ürün bu grubu kullanıyorsa silme reddedilir.
gate:product.server_group_delete kancası işlemi veto etti.curl -X DELETE 'https://panel.ornek.com/api/v1/admin/products/server-groups/2' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/products/server-groups/2', {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/products/server-groups/2');
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);// Grubu silmek uyelerini silmez: sunucular kalir, yalniz grup baglantisi gider.
$response = Api::Products()->DeleteServerGroup(['id' => 2]);Tuzaklar
Grup tipini üyelerinden aldığı için farklı tipteki ya da farklı modüldeki sunucular bir arada duramaz. Böyle bir liste gönderirseniz hiçbiri eklenmez, istek mixed_servers ile döner. Listeyi göndermeden önce kendi tarafınızda süzün.
Güncellemede sunucu listesi gönderirseniz grup tam olarak o listeye eşitlenir; listede olmayan sunucular gruptan çıkar. Bir sunucu eklemek için önce mevcut listeyi okuyun, üzerine ekleyin ve tamamını geri gönderin.
Hesap kapasitesi tanımlı olmayan bir sunucu grup üyesi olamaz ve istek no_capacity ile döner. Doldurma stratejisi kapasiteye göre karar verdiği için bu bir doğrulama değil, çalışma şartıdır.
İ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.