واجهة التوسيع والتنبيهات (API)
مرجع نقاط نهاية سياسة التوسيع التلقائي، ومعاينة التكلفة، وأحداث التوسيع، وعمليات سياسات التنبيه، وموجز التنبيهات، وتأكيد بريد الإشعارات.
التوسيع التلقائي
سياسة واحدة لكل تطبيق: PUT ينشئها أو يستبدلها، وDELETE يزيلها ويعيد
عدد نسخ ثابتاً. نقطة المعاينة تسعّر مدى أدنى/أقصى دون حفظ أي شيء (بمعدّل
طلبات محدود لكل حساب)، ونقطة أحداث التوسيع تتصفّح سجلّ تغيّرات عدد النسخ.
المفاهيم والقواعد في دليل التوسيع التلقائي.
أخطاء تستحق المعرفة: 409 UNSUPPORTED_SERVICE_TYPE (قواعد البيانات
المُدارة لا تتوسّع)، و409 AUTOSCALING_PERSISTENCE_CONFLICT (التخزين
الدائم)، و409 QUOTA_EXCEEDED (سقف النسخ في الخطة)، و
422 INSUFFICIENT_BALANCE_FOR_AUTOSCALING (شرط رصيد الـ 48 ساعة). وما
دامت السياسة فعّالة، يعيد تغيير replicas عبر نقطة تحديث التطبيق الرمز
409 AUTOSCALING_OWNS_REPLICAS.
Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X PUT "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling" \ -H "Content-Type: application/json" \ -d '{ "minReplicas": 1, "maxReplicas": 1 }'{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"enabled": true,
"minReplicas": 0,
"maxReplicas": 0,
"targetCPUPercent": 0,
"targetMemoryPercent": 0,
"scaleDownStabilizationSeconds": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling"{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"enabled": true,
"minReplicas": 0,
"maxReplicas": 0,
"targetCPUPercent": 0,
"targetMemoryPercent": 0,
"scaleDownStabilizationSeconds": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X DELETE "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling"{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Query Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/autoscaling/preview?min=1&max=1"{
"minReplicas": 0,
"maxReplicas": 0,
"costUUSD": {
"atMin": 0,
"atMax": 0
},
"requiredBalanceUUSD": 98628
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Query Parameters
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/scaling-events"{
"events": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"fromReplicas": 0,
"toReplicas": 0,
"reason": "autoscale",
"occurred_at": "2019-08-24T14:15:22Z"
}
],
"limit": 0,
"next_before_time": "2019-08-24T14:15:22Z",
"next_before_id": "0ce7fc60-5733-4ae4-967b-4beb905a3fd7"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}سياسات التنبيه
حتى 10 سياسات لكل خدمة، للتطبيقات ولقواعد البيانات المُدارة على السواء.
يثبت المقياس عند الإنشاء، ويغطّي PATCH ما عداه (الاسم والحدّ والنافذة
الزمنية ومستوى الخطورة والمفاتيح). أمّا GET /v1/alerts فهو موجز أحداث
التنبيه على مستوى الحساب مع ترقيم صفحات بالمؤشّر. دلالات المقاييس وقواعد
الإشعارات في دليل التنبيهات.
Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "metric": "cpu_percent", "threshold": 1, "window_seconds": 60 }'{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"name": "string",
"metric": "cpu_percent",
"threshold": 1,
"comparison": "gt",
"window_seconds": 60,
"severity": "warning",
"enabled": true,
"notify_email": false,
"cooldown_seconds": 900,
"state": "ok",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}nullAuthorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies"[
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"name": "string",
"metric": "cpu_percent",
"threshold": 1,
"comparison": "gt",
"window_seconds": 60,
"severity": "warning",
"enabled": true,
"notify_email": false,
"cooldown_seconds": 900,
"state": "ok",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
All fields optional. metric is intentionally excluded — change metric by deleting and recreating.
Response Body
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Content-Type: application/json" \ -d '{}'{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"name": "string",
"metric": "cpu_percent",
"threshold": 1,
"comparison": "gt",
"window_seconds": 60,
"severity": "warning",
"enabled": true,
"notify_email": false,
"cooldown_seconds": 900,
"state": "ok",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X DELETE "https://example.com/v1/projects/497f6eca-6276-4993-bfeb-53cbbbba6f08/containers/497f6eca-6276-4993-bfeb-53cbbbba6f08/alert-policies/497f6eca-6276-4993-bfeb-53cbbbba6f08"{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Query Parameters
ISO-8601 / RFC3339 lower bound for fired_at.
Filter to events for a specific service.
Keyset cursor — fired_at of the last item on the previous page.
Keyset cursor — id of the last item on the previous page.
Page size (1–100, default 50).
Response Body
application/json
application/json
curl -X GET "https://example.com/v1/alerts"[
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",
"policy_name": "string",
"service_id": "641e839f-864e-4cce-98f9-40f6cbb3e9e0",
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
"state": "firing",
"metric": "string",
"observed_value": 0,
"threshold": 0,
"fired_at": "2019-08-24T14:15:22Z"
}
]{
"error": "validation failed",
"request_id": "01J9Z3K8QWERTYUIOP"
}تأكيد بريد الإشعارات
لا تُرسَل رسائل التنبيه إلا إلى عنوان مُؤكَّد. verify يرسل رسالة التأكيد
(3 طلبات في الساعة)، وconfirm هو الرابط داخل تلك الرسالة: لا يحتاج
مصادقة، ويعمل مرة واحدة، وتنتهي صلاحيته بعد 24 ساعة.
Authorization
bearerAuth Bearer JWT obtained after Google sign-in in the portal.
In: header
Response Body
application/json
curl -X POST "https://example.com/v1/settings/notify-email/verify"nullcurl -X GET "https://example.com/v1/settings/notify-email/confirm?token=string""string""string""string"