From eb3f2ed6e9003e40689588e38d4090678c86bdaa Mon Sep 17 00:00:00 2001 From: ysyneu Date: Sun, 5 Jul 2026 21:11:30 -0700 Subject: [PATCH] Sync OpenAPI spec Sync SDK with flashduty-docs OpenAPI updates. --- automations.go | 18 +- automations_fire.go | 36 - automations_fire_test.go | 121 --- channels.go | 14 - flashduty.go | 25 +- incident_trigger_subscription_models.go | 22 - incident_trigger_subscription_test.go | 29 - incidents.go | 23 - internal/cmd/gen/main.go | 9 +- models_gen.go | 193 ++--- openapi/openapi.en.json | 1008 ++++------------------ openapi/openapi.zh.json | 1026 ++++------------------- roundtrip_gen_test.go | 65 +- status_pages.go | 9 +- 14 files changed, 389 insertions(+), 2209 deletions(-) delete mode 100644 automations_fire.go delete mode 100644 automations_fire_test.go delete mode 100644 incident_trigger_subscription_models.go delete mode 100644 incident_trigger_subscription_test.go diff --git a/automations.go b/automations.go index f30d3dc..096eb62 100644 --- a/automations.go +++ b/automations.go @@ -37,7 +37,7 @@ func (s *AutomationsService) RuleReadList(ctx context.Context, req *AutomationRu // Create Automation rule. // -// Create an Automation rule with a schedule trigger and, optionally, an HTTP POST trigger. +// Create an Automation rule with schedule, HTTP POST, and On-call incident triggers. // // API: POST /safari/automation/rule/create (automation-rule-write-create). func (s *AutomationsService) RuleWriteCreate(ctx context.Context, req *AutomationRuleCreateRequest) (*AutomationRuleItem, *Response, error) { @@ -63,23 +63,9 @@ func (s *AutomationsService) RuleWriteDelete(ctx context.Context, req *Automatio return out, resp, nil } -// Run Automation rule now. -// -// Start a manual run for an Automation rule. -// -// API: POST /safari/automation/rule/run (automation-rule-write-run). -func (s *AutomationsService) RuleWriteRun(ctx context.Context, req *AutomationRuleIDRequest) (*AutomationRuleRunResponse, *Response, error) { - out := new(AutomationRuleRunResponse) - resp, err := s.client.do(ctx, "/safari/automation/rule/run", req, out) - if err != nil { - return nil, resp, err - } - return out, resp, nil -} - // Update Automation rule. // -// Update mutable fields on an Automation rule. The personal/team scope is immutable. +// Update mutable Automation rule fields, including HTTP POST and On-call incident trigger settings. // // API: POST /safari/automation/rule/update (automation-rule-write-update). func (s *AutomationsService) RuleWriteUpdate(ctx context.Context, req *AutomationRuleUpdateRequest) (*AutomationRuleItem, *Response, error) { diff --git a/automations_fire.go b/automations_fire.go deleted file mode 100644 index 906ba9f..0000000 --- a/automations_fire.go +++ /dev/null @@ -1,36 +0,0 @@ -package flashduty - -import ( - "context" - "fmt" - "net/http" - "net/url" - "strings" -) - -// TriggerWriteFire triggers an Automation run through its HTTP POST trigger URL. -// -// This endpoint authenticates with the trigger's one-time bearer token rather -// than the account app_key used by the generated API methods. -// -// API: POST /safari/automation/triggers/{trigger_id}/fire (automation-trigger-write-fire). -func (s *AutomationsService) TriggerWriteFire(ctx context.Context, triggerID, token string, req *AutomationFireAPITriggerRequest) (*AutomationFireAPITriggerResponse, *Response, error) { - triggerID = strings.TrimSpace(triggerID) - if triggerID == "" { - return nil, nil, fmt.Errorf("flashduty: automation trigger_id is required") - } - token = strings.TrimSpace(token) - if token == "" { - return nil, nil, fmt.Errorf("flashduty: automation trigger token is required") - } - - path := "/safari/automation/triggers/" + url.PathEscape(triggerID) + "/fire" - out := new(AutomationFireAPITriggerResponse) - resp, err := s.client.doMethodWithoutAppKey(ctx, http.MethodPost, path, req, out, func(httpReq *http.Request) { - httpReq.Header.Set("Authorization", "Bearer "+token) - }) - if err != nil { - return nil, resp, err - } - return out, resp, nil -} diff --git a/automations_fire_test.go b/automations_fire_test.go deleted file mode 100644 index 5ceb279..0000000 --- a/automations_fire_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package flashduty - -import ( - "context" - "encoding/json" - "io" - "net/http" - "strings" - "testing" -) - -func TestAutomationTriggerWriteFireUsesBearerTokenAndDecodesAccepted(t *testing.T) { - c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path != "/safari/automation/triggers/trig_abc/fire" { - t.Errorf("path = %s", r.URL.Path) - } - if got := r.URL.Query().Get("app_key"); got != "" { - t.Errorf("app_key must not be sent for trigger fire, got %q", got) - } - if got := r.Header.Get("Authorization"); got != "Bearer tok_secret" { - t.Errorf("Authorization = %q", got) - } - if got := r.Header.Get("Content-Type"); got != "application/json" { - t.Errorf("Content-Type = %q", got) - } - body, _ := io.ReadAll(r.Body) - if !strings.Contains(string(body), `"text":"deployment finished"`) || - !strings.Contains(string(body), `"dedup_key":"deploy-1"`) { - t.Errorf("body = %s", body) - } - - w.Header().Set("Flashcat-Request-Id", "RIDF") - w.WriteHeader(http.StatusAccepted) - _, _ = io.WriteString(w, `{"request_id":"RIDF","data":{"run_id":"taskrun_1","rule_id":"auto_1","trigger_kind":"http_post","status":"running"}}`) - }) - - out, resp, err := c.Automations.TriggerWriteFire(context.Background(), "trig_abc", "tok_secret", &AutomationFireAPITriggerRequest{ - Text: "deployment finished", - DedupKey: "deploy-1", - }) - if err != nil { - t.Fatalf("TriggerWriteFire error: %v", err) - } - if resp == nil || resp.StatusCode != http.StatusAccepted || resp.RequestID != "RIDF" { - t.Fatalf("response meta = %+v", resp) - } - if out == nil || out.RunID != "taskrun_1" || out.RuleID != "auto_1" || out.TriggerKind != "http_post" || out.Status != "running" { - t.Fatalf("decoded response = %+v", out) - } -} - -func TestAutomationTriggerWriteFireValidatesInputs(t *testing.T) { - c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) { - t.Fatal("request should not be sent") - }) - - if _, _, err := c.Automations.TriggerWriteFire(context.Background(), "", "tok", nil); err == nil { - t.Fatal("expected empty trigger_id error") - } - if _, _, err := c.Automations.TriggerWriteFire(context.Background(), "trig_abc", "", nil); err == nil { - t.Fatal("expected empty token error") - } -} - -func TestAutomationRuleUpdateRequestCanSendFalseValues(t *testing.T) { - payload, err := json.Marshal(&AutomationRuleUpdateRequest{ - RuleID: "auto_1", - Enabled: Bool(false), - ScheduleTriggerEnabled: Bool(false), - HTTPPostTriggerEnabled: Bool(false), - RotateHTTPPostTriggerToken: false, - TeamID: Int64(0), - EnvironmentID: String(""), - }) - if err != nil { - t.Fatal(err) - } - got := string(payload) - for _, want := range []string{ - `"rule_id":"auto_1"`, - `"enabled":false`, - `"schedule_trigger_enabled":false`, - `"http_post_trigger_enabled":false`, - `"team_id":0`, - `"environment_id":""`, - } { - if !strings.Contains(got, want) { - t.Fatalf("payload %s missing %s", got, want) - } - } - if strings.Contains(got, "rotate_http_post_trigger_token") { - t.Fatalf("zero rotate flag should stay omitted: %s", got) - } -} - -func TestAutomationRuleUpdateRequestPreservesOncallIncidentTriggerFields(t *testing.T) { - var req AutomationRuleUpdateRequest - if err := json.Unmarshal([]byte(`{ - "rule_id":"auto_1", - "oncall_incident_trigger_enabled":false, - "oncall_incident_channel_ids":[], - "oncall_incident_severities":[] - }`), &req); err != nil { - t.Fatal(err) - } - payload, err := json.Marshal(&req) - if err != nil { - t.Fatal(err) - } - got := string(payload) - for _, want := range []string{ - `"rule_id":"auto_1"`, - `"oncall_incident_trigger_enabled":false`, - `"oncall_incident_channel_ids":[]`, - `"oncall_incident_severities":[]`, - } { - if !strings.Contains(got, want) { - t.Fatalf("payload %s missing %s", got, want) - } - } -} diff --git a/channels.go b/channels.go index 63d980e..db00025 100644 --- a/channels.go +++ b/channels.go @@ -126,20 +126,6 @@ func (s *ChannelsService) ChannelEscalateRuleUpdate(ctx context.Context, req *Up return s.client.do(ctx, "/channel/escalate/rule/update", req, nil) } -// List webhook robots in escalation rules. -// -// List all IM webhook robots configured in escalation rules across the account. Returns a deduplicated list of robots with references to which channels and escalation rules use them. -// -// API: POST /channel/escalate/webhook/robot/list (channelEscalateWebhookRobotList). -func (s *ChannelsService) ChannelEscalateWebhookRobotList(ctx context.Context, req *ChannelsChannelEscalateWebhookRobotListRequest) (*ChannelsChannelEscalateWebhookRobotListResponse, *Response, error) { - out := new(ChannelsChannelEscalateWebhookRobotListResponse) - resp, err := s.client.do(ctx, "/channel/escalate/webhook/robot/list", req, out) - if err != nil { - return nil, resp, err - } - return out, resp, nil -} - // Get channel detail. // // Retrieve detailed information for a specific channel. diff --git a/flashduty.go b/flashduty.go index 4fc625b..fe6061c 100644 --- a/flashduty.go +++ b/flashduty.go @@ -97,20 +97,14 @@ type pageMeta struct { // parameter and JSON-encoding body when non-nil. Most Flashduty endpoints are // POST actions; a handful are GET with query parameters. func (c *Client) newRequest(ctx context.Context, method, path string, body any) (*http.Request, error) { - return c.newRequestWithAppKey(ctx, method, path, body, true) -} - -func (c *Client) newRequestWithAppKey(ctx context.Context, method, path string, body any, withAppKey bool) (*http.Request, error) { rel, err := url.Parse(strings.TrimPrefix(path, "/")) if err != nil { return nil, fmt.Errorf("flashduty: invalid path %q: %w", path, err) } u := c.BaseURL.ResolveReference(rel) - if withAppKey { - q := u.Query() - q.Set("app_key", c.appKey) - u.RawQuery = q.Encode() - } + q := u.Query() + q.Set("app_key", c.appKey) + u.RawQuery = q.Encode() var buf io.Reader var rawBody []byte @@ -170,21 +164,10 @@ func (c *Client) doGet(ctx context.Context, path string, opt, out any) (*Respons // (when non-nil), and returns a Response. A non-nil envelope error or a non-2xx // status yields an *ErrorResponse (or *RateLimitError on 429). func (c *Client) doMethod(ctx context.Context, method, path string, body, out any) (*Response, error) { - return c.doMethodWithAppKey(ctx, method, path, body, out, true, nil) -} - -func (c *Client) doMethodWithoutAppKey(ctx context.Context, method, path string, body, out any, configure func(*http.Request)) (*Response, error) { - return c.doMethodWithAppKey(ctx, method, path, body, out, false, configure) -} - -func (c *Client) doMethodWithAppKey(ctx context.Context, method, path string, body, out any, withAppKey bool, configure func(*http.Request)) (*Response, error) { - req, err := c.newRequestWithAppKey(ctx, method, path, body, withAppKey) + req, err := c.newRequest(ctx, method, path, body) if err != nil { return nil, err } - if configure != nil { - configure(req) - } httpResp, err := c.client.Do(req) if err != nil { return nil, fmt.Errorf("flashduty: request to %s failed: %v", sanitizeURL(req.URL), sanitizeError(err)) diff --git a/incident_trigger_subscription_models.go b/incident_trigger_subscription_models.go deleted file mode 100644 index 30e6993..0000000 --- a/incident_trigger_subscription_models.go +++ /dev/null @@ -1,22 +0,0 @@ -package flashduty - -// IncidentTriggerSubscriptionUpsertRequest creates or updates an incident trigger subscription. -// -// Enabled is pointer-backed because omitting it defaults to true, while a -// non-nil false explicitly disables the subscription. -type IncidentTriggerSubscriptionUpsertRequest struct { - // On-call channel IDs whose new incidents should trigger the consumer. - ChannelIDs []int64 `json:"channel_ids,omitempty" toon:"channel_ids,omitempty"` - // Consumer system. Use `fc_safari` for AI SRE automation rules. - Consumer string `json:"consumer,omitempty" toon:"consumer,omitempty"` - // Consumer-owned reference, such as an Automation rule ID. - ConsumerRef string `json:"consumer_ref,omitempty" toon:"consumer_ref,omitempty"` - // Whether the subscription is enabled. Defaults to true when omitted. - Enabled *bool `json:"enabled,omitempty" toon:"enabled,omitempty"` - // Incident severities to subscribe to. `Ok` is not valid. - Severities []string `json:"severities,omitempty" toon:"severities,omitempty"` - // Subscription source. Use `ai_sre_automation` for AI SRE automation rules. - Source string `json:"source,omitempty" toon:"source,omitempty"` - // Existing subscription ID. Omit to create or upsert by source, consumer, and consumer_ref. - SubscriptionID string `json:"subscription_id,omitempty" toon:"subscription_id,omitempty"` -} diff --git a/incident_trigger_subscription_test.go b/incident_trigger_subscription_test.go deleted file mode 100644 index c3827b4..0000000 --- a/incident_trigger_subscription_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package flashduty - -import ( - "encoding/json" - "strings" - "testing" -) - -func TestIncidentTriggerSubscriptionUpsertRequestPreservesDisabledValue(t *testing.T) { - var req IncidentTriggerSubscriptionUpsertRequest - if err := json.Unmarshal([]byte(`{ - "source":"ai_sre_automation", - "consumer":"fc_safari", - "consumer_ref":"auto_1", - "channel_ids":[2468013579], - "severities":["Critical"], - "enabled":false - }`), &req); err != nil { - t.Fatal(err) - } - payload, err := json.Marshal(&req) - if err != nil { - t.Fatal(err) - } - got := string(payload) - if !strings.Contains(got, `"enabled":false`) { - t.Fatalf("payload %s missing explicit enabled=false", got) - } -} diff --git a/incidents.go b/incidents.go index 41c45ed..0e62390 100644 --- a/incidents.go +++ b/incidents.go @@ -21,29 +21,6 @@ func (s *IncidentsService) ReadGetWarRoomDefaultObservers(ctx context.Context, r return out, resp, nil } -// Delete incident trigger subscription. -// -// Delete an incident trigger subscription for AI SRE automation. -// -// API: POST /incident-trigger-subscription/delete (incident-trigger-subscription-write-delete). -func (s *IncidentsService) TriggerSubscriptionWriteDelete(ctx context.Context, req *IncidentTriggerSubscriptionDeleteRequest) (*Response, error) { - return s.client.do(ctx, "/incident-trigger-subscription/delete", req, nil) -} - -// Create or update incident trigger subscription. -// -// Create or update an incident trigger subscription for AI SRE automation. -// -// API: POST /incident-trigger-subscription/upsert (incident-trigger-subscription-write-upsert). -func (s *IncidentsService) TriggerSubscriptionWriteUpsert(ctx context.Context, req *IncidentTriggerSubscriptionUpsertRequest) (*IncidentTriggerSubscription, *Response, error) { - out := new(IncidentTriggerSubscription) - resp, err := s.client.do(ctx, "/incident-trigger-subscription/upsert", req, out) - if err != nil { - return nil, resp, err - } - return out, resp, nil -} - // Add war-room member. // // Add one or more members to the IM war room bound to an incident integration. diff --git a/internal/cmd/gen/main.go b/internal/cmd/gen/main.go index f6bc38e..45d64f2 100644 --- a/internal/cmd/gen/main.go +++ b/internal/cmd/gen/main.go @@ -94,11 +94,10 @@ func run() error { schemas: asMap(asMap(spec["components"])["schemas"]), emptyTypes: map[string]bool{}, skip: map[string]bool{ - "SuccessEnvelope": true, - "ErrorResponse": true, - "DutyError": true, - "AutomationRuleUpdateRequest": true, // hand-written to preserve partial-update pointer semantics. - "IncidentTriggerSubscriptionUpsertRequest": true, // hand-written to preserve enabled=false. + "SuccessEnvelope": true, + "ErrorResponse": true, + "DutyError": true, + "AutomationRuleUpdateRequest": true, // hand-written to preserve partial-update pointer semantics. }, queued: map[string]bool{}, synth: map[string]any{}, diff --git a/models_gen.go b/models_gen.go index 7f780a6..3a1e499 100644 --- a/models_gen.go +++ b/models_gen.go @@ -165,20 +165,6 @@ func (e StatusPageSubscriberExportResponse) String() string { return string(e) } // StoreRulesetListResponse is a list response payload. type StoreRulesetListResponse []StoreRulesetItem -// ChannelsChannelEscalateWebhookRobotListRequest is generated from the Flashduty OpenAPI schema. -type ChannelsChannelEscalateWebhookRobotListRequest struct { - // Search keyword. Fuzzy matches against robot alias or token, case-insensitive. - Query string `json:"query,omitempty" toon:"query,omitempty"` - // Filter by robot type, e.g. `feishu`, `dingtalk`, `wecom`, `slack`, `teams`. Omit to return all types. - Type string `json:"type,omitempty" toon:"type,omitempty"` -} - -// ChannelsChannelEscalateWebhookRobotListResponse is generated from the Flashduty OpenAPI schema. -type ChannelsChannelEscalateWebhookRobotListResponse struct { - // Deduplicated list of webhook robots. - List []ChannelsChannelEscalateWebhookRobotListResponseListItem `json:"list" toon:"list"` -} - // A2aAgentCreateRequest is generated from the Flashduty OpenAPI schema. type A2aAgentCreateRequest struct { // Agent display name. @@ -1078,26 +1064,6 @@ type AuditSearchResponse struct { Total int64 `json:"total" toon:"total"` } -// AutomationFireAPITriggerRequest is generated from the Flashduty OpenAPI schema. -type AutomationFireAPITriggerRequest struct { - // Optional idempotency key; the same trigger + dedup_key reuses the same run. - DedupKey string `json:"dedup_key,omitempty" toon:"dedup_key,omitempty"` - // Context text passed to this Automation run. - Text string `json:"text,omitempty" toon:"text,omitempty"` -} - -// AutomationFireAPITriggerResponse is generated from the Flashduty OpenAPI schema. -type AutomationFireAPITriggerResponse struct { - // Rule ID. - RuleID string `json:"rule_id" toon:"rule_id"` - // Created or reused run ID. - RunID string `json:"run_id" toon:"run_id"` - // Current run status. - Status string `json:"status" toon:"status"` - // Trigger kind. - TriggerKind string `json:"trigger_kind" toon:"trigger_kind"` -} - // AutomationRuleCreateRequest is generated from the Flashduty OpenAPI schema. type AutomationRuleCreateRequest struct { // Run cadence. Supports 4 fields (`hour day month weekday`, minute defaults to 0) and 5 fields (`minute hour day month weekday`). The minute must be one fixed integer; 6-field seconds are not supported. The create API currently requires this field even for HTTP-POST-only rules; send a valid cron and set `schedule_trigger_enabled=false`. @@ -1112,11 +1078,11 @@ type AutomationRuleCreateRequest struct { HTTPPostTriggerEnabled bool `json:"http_post_trigger_enabled,omitempty" toon:"http_post_trigger_enabled,omitempty"` // Rule name. Name string `json:"name,omitempty" toon:"name,omitempty"` - // On-call channel IDs whose new incidents can trigger this rule. + // On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. OncallIncidentChannelIDs []int64 `json:"oncall_incident_channel_ids,omitempty" toon:"oncall_incident_channel_ids,omitempty"` - // Incident severities that can trigger this rule. + // Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. OncallIncidentSeverities []string `json:"oncall_incident_severities,omitempty" toon:"oncall_incident_severities,omitempty"` - // Whether to create and enable an on-call incident trigger for this rule. + // Whether the On-call incident trigger is enabled. OncallIncidentTriggerEnabled bool `json:"oncall_incident_trigger_enabled,omitempty" toon:"oncall_incident_trigger_enabled,omitempty"` // Task prompt sent to the AI SRE agent on each run. Prompt string `json:"prompt,omitempty" toon:"prompt,omitempty"` @@ -1158,11 +1124,11 @@ type AutomationRuleItem struct { HTTPPostTriggerURL string `json:"http_post_trigger_url" toon:"http_post_trigger_url"` // Rule name. Name string `json:"name" toon:"name"` - // On-call channel IDs watched by the incident trigger. + // On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. OncallIncidentChannelIDs []int64 `json:"oncall_incident_channel_ids" toon:"oncall_incident_channel_ids"` - // Incident severities watched by the trigger. + // Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. OncallIncidentSeverities []string `json:"oncall_incident_severities" toon:"oncall_incident_severities"` - // Whether the on-call incident trigger is enabled. + // Whether the On-call incident trigger is enabled. OncallIncidentTriggerEnabled bool `json:"oncall_incident_trigger_enabled" toon:"oncall_incident_trigger_enabled"` // On-call incident trigger ID. OncallIncidentTriggerID string `json:"oncall_incident_trigger_id" toon:"oncall_incident_trigger_id"` @@ -1208,42 +1174,6 @@ type AutomationRuleListResponse struct { Total int64 `json:"total" toon:"total"` } -// AutomationRuleRunPreflight is generated from the Flashduty OpenAPI schema. -type AutomationRuleRunPreflight struct { - // AI SRE app used to execute the rule. - AppName string `json:"app_name" toon:"app_name"` - // Preflight checks that were evaluated. - Checks []string `json:"checks" toon:"checks"` - // Whether the rule can start a run. - OK bool `json:"ok" toon:"ok"` - // Owner person ID used for the run context. - OwnerID int64 `json:"owner_id" toon:"owner_id"` - // Hidden session scope used for the run. - Scope string `json:"scope" toon:"scope"` - // Team ID used for team-scoped runs; 0 for personal runs. - TeamID int64 `json:"team_id" toon:"team_id"` - // Non-blocking preflight warnings. - Warnings []string `json:"warnings" toon:"warnings"` -} - -// AutomationRuleRunResponse is generated from the Flashduty OpenAPI schema. -type AutomationRuleRunResponse struct { - Preflight AutomationRuleRunPreflight `json:"preflight" toon:"preflight"` - // Rule ID. - RuleID string `json:"rule_id" toon:"rule_id"` - Run AutomationRuleRunView `json:"run" toon:"run"` - // Trigger kind for this run. - TriggerKind string `json:"trigger_kind" toon:"trigger_kind"` -} - -// AutomationRuleRunView is generated from the Flashduty OpenAPI schema. -type AutomationRuleRunView struct { - // Created automation run ID. - RunID string `json:"run_id" toon:"run_id"` - // Hidden AI SRE session ID started for this run. - SessionID string `json:"session_id" toon:"session_id"` -} - // AutomationRunItem is generated from the Flashduty OpenAPI schema. type AutomationRunItem struct { // Account ID. @@ -1768,7 +1698,7 @@ type CreateDropRuleRequest struct { // CreateEscalationRuleRequest is generated from the Flashduty OpenAPI schema. type CreateEscalationRuleRequest struct { - // Aggregation window in seconds. 0 disables aggregation. + // Delay window in seconds. 0 disables delay. AggrWindow int64 `json:"aggr_window,omitempty" toon:"aggr_window,omitempty"` // Channel the rule belongs to. ChannelID int64 `json:"channel_id,omitempty" toon:"channel_id,omitempty"` @@ -1926,6 +1856,43 @@ type CreateStatusPageChangeTimelineRequest struct { Status string `json:"status,omitempty" toon:"status,omitempty"` } +// CreateStatusPageRequest is generated from the Flashduty OpenAPI schema. +type CreateStatusPageRequest struct { + // Get-in-touch contact, such as a mailto or website URL. + ContactInfo string `json:"contact_info,omitempty" toon:"contact_info,omitempty"` + // Custom domain for a public status page. + CustomDomain string `json:"custom_domain,omitempty" toon:"custom_domain,omitempty"` + // Custom navigation links shown on the status page. + CustomLinks []map[string]string `json:"custom_links,omitempty" toon:"custom_links,omitempty"` + // How event dates are displayed. + DateView string `json:"date_view,omitempty" toon:"date_view,omitempty"` + // How uptime is displayed. + DisplayUptimeMode string `json:"display_uptime_mode,omitempty" toon:"display_uptime_mode,omitempty"` + // Display name of the status page. + Name string `json:"name,omitempty" toon:"name,omitempty"` + // Footer content shown on the status page. + PageFooter string `json:"page_footer,omitempty" toon:"page_footer,omitempty"` + // Header content shown on the status page. + PageHeader string `json:"page_header,omitempty" toon:"page_header,omitempty"` + // Browser title shown for the status page. + PageTitle string `json:"page_title,omitempty" toon:"page_title,omitempty"` + Subscription StatusPageSubscriptionItem `json:"subscription,omitempty" toon:"subscription,omitempty"` + // Visibility type of the status page. + Type string `json:"type,omitempty" toon:"type,omitempty"` + // URL-safe slug, unique per account and page type. + URLName string `json:"url_name,omitempty" toon:"url_name,omitempty"` +} + +// CreateStatusPageResponse is generated from the Flashduty OpenAPI schema. +type CreateStatusPageResponse struct { + // Created status page ID. + PageID int64 `json:"page_id" toon:"page_id"` + // Created status page name. + PageName string `json:"page_name" toon:"page_name"` + // Final URL-safe slug assigned to the status page. + PageURLName string `json:"page_url_name" toon:"page_url_name"` +} + // CreateWarRoomRequest is generated from the Flashduty OpenAPI schema. type CreateWarRoomRequest struct { // When true, also add historical responders of the incident as observers. @@ -2486,7 +2453,7 @@ type EscalateLayer struct { type EscalateRuleItem struct { // Owning account ID. AccountID int64 `json:"account_id" toon:"account_id"` - // Aggregation window in seconds. + // Delay window in seconds. AggrWindow int64 `json:"aggr_window" toon:"aggr_window"` // Channel the rule belongs to. ChannelID int64 `json:"channel_id" toon:"channel_id"` @@ -3235,46 +3202,6 @@ type IncidentShort struct { Title string `json:"title" toon:"title"` } -// IncidentTriggerSubscription is generated from the Flashduty OpenAPI schema. -type IncidentTriggerSubscription struct { - // Account ID. - AccountID int64 `json:"account_id" toon:"account_id"` - // Subscribed channel IDs. - ChannelIDs []int64 `json:"channel_ids" toon:"channel_ids"` - // Consumer system. - Consumer string `json:"consumer" toon:"consumer"` - // Consumer-owned reference. - ConsumerRef string `json:"consumer_ref" toon:"consumer_ref"` - // Unix timestamp in seconds when the subscription was created. - CreatedAt Timestamp `json:"created_at" toon:"created_at"` - // Member ID that created the subscription. - CreatedBy int64 `json:"created_by" toon:"created_by"` - // Unix timestamp in seconds when the subscription was deleted; 0 means active. - DeletedAt Timestamp `json:"deleted_at" toon:"deleted_at"` - // Whether the subscription is enabled. - Enabled bool `json:"enabled" toon:"enabled"` - // Subscribed incident severities. - Severities []string `json:"severities" toon:"severities"` - // Subscription source. - Source string `json:"source" toon:"source"` - // Subscription ID. - SubscriptionID string `json:"subscription_id" toon:"subscription_id"` - // Unix timestamp in seconds when the subscription was last updated. - UpdatedAt Timestamp `json:"updated_at" toon:"updated_at"` - // Member ID that last updated the subscription. - UpdatedBy int64 `json:"updated_by" toon:"updated_by"` -} - -// IncidentTriggerSubscriptionDeleteRequest is generated from the Flashduty OpenAPI schema. -type IncidentTriggerSubscriptionDeleteRequest struct { - // Consumer system. - Consumer string `json:"consumer,omitempty" toon:"consumer,omitempty"` - // Consumer-owned reference, such as an Automation rule ID. - ConsumerRef string `json:"consumer_ref,omitempty" toon:"consumer_ref,omitempty"` - // Subscription source. - Source string `json:"source,omitempty" toon:"source,omitempty"` -} - // InhibitRuleItem is generated from the Flashduty OpenAPI schema. type InhibitRuleItem struct { AccountID int64 `json:"account_id" toon:"account_id"` @@ -6703,9 +6630,9 @@ type StatusPageSubscriberListResponse struct { // StatusPageSubscriptionItem is generated from the Flashduty OpenAPI schema. type StatusPageSubscriptionItem struct { // Whether email subscription is enabled. - Email bool `json:"email" toon:"email"` + Email bool `json:"email,omitempty" toon:"email,omitempty"` // Whether IM subscription is enabled. - Im bool `json:"im" toon:"im"` + Im bool `json:"im,omitempty" toon:"im,omitempty"` } // StoreRulesetItem is generated from the Flashduty OpenAPI schema. @@ -7217,7 +7144,7 @@ type UpdateDropRuleRequest struct { // UpdateEscalationRuleRequest is generated from the Flashduty OpenAPI schema. type UpdateEscalationRuleRequest struct { - // Aggregation window in seconds. 0 disables aggregation. + // Delay window in seconds. 0 disables delay. AggrWindow int64 `json:"aggr_window,omitempty" toon:"aggr_window,omitempty"` // Channel the rule belongs to. ChannelID int64 `json:"channel_id,omitempty" toon:"channel_id,omitempty"` @@ -7599,16 +7526,6 @@ type WebhookHistoryItem struct { WebhookType string `json:"webhook_type" toon:"webhook_type"` } -// ChannelsChannelEscalateWebhookRobotListResponseListItem is generated from the Flashduty OpenAPI schema. -type ChannelsChannelEscalateWebhookRobotListResponseListItem struct { - // List of channels and escalation rules referencing this robot. - ReferencedBy []ChannelsChannelEscalateWebhookRobotListResponseListItemReferencedByItem `json:"referenced_by" toon:"referenced_by"` - // Robot configuration, including `token` (webhook URL or secret) and `alias` (robot display name) among other fields. - Settings map[string]any `json:"settings" toon:"settings"` - // Robot type, e.g. `feishu`, `dingtalk`, `wecom`, `slack`, `teams`, etc. - Type string `json:"type" toon:"type"` -} - // AccountInfoRestrictions is generated from the Flashduty OpenAPI schema. type AccountInfoRestrictions struct { // Whether subdomains of the allowed email domains are also accepted. @@ -7657,7 +7574,7 @@ type AuditLogParamsItem struct { // CreateChannelRequestEscalateRule is generated from the Flashduty OpenAPI schema. type CreateChannelRequestEscalateRule struct { - // Aggregation window in seconds. 0 disables aggregation. + // Delay window in seconds. 0 disables delay. AggrWindow int64 `json:"aggr_window,omitempty" toon:"aggr_window,omitempty"` // Notification target. At least one of `person_ids`, `team_ids`, `schedule_to_role_ids`, or `emails` must be set, together with either `by` or `webhooks`. Target CreateChannelRequestEscalateRuleTarget `json:"target,omitempty" toon:"target,omitempty"` @@ -8180,18 +8097,6 @@ type UpsertStatusPageTemplateRequestTemplate struct { Title string `json:"title,omitempty" toon:"title,omitempty"` } -// ChannelsChannelEscalateWebhookRobotListResponseListItemReferencedByItem is generated from the Flashduty OpenAPI schema. -type ChannelsChannelEscalateWebhookRobotListResponseListItemReferencedByItem struct { - // Channel ID. - ChannelID int64 `json:"channel_id" toon:"channel_id"` - // Channel name. - ChannelName string `json:"channel_name" toon:"channel_name"` - // Escalation rule ID (MongoDB ObjectID). - EscalateRuleID string `json:"escalate_rule_id" toon:"escalate_rule_id"` - // Escalation rule name. - EscalateRuleName string `json:"escalate_rule_name" toon:"escalate_rule_name"` -} - // CreateChannelRequestEscalateRuleTarget is generated from the Flashduty OpenAPI schema. type CreateChannelRequestEscalateRuleTarget struct { // Per-severity personal notification channels. Required unless `webhooks` is provided. diff --git a/openapi/openapi.en.json b/openapi/openapi.en.json index ab64e63..07e54aa 100644 --- a/openapi/openapi.en.json +++ b/openapi/openapi.en.json @@ -4835,172 +4835,6 @@ } } }, - "/channel/escalate/webhook/robot/list": { - "post": { - "operationId": "channelEscalateWebhookRobotList", - "summary": "List webhook robots in escalation rules", - "description": "List all IM webhook robots configured in escalation rules across the account. Returns a deduplicated list of robots with references to which channels and escalation rules use them.", - "tags": [ - "On-call/Channels" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | **Channels Read** (`on-call`) |\n\n## Usage Notes\n\nThis endpoint lists all IM webhook robots configured in escalation rules under the current account. The system iterates through all escalation rule layers, extracts webhook configurations (excluding app-type webhooks with `_app` suffix), deduplicates them by `type + token`, and returns the result.\n\nEach robot includes a `referenced_by` list indicating which channels and escalation rules reference it, making it easy to manage robots centrally and assess the impact scope of changes.\n\nUse `type` to filter by robot type (e.g. `feishu`, `dingtalk`, `wecom`, `slack`, `teams`), or `query` to fuzzy-search by alias or token.", - "href": "/en/api-reference/on-call/channels/channel-escalate-webhook-robot-list", - "metadata": { - "sidebarTitle": "List webhook robots" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "list": { - "type": "array", - "description": "Deduplicated list of webhook robots.", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Robot type, e.g. `feishu`, `dingtalk`, `wecom`, `slack`, `teams`, etc." - }, - "settings": { - "type": "object", - "description": "Robot configuration, including `token` (webhook URL or secret) and `alias` (robot display name) among other fields.", - "additionalProperties": true - }, - "referenced_by": { - "type": "array", - "description": "List of channels and escalation rules referencing this robot.", - "items": { - "type": "object", - "properties": { - "channel_id": { - "type": "integer", - "format": "int64", - "description": "Channel ID." - }, - "channel_name": { - "type": "string", - "description": "Channel name." - }, - "escalate_rule_id": { - "type": "string", - "description": "Escalation rule ID (MongoDB ObjectID)." - }, - "escalate_rule_name": { - "type": "string", - "description": "Escalation rule name." - } - } - } - } - } - } - } - } - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "list": [ - { - "type": "feishu", - "settings": { - "token": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx", - "alias": "Ops Alert Group" - }, - "referenced_by": [ - { - "channel_id": 6193426913131, - "channel_name": "Order System", - "escalate_rule_id": "69bd0ce95a238693176c1d66", - "escalate_rule_name": "Default Escalation" - }, - { - "channel_id": 6193426913132, - "channel_name": "Payment System", - "escalate_rule_id": "69bd0ce95a238693176c1d67", - "escalate_rule_name": "Critical Alerts" - } - ] - }, - { - "type": "dingtalk", - "settings": { - "token": "https://oapi.dingtalk.com/robot/send?access_token=xxx", - "alias": "DBA Group" - }, - "referenced_by": [ - { - "channel_id": 6193426913131, - "channel_name": "Order System", - "escalate_rule_id": "69bd0ce95a238693176c1d66", - "escalate_rule_name": "Default Escalation" - } - ] - } - ] - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "query": { - "type": "string", - "description": "Search keyword. Fuzzy matches against robot alias or token, case-insensitive." - }, - "type": { - "type": "string", - "description": "Filter by robot type, e.g. `feishu`, `dingtalk`, `wecom`, `slack`, `teams`. Omit to return all types." - } - } - }, - "example": { - "query": "ops", - "type": "feishu" - } - } - } - } - } - }, "/channel/escalate/rule/list": { "post": { "operationId": "channelEscalateRuleList", @@ -20696,177 +20530,6 @@ } } }, - "/incident-trigger-subscription/upsert": { - "post": { - "operationId": "incident-trigger-subscription-write-upsert", - "summary": "Create or update incident trigger subscription", - "description": "Create or update an incident trigger subscription for AI SRE automation.", - "tags": [ - "On-call/Incidents" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | None — any valid `app_key` can call this operation |\n\n## Usage\n\n- Use this when an AI SRE automation rule needs to receive new-incident trigger events from selected On-call channels.\n- `source`, `consumer`, and `consumer_ref` identify the subscription. Omitting `subscription_id` upserts the row for that tuple.\n- Only `Critical`, `Warning`, and `Info` severities are valid; `enabled` defaults to true.\n- Every call is recorded in the account audit log. Don't put secrets in request fields.", - "href": "/en/api-reference/on-call/incidents/incident-trigger-subscription-write-upsert", - "metadata": { - "sidebarTitle": "Create or update incident trigger subscription" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/IncidentTriggerSubscription" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "subscription_id": "b8d820f2-3f41-4bce-9acc-3940f7bf2df0", - "account_id": 10023, - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "channel_ids": [ - 2468013579 - ], - "severities": [ - "Critical", - "Warning" - ], - "enabled": true, - "created_by": 80011, - "updated_by": 80011, - "created_at": 1780367971, - "updated_at": 1780367971, - "deleted_at": 0 - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IncidentTriggerSubscriptionUpsertRequest" - }, - "example": { - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "channel_ids": [ - 2468013579 - ], - "severities": [ - "Critical", - "Warning" - ], - "enabled": true - } - } - } - } - } - }, - "/incident-trigger-subscription/delete": { - "post": { - "operationId": "incident-trigger-subscription-write-delete", - "summary": "Delete incident trigger subscription", - "description": "Delete an incident trigger subscription for AI SRE automation.", - "tags": [ - "On-call/Incidents" - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | None — any valid `app_key` can call this operation |\n\n## Usage\n\n- Deletes the subscription identified by `source`, `consumer`, and `consumer_ref`; it does not delete the consumer rule itself.\n- Every call is recorded in the account audit log. Don't put secrets in request fields.", - "href": "/en/api-reference/on-call/incidents/incident-trigger-subscription-write-delete", - "metadata": { - "sidebarTitle": "Delete incident trigger subscription" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EmptyResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": {} - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IncidentTriggerSubscriptionDeleteRequest" - }, - "example": { - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b" - } - } - } - } - } - }, "/template/preview": { "post": { "operationId": "template-read-preview", @@ -21232,7 +20895,8 @@ "metadata": { "sidebarTitle": "Get account detail" }, - "content": "| Permission | Description |\n| --- | --- |\n| None | None — any valid app_key can call this operation. |\n\nFind this operation in the [Platform API reference](/en/api-reference/platform/account/account-read-info)." + "content": "| Permission | Description |\n| --- | --- |\n| None | None — any valid app_key can call this operation. |\n\nFind this operation in the [Platform API reference](/en/api-reference/platform/account/account-read-info).", + "href": "/en/api-reference/platform/account/account-read-info" } } }, @@ -24541,7 +24205,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EmptyResponse" + "$ref": "#/components/schemas/CreateStatusPageResponse" } } } @@ -24576,7 +24240,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EmptyRequest" + "$ref": "#/components/schemas/CreateStatusPageRequest" }, "example": { "name": "My Status Page", @@ -25289,7 +24953,7 @@ "post": { "operationId": "automation-rule-write-create", "summary": "Create Automation rule", - "description": "Create an Automation rule with a schedule trigger and, optionally, an HTTP POST trigger.", + "description": "Create an Automation rule with schedule, HTTP POST, and On-call incident triggers.", "tags": [ "AI SRE/Automations" ], @@ -25299,7 +24963,7 @@ } ], "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; management operations require the caller to manage the target rule |\n\n## Usage\n\n- A caller may create personal rules and rules for any team in the current account; `team_id` is immutable after creation.\n- List visibility follows session-list visibility: owners/admins see all rules; ordinary members see rules they created and rules for their teams.\n- `http_post_token` is returned only when creating or rotating the token. Save it immediately.\n", + "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; management operations require the caller to manage the target rule |\n\n## Usage\n\n- A caller may create personal rules and rules for any team in the current account; `team_id` is immutable after creation.\n- List visibility follows session-list visibility: owners/admins see all rules; ordinary members see rules they created and rules for their teams.\n- `http_post_token` is returned only when creating or rotating the token. Save it immediately.\n- To trigger from On-call incidents, send `oncall_incident_trigger_enabled`, `oncall_incident_channel_ids`, and `oncall_incident_severities`; matching events run with `trigger_kind=oncall_incident`.\n", "href": "/en/api-reference/ai-sre/automations/automation-rule-write-create", "metadata": { "sidebarTitle": "Create Automation rule" @@ -25349,10 +25013,10 @@ "updated_at": 1780367971228, "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U", "schedule_next_fire_at_ms": 1780630800000, - "oncall_incident_trigger_id": "autotrg_9cFr2kLm8qNv5pXs4dWy7a", + "oncall_incident_trigger_id": "autotrg_9cVb2mN7qKs4dEa8T1rY5p", "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25396,7 +25060,7 @@ "http_post_trigger_enabled": true, "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25634,7 +25298,7 @@ "post": { "operationId": "automation-rule-write-update", "summary": "Update Automation rule", - "description": "Update mutable fields on an Automation rule. The personal/team scope is immutable.", + "description": "Update mutable Automation rule fields, including HTTP POST and On-call incident trigger settings.", "tags": [ "AI SRE/Automations" ], @@ -25644,7 +25308,7 @@ } ], "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; management operations require the caller to manage the target rule |\n\n## Usage\n\n- A caller may create personal rules and rules for any team in the current account; `team_id` is immutable after creation.\n- List visibility follows session-list visibility: owners/admins see all rules; ordinary members see rules they created and rules for their teams.\n- `http_post_token` is returned only when creating or rotating the token. Save it immediately.\n", + "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; management operations require the caller to manage the target rule |\n\n## Usage\n\n- A caller may create personal rules and rules for any team in the current account; `team_id` is immutable after creation.\n- List visibility follows session-list visibility: owners/admins see all rules; ordinary members see rules they created and rules for their teams.\n- `http_post_token` is returned only when creating or rotating the token. Save it immediately.\n- To trigger from On-call incidents, send `oncall_incident_trigger_enabled`, `oncall_incident_channel_ids`, and `oncall_incident_severities`; matching events run with `trigger_kind=oncall_incident`.\n", "href": "/en/api-reference/ai-sre/automations/automation-rule-write-update", "metadata": { "sidebarTitle": "Update Automation rule" @@ -25694,10 +25358,10 @@ "updated_at": 1780367971228, "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U", "schedule_next_fire_at_ms": 1780630800000, - "oncall_incident_trigger_id": "autotrg_9cFr2kLm8qNv5pXs4dWy7a", + "oncall_incident_trigger_id": "autotrg_9cVb2mN7qKs4dEa8T1rY5p", "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25738,7 +25402,11 @@ "rotate_http_post_trigger_token": true, "oncall_incident_trigger_enabled": true, "oncall_incident_severities": [ - "Critical" + "Critical", + "Warning" + ], + "oncall_incident_channel_ids": [ + 456 ] } } @@ -25825,11 +25493,11 @@ } } }, - "/safari/automation/rule/run": { + "/safari/automation/template/list": { "post": { - "operationId": "automation-rule-write-run", - "summary": "Run Automation rule now", - "description": "Start a manual run for an Automation rule.", + "operationId": "automation-template-read-list", + "summary": "List Automation templates", + "description": "List preset Automation templates for the requested locale.", "tags": [ "AI SRE/Automations" ], @@ -25839,10 +25507,10 @@ } ], "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; management operations require the caller to manage the target rule |\n\n## Usage\n\n- Starts a manual run for a rule the caller can manage, then returns after the hidden AI SRE session starts.\n- Manual runs are rate-limited to one start per rule per minute; rate-limited calls return `429`.\n- The `preflight` object explains the rule scope and runner checks used before the run starts.\n- Every call is recorded in the account audit log. Don't put secrets in request fields.", - "href": "/en/api-reference/ai-sre/automations/automation-rule-write-run", + "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; results are filtered to the caller's visible scope |\n", + "href": "/en/api-reference/ai-sre/automations/automation-template-read-list", "metadata": { - "sidebarTitle": "Run Automation rule now" + "sidebarTitle": "List Automation templates" } }, "responses": { @@ -25859,7 +25527,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/AutomationRuleRunResponse" + "$ref": "#/components/schemas/AutomationTemplateListResponse" } } } @@ -25868,113 +25536,15 @@ "example": { "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", "data": { - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "trigger_kind": "manual", - "preflight": { - "ok": true, - "checks": [ - "rule_enabled", - "runner_available", - "permissions_ok" - ], - "scope": "team", - "owner_id": 80011, - "team_id": 123, - "app_name": "flashcat-ai-sre", - "warnings": [] - }, - "run": { - "run_id": "taskrun_manual_5oDvqiG64uur6sBNsTc4u", - "session_id": "sess_manual_f8oDvqiG64uur6sBNsTc4u" - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AutomationRuleIDRequest" - }, - "example": { - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b" - } - } - } - } - } - }, - "/safari/automation/template/list": { - "post": { - "operationId": "automation-template-read-list", - "summary": "List Automation templates", - "description": "List preset Automation templates for the requested locale.", - "tags": [ - "AI SRE/Automations" - ], - "security": [ - { - "AppKeyAuth": [] - } - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | Valid `app_key`; results are filtered to the caller's visible scope |\n", - "href": "/en/api-reference/ai-sre/automations/automation-template-read-list", - "metadata": { - "sidebarTitle": "List Automation templates" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ResponseEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/AutomationTemplateListResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "templates": [ - { - "name": "Noise reduction", - "description": "Analyze recent alert noise and recommend cleanup actions.", - "icon": "bell-off", - "enabled": true, - "prompt": "Inspect alert noise, escalation load, and on-call handling in the last 24 hours." - } - ] + "templates": [ + { + "name": "Noise reduction", + "description": "Analyze recent alert noise and recommend cleanup actions.", + "icon": "bell-off", + "enabled": true, + "prompt": "Inspect alert noise, escalation load, and on-call handling in the last 24 hours." + } + ] } } } @@ -26115,98 +25685,6 @@ } } } - }, - "/safari/automation/triggers/{trigger_id}/fire": { - "post": { - "operationId": "automation-trigger-write-fire", - "summary": "Fire Automation HTTP POST trigger", - "description": "Trigger an Automation run through its HTTP POST trigger URL.", - "tags": [ - "AI SRE/Automations" - ], - "security": [ - { - "AutomationTriggerBearerAuth": [] - } - ], - "x-mint": { - "content": "## Restrictions\n\n| Aspect | Value |\n| ------ | ----- |\n| Rate limits | **1,000 requests/minute**; **50 requests/second** per account |\n| Permissions | HTTP POST trigger Bearer token |\n\n## Usage\n\n- This endpoint does not use `app_key`. Put the token returned on Automation creation or token rotation in `Authorization: Bearer `.\n- Request body max size is 256 KiB and may be empty; `text` is passed to the agent as this run's context, and `dedup_key` provides idempotency.\n- A successful call returns `202 Accepted` with a run ID; the hidden session continues in the background.\n", - "href": "/en/api-reference/ai-sre/automations/automation-trigger-write-fire", - "metadata": { - "sidebarTitle": "Fire Automation HTTP POST trigger" - } - }, - "responses": { - "202": { - "description": "Accepted", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ResponseEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/AutomationFireAPITriggerResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "run_id": "taskrun_5oDvqiG64uur6sBNsTc4u", - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "trigger_kind": "http_post", - "status": "running" - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "parameters": [ - { - "name": "trigger_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "HTTP POST trigger ID." - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AutomationFireAPITriggerRequest" - }, - "example": { - "text": "A deployment finished for checkout-api. Check whether related alerts increased.", - "dedup_key": "deploy-2026-06-29-001" - } - } - } - } - } } }, "components": { @@ -29531,7 +29009,7 @@ "type": "integer", "minimum": 0, "maximum": 3600, - "description": "Aggregation window in seconds. 0 disables aggregation." + "description": "Delay window in seconds. 0 disables delay." }, "template_id": { "type": "string", @@ -29814,7 +29292,7 @@ "type": "integer", "minimum": 0, "maximum": 3600, - "description": "Aggregation window in seconds. 0 disables aggregation." + "description": "Delay window in seconds. 0 disables delay." }, "template_id": { "type": "string", @@ -30846,7 +30324,7 @@ }, "aggr_window": { "type": "integer", - "description": "Aggregation window in seconds." + "description": "Delay window in seconds." }, "rule_name": { "type": "string", @@ -31598,7 +31076,7 @@ }, "aggr_window": { "type": "integer", - "description": "Aggregation window in seconds. 0 disables aggregation." + "description": "Delay window in seconds. 0 disables delay." }, "template_id": { "type": "string", @@ -45951,15 +45429,16 @@ }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "Whether to create and enable an on-call incident trigger for this rule." + "description": "Whether the On-call incident trigger is enabled." }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "On-call channel IDs whose new incidents can trigger this rule." + "description": "On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID." }, "oncall_incident_severities": { "type": "array", @@ -45971,7 +45450,7 @@ "Info" ] }, - "description": "Incident severities that can trigger this rule." + "description": "Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value." } }, "required": [ @@ -46033,21 +45512,18 @@ "type": "boolean", "description": "Whether the HTTP POST trigger is enabled. Sending true creates one when missing." }, - "rotate_http_post_trigger_token": { - "type": "boolean", - "description": "Whether to rotate the HTTP POST trigger token. The new token is returned only in this response." - }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "Whether the on-call incident trigger is enabled. Sending true creates it when missing and channel/severity filters are provided." + "description": "Whether the On-call incident trigger is enabled." }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "On-call channel IDs whose new incidents can trigger this rule." + "description": "On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID." }, "oncall_incident_severities": { "type": "array", @@ -46059,7 +45535,11 @@ "Info" ] }, - "description": "Incident severities that can trigger this rule." + "description": "Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value." + }, + "rotate_http_post_trigger_token": { + "type": "boolean", + "description": "Whether to rotate the HTTP POST trigger token. The new token is returned only in this response." } }, "required": [ @@ -46231,44 +45711,22 @@ "type": "boolean", "description": "Whether the HTTP POST trigger is enabled." }, - "http_post_token": { - "type": "string", - "description": "HTTP POST trigger token. Returned only on create or token rotation; save it immediately." - }, - "can_edit": { - "type": "boolean", - "description": "Whether the caller can manage this rule." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "Creation time, Unix milliseconds." - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "Last update time, Unix milliseconds." - }, - "schedule_next_fire_at_ms": { - "type": "integer", - "format": "int64", - "description": "Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available." - }, "oncall_incident_trigger_id": { "type": "string", "description": "On-call incident trigger ID." }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "Whether the on-call incident trigger is enabled." + "description": "Whether the On-call incident trigger is enabled." }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "On-call channel IDs watched by the incident trigger." + "description": "On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID." }, "oncall_incident_severities": { "type": "array", @@ -46280,7 +45738,30 @@ "Info" ] }, - "description": "Incident severities watched by the trigger." + "description": "Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value." + }, + "http_post_token": { + "type": "string", + "description": "HTTP POST trigger token. Returned only on create or token rotation; save it immediately." + }, + "can_edit": { + "type": "boolean", + "description": "Whether the caller can manage this rule." + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "Creation time, Unix milliseconds." + }, + "updated_at": { + "type": "integer", + "format": "int64", + "description": "Last update time, Unix milliseconds." + }, + "schedule_next_fire_at_ms": { + "type": "integer", + "format": "int64", + "description": "Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available." } }, "required": [ @@ -46547,50 +46028,6 @@ "updated_at" ] }, - "AutomationFireAPITriggerRequest": { - "type": "object", - "description": "HTTP POST trigger body. The body may be empty; when present, fields must be strings.", - "properties": { - "text": { - "type": "string", - "description": "Context text passed to this Automation run." - }, - "dedup_key": { - "type": "string", - "description": "Optional idempotency key; the same trigger + dedup_key reuses the same run." - } - } - }, - "AutomationFireAPITriggerResponse": { - "type": "object", - "properties": { - "run_id": { - "type": "string", - "description": "Created or reused run ID." - }, - "rule_id": { - "type": "string", - "description": "Rule ID." - }, - "trigger_kind": { - "type": "string", - "enum": [ - "http_post" - ], - "description": "Trigger kind." - }, - "status": { - "type": "string", - "description": "Current run status." - } - }, - "required": [ - "run_id", - "rule_id", - "trigger_kind", - "status" - ] - }, "FacetCountItem": { "type": "object", "description": "A facet value and its occurrence count.", @@ -47314,269 +46751,108 @@ } } }, - "AutomationRuleRunPreflight": { + "CreateStatusPageRequest": { "type": "object", "properties": { - "ok": { - "type": "boolean", - "description": "Whether the rule can start a run." - }, - "checks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Preflight checks that were evaluated." - }, - "scope": { + "name": { "type": "string", - "enum": [ - "person", - "team" - ], - "description": "Hidden session scope used for the run." - }, - "owner_id": { - "type": "integer", - "format": "int64", - "description": "Owner person ID used for the run context." - }, - "team_id": { - "type": "integer", - "format": "int64", - "description": "Team ID used for team-scoped runs; 0 for personal runs." + "description": "Display name of the status page.", + "maxLength": 255 }, - "app_name": { + "url_name": { "type": "string", - "description": "AI SRE app used to execute the rule." + "description": "URL-safe slug, unique per account and page type.", + "maxLength": 255 }, - "warnings": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Non-blocking preflight warnings." - } - }, - "required": [ - "ok", - "checks", - "scope", - "owner_id", - "team_id", - "app_name" - ] - }, - "AutomationRuleRunView": { - "type": "object", - "properties": { - "run_id": { + "type": { "type": "string", - "description": "Created automation run ID." + "description": "Visibility type of the status page.", + "enum": [ + "public", + "internal" + ] }, - "session_id": { - "type": "string", - "description": "Hidden AI SRE session ID started for this run." - } - }, - "required": [ - "run_id" - ] - }, - "AutomationRuleRunResponse": { - "type": "object", - "properties": { - "rule_id": { + "custom_domain": { "type": "string", - "description": "Rule ID." + "description": "Custom domain for a public status page.", + "maxLength": 255 }, - "trigger_kind": { + "page_title": { "type": "string", - "enum": [ - "manual" - ], - "description": "Trigger kind for this run." + "description": "Browser title shown for the status page." }, - "preflight": { - "$ref": "#/components/schemas/AutomationRuleRunPreflight" - }, - "run": { - "$ref": "#/components/schemas/AutomationRuleRunView" - } - }, - "required": [ - "rule_id", - "trigger_kind", - "preflight" - ] - }, - "IncidentTriggerSubscriptionUpsertRequest": { - "type": "object", - "description": "Create or update an incident trigger subscription.", - "properties": { - "subscription_id": { + "page_header": { "type": "string", - "description": "Existing subscription ID. Omit to create or upsert by source, consumer, and consumer_ref." + "description": "Header content shown on the status page." }, - "source": { + "page_footer": { "type": "string", - "description": "Subscription source. Use `ai_sre_automation` for AI SRE automation rules." + "description": "Footer content shown on the status page." }, - "consumer": { + "date_view": { "type": "string", - "description": "Consumer system. Use `fc_safari` for AI SRE automation rules." + "description": "How event dates are displayed.", + "enum": [ + "calendar", + "list" + ] }, - "consumer_ref": { + "display_uptime_mode": { "type": "string", - "description": "Consumer-owned reference, such as an Automation rule ID." - }, - "channel_ids": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer", - "format": "int64" - }, - "description": "On-call channel IDs whose new incidents should trigger the consumer." + "description": "How uptime is displayed.", + "enum": [ + "chart_and_percentage", + "chart", + "none" + ] }, - "severities": { + "custom_links": { "type": "array", - "minItems": 1, + "description": "Custom navigation links shown on the status page.", "items": { - "type": "string", - "enum": [ - "Critical", - "Warning", - "Info" - ] - }, - "description": "Incident severities to subscribe to. `Ok` is not valid." - }, - "enabled": { - "type": "boolean", - "description": "Whether the subscription is enabled. Defaults to true when omitted." - } - }, - "required": [ - "source", - "consumer", - "consumer_ref", - "channel_ids", - "severities" - ] - }, - "IncidentTriggerSubscriptionDeleteRequest": { - "type": "object", - "description": "Delete an incident trigger subscription by consumer reference.", - "properties": { - "source": { - "type": "string", - "description": "Subscription source." + "type": "object", + "additionalProperties": { + "type": "string" + } + } }, - "consumer": { + "contact_info": { "type": "string", - "description": "Consumer system." + "description": "Get-in-touch contact, such as a mailto or website URL." }, - "consumer_ref": { - "type": "string", - "description": "Consumer-owned reference, such as an Automation rule ID." + "subscription": { + "$ref": "#/components/schemas/StatusPageSubscriptionItem" } }, "required": [ - "source", - "consumer", - "consumer_ref" + "name", + "url_name", + "type", + "date_view", + "display_uptime_mode" ] }, - "IncidentTriggerSubscription": { + "CreateStatusPageResponse": { "type": "object", - "description": "Incident trigger subscription stored by On-call.", "properties": { - "subscription_id": { - "type": "string", - "description": "Subscription ID." - }, - "account_id": { + "page_id": { "type": "integer", "format": "int64", - "description": "Account ID." + "description": "Created status page ID." }, - "source": { + "page_name": { "type": "string", - "description": "Subscription source." + "description": "Created status page name." }, - "consumer": { + "page_url_name": { "type": "string", - "description": "Consumer system." - }, - "consumer_ref": { - "type": "string", - "description": "Consumer-owned reference." - }, - "channel_ids": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - }, - "description": "Subscribed channel IDs." - }, - "severities": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "Critical", - "Warning", - "Info" - ] - }, - "description": "Subscribed incident severities." - }, - "enabled": { - "type": "boolean", - "description": "Whether the subscription is enabled." - }, - "created_by": { - "type": "integer", - "format": "int64", - "description": "Member ID that created the subscription." - }, - "updated_by": { - "type": "integer", - "format": "int64", - "description": "Member ID that last updated the subscription." - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "Unix timestamp in seconds when the subscription was created." - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "Unix timestamp in seconds when the subscription was last updated." - }, - "deleted_at": { - "type": "integer", - "format": "int64", - "description": "Unix timestamp in seconds when the subscription was deleted; 0 means active." + "description": "Final URL-safe slug assigned to the status page." } }, "required": [ - "subscription_id", - "account_id", - "source", - "consumer", - "consumer_ref", - "channel_ids", - "severities", - "enabled", - "created_by", - "updated_by", - "created_at", - "updated_at", - "deleted_at" + "page_id", + "page_name", + "page_url_name" ] } } diff --git a/openapi/openapi.zh.json b/openapi/openapi.zh.json index 16418a5..e4e26af 100644 --- a/openapi/openapi.zh.json +++ b/openapi/openapi.zh.json @@ -122,7 +122,7 @@ "description": "监控服务开通及数据预览工具。" }, { - "name": "AI SRE/Automations" + "name": "AI SRE/自动化" }, { "name": "RUM/应用管理", @@ -4835,172 +4835,6 @@ } } }, - "/channel/escalate/webhook/robot/list": { - "post": { - "operationId": "channelEscalateWebhookRobotList", - "summary": "查询分派策略中的群聊机器人列表", - "description": "查询当前账户下所有分派策略中配置的群聊机器人(Webhook),返回去重后的机器人列表及其被哪些协作空间/分派策略引用。", - "tags": [ - "On-call/协作空间" - ], - "x-mint": { - "content": "## 限制说明\n\n| 项目 | 说明 |\n| ---- | ---- |\n| 速率限制 | 每个账户 **1,000 次/分钟**;**50 次/秒** |\n| 权限要求 | **协作空间查看**(`on-call`) |\n\n## 使用说明\n\n该接口用于查询当前账户下所有分派策略中配置的 IM 群聊机器人。系统会遍历所有分派策略的所有环节,提取其中配置的 Webhook 机器人(排除应用类型 `_app` 后缀的),按 `type + token` 去重后返回。\n\n每个机器人附带 `referenced_by` 列表,标明该机器人被哪些协作空间和分派策略引用,便于进行机器人的统一管理和影响范围评估。\n\n支持通过 `type` 筛选特定类型的机器人(如 `feishu`、`dingtalk`、`wecom`、`slack`、`teams` 等),也支持通过 `query` 对机器人的别名或 token 进行模糊搜索。", - "href": "/zh/api-reference/on-call/channels/channel-escalate-webhook-robot-list", - "metadata": { - "sidebarTitle": "查询群聊机器人列表" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "list": { - "type": "array", - "description": "去重后的群聊机器人列表。", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "机器人类型,如 `feishu`、`dingtalk`、`wecom`、`slack`、`teams` 等。" - }, - "settings": { - "type": "object", - "description": "机器人配置,包含 `token`(Webhook 地址或密钥)和 `alias`(机器人别名)等字段。", - "additionalProperties": true - }, - "referenced_by": { - "type": "array", - "description": "引用该机器人的协作空间和分派策略列表。", - "items": { - "type": "object", - "properties": { - "channel_id": { - "type": "integer", - "format": "int64", - "description": "协作空间 ID。" - }, - "channel_name": { - "type": "string", - "description": "协作空间名称。" - }, - "escalate_rule_id": { - "type": "string", - "description": "分派策略 ID(MongoDB ObjectID)。" - }, - "escalate_rule_name": { - "type": "string", - "description": "分派策略名称。" - } - } - } - } - } - } - } - } - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "list": [ - { - "type": "feishu", - "settings": { - "token": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx", - "alias": "运维告警群" - }, - "referenced_by": [ - { - "channel_id": 6193426913131, - "channel_name": "订单系统", - "escalate_rule_id": "69bd0ce95a238693176c1d66", - "escalate_rule_name": "默认分派策略" - }, - { - "channel_id": 6193426913132, - "channel_name": "支付系统", - "escalate_rule_id": "69bd0ce95a238693176c1d67", - "escalate_rule_name": "核心告警" - } - ] - }, - { - "type": "dingtalk", - "settings": { - "token": "https://oapi.dingtalk.com/robot/send?access_token=xxx", - "alias": "DBA 群" - }, - "referenced_by": [ - { - "channel_id": 6193426913131, - "channel_name": "订单系统", - "escalate_rule_id": "69bd0ce95a238693176c1d66", - "escalate_rule_name": "默认分派策略" - } - ] - } - ] - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "query": { - "type": "string", - "description": "搜索关键词,按机器人别名(alias)或 token 模糊匹配,不区分大小写。" - }, - "type": { - "type": "string", - "description": "按机器人类型过滤,如 `feishu`、`dingtalk`、`wecom`、`slack`、`teams` 等。不传则返回所有类型。" - } - } - }, - "example": { - "query": "运维", - "type": "feishu" - } - } - } - } - } - }, "/channel/escalate/rule/list": { "post": { "operationId": "channelEscalateRuleList", @@ -20688,177 +20522,6 @@ } } }, - "/incident-trigger-subscription/upsert": { - "post": { - "operationId": "incident-trigger-subscription-write-upsert", - "summary": "创建或更新故障触发订阅", - "description": "为 AI SRE 自动化创建或更新故障触发订阅。", - "tags": [ - "On-call/故障管理" - ], - "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 当 AI SRE 自动化规则需要接收指定 On-call 协作空间的新故障触发事件时调用。\n- `source`、`consumer`、`consumer_ref` 共同标识订阅;省略 `subscription_id` 时会按这一组标识创建或更新。\n- 仅支持 `Critical`、`Warning`、`Info` 三种故障等级;`enabled` 省略时默认为 true。\n- 每次调用都会记录到账户审计日志,请不要把敏感信息放在请求字段中。", - "href": "/zh/api-reference/on-call/incidents/incident-trigger-subscription-write-upsert", - "metadata": { - "sidebarTitle": "创建或更新故障触发订阅" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/IncidentTriggerSubscription" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "subscription_id": "b8d820f2-3f41-4bce-9acc-3940f7bf2df0", - "account_id": 10023, - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "channel_ids": [ - 2468013579 - ], - "severities": [ - "Critical", - "Warning" - ], - "enabled": true, - "created_by": 80011, - "updated_by": 80011, - "created_at": 1780367971, - "updated_at": 1780367971, - "deleted_at": 0 - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IncidentTriggerSubscriptionUpsertRequest" - }, - "example": { - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "channel_ids": [ - 2468013579 - ], - "severities": [ - "Critical", - "Warning" - ], - "enabled": true - } - } - } - } - } - }, - "/incident-trigger-subscription/delete": { - "post": { - "operationId": "incident-trigger-subscription-write-delete", - "summary": "删除故障触发订阅", - "description": "删除 AI SRE 自动化使用的故障触发订阅。", - "tags": [ - "On-call/故障管理" - ], - "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 无 —— 持有有效的 `app_key` 即可调用 |\n\n## 使用说明\n\n- 删除由 `source`、`consumer`、`consumer_ref` 标识的订阅;不会删除消费方规则本身。\n- 每次调用都会记录到账户审计日志,请不要把敏感信息放在请求字段中。", - "href": "/zh/api-reference/on-call/incidents/incident-trigger-subscription-write-delete", - "metadata": { - "sidebarTitle": "删除故障触发订阅" - } - }, - "responses": { - "200": { - "description": "成功", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/SuccessEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EmptyResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": {} - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IncidentTriggerSubscriptionDeleteRequest" - }, - "example": { - "source": "ai_sre_automation", - "consumer": "fc_safari", - "consumer_ref": "auto_7NnLzY2Qp8xS4kUaV3mR6b" - } - } - } - } - } - }, "/template/preview": { "post": { "operationId": "template-read-preview", @@ -21224,7 +20887,8 @@ "metadata": { "sidebarTitle": "查看主体信息" }, - "content": "| 权限 | 描述 |\n| --- | --- |\n| 无 | 无 — 任意有效的 app_key 均可调用此操作。 |\n\n在 [平台 API 参考](/zh/api-reference/platform/account/account-read-info) 中查看此操作。" + "content": "| 权限 | 描述 |\n| --- | --- |\n| 无 | 无 — 任意有效的 app_key 均可调用此操作。 |\n\n在 [平台 API 参考](/zh/api-reference/platform/account/account-read-info) 中查看此操作。", + "href": "/zh/api-reference/platform/account/account-read-info" } } }, @@ -24533,7 +24197,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EmptyResponse" + "$ref": "#/components/schemas/CreateStatusPageResponse" } } } @@ -24568,7 +24232,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EmptyRequest" + "$ref": "#/components/schemas/CreateStatusPageRequest" }, "example": { "name": "My Status Page", @@ -25281,9 +24945,9 @@ "post": { "operationId": "automation-rule-write-create", "summary": "创建自动化规则", - "description": "创建自动化规则,包含 schedule trigger,并可选启用 HTTP POST trigger。", + "description": "创建自动化规则,支持 schedule、HTTP POST 和 On-call 故障触发器。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25291,7 +24955,7 @@ } ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 可以创建个人规则,也可以创建当前 account 下任意团队规则;`team_id` 创建后不可修改。\n- 列表可见性与 Session 列表对齐:Owner / 管理员可见全部;普通成员可见自己创建的规则和自己团队的规则。\n- `http_post_token` 只在创建或轮换 token 的响应中返回,请立即保存。\n", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 可以创建个人规则,也可以创建当前 account 下任意团队规则;`team_id` 创建后不可修改。\n- 列表可见性与 Session 列表对齐:Owner / 管理员可见全部;普通成员可见自己创建的规则和自己团队的规则。\n- `http_post_token` 只在创建或轮换 token 的响应中返回,请立即保存。\n- 如需由 On-call 故障触发,传入 `oncall_incident_trigger_enabled`、`oncall_incident_channel_ids` 与 `oncall_incident_severities`;匹配事件会以 `oncall_incident` 运行。\n", "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-create", "metadata": { "sidebarTitle": "创建自动化规则" @@ -25341,10 +25005,10 @@ "updated_at": 1780367971228, "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U", "schedule_next_fire_at_ms": 1780630800000, - "oncall_incident_trigger_id": "autotrg_9cFr2kLm8qNv5pXs4dWy7a", + "oncall_incident_trigger_id": "autotrg_9cVb2mN7qKs4dEa8T1rY5p", "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25388,7 +25052,7 @@ "http_post_trigger_enabled": true, "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25406,7 +25070,7 @@ "summary": "列出自动化规则", "description": "列出当前调用者可见的自动化规则。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25520,7 +25184,7 @@ "summary": "查看自动化规则", "description": "按 ID 查看一条自动化规则。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25626,9 +25290,9 @@ "post": { "operationId": "automation-rule-write-update", "summary": "更新自动化规则", - "description": "更新自动化规则的可变字段。personal / team scope 创建后不可修改。", + "description": "更新自动化规则的可变字段,包括 HTTP POST 与 On-call 故障触发器配置。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25636,7 +25300,7 @@ } ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 可以创建个人规则,也可以创建当前 account 下任意团队规则;`team_id` 创建后不可修改。\n- 列表可见性与 Session 列表对齐:Owner / 管理员可见全部;普通成员可见自己创建的规则和自己团队的规则。\n- `http_post_token` 只在创建或轮换 token 的响应中返回,请立即保存。\n", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 可以创建个人规则,也可以创建当前 account 下任意团队规则;`team_id` 创建后不可修改。\n- 列表可见性与 Session 列表对齐:Owner / 管理员可见全部;普通成员可见自己创建的规则和自己团队的规则。\n- `http_post_token` 只在创建或轮换 token 的响应中返回,请立即保存。\n- 如需由 On-call 故障触发,传入 `oncall_incident_trigger_enabled`、`oncall_incident_channel_ids` 与 `oncall_incident_severities`;匹配事件会以 `oncall_incident` 运行。\n", "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-update", "metadata": { "sidebarTitle": "更新自动化规则" @@ -25686,10 +25350,10 @@ "updated_at": 1780367971228, "http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U", "schedule_next_fire_at_ms": 1780630800000, - "oncall_incident_trigger_id": "autotrg_9cFr2kLm8qNv5pXs4dWy7a", + "oncall_incident_trigger_id": "autotrg_9cVb2mN7qKs4dEa8T1rY5p", "oncall_incident_trigger_enabled": true, "oncall_incident_channel_ids": [ - 2468013579 + 456 ], "oncall_incident_severities": [ "Critical", @@ -25730,7 +25394,11 @@ "rotate_http_post_trigger_token": true, "oncall_incident_trigger_enabled": true, "oncall_incident_severities": [ - "Critical" + "Critical", + "Warning" + ], + "oncall_incident_channel_ids": [ + 456 ] } } @@ -25744,7 +25412,7 @@ "summary": "删除自动化规则", "description": "删除一条自动化规则。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25817,13 +25485,13 @@ } } }, - "/safari/automation/rule/run": { + "/safari/automation/template/list": { "post": { - "operationId": "automation-rule-write-run", - "summary": "立即执行自动化规则", - "description": "为自动化规则立即启动一次手动运行。", + "operationId": "automation-template-read-list", + "summary": "列出自动化模板", + "description": "按语言列出自动化预设模板。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -25831,15 +25499,15 @@ } ], "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;管理操作要求调用者可管理目标规则 |\n\n## 使用说明\n\n- 为调用者可管理的规则启动一次手动运行,并在隐藏 AI SRE 会话启动后返回。\n- 同一规则的手动运行限频为每分钟一次;命中限频时返回 `429`。\n- `preflight` 会说明本次运行启动前使用的规则作用域和 Runner 检查结果。\n- 每次调用都会记录到账户审计日志,请不要把敏感信息放在请求字段中。", - "href": "/zh/api-reference/ai-sre/automations/automation-rule-write-run", + "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;结果按调用者可见范围过滤 |\n", + "href": "/zh/api-reference/ai-sre/automations/automation-template-read-list", "metadata": { - "sidebarTitle": "立即执行自动化规则" + "sidebarTitle": "列出自动化模板" } }, "responses": { "200": { - "description": "成功", + "description": "Success", "content": { "application/json": { "schema": { @@ -25851,7 +25519,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/AutomationRuleRunResponse" + "$ref": "#/components/schemas/AutomationTemplateListResponse" } } } @@ -25860,113 +25528,15 @@ "example": { "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", "data": { - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "trigger_kind": "manual", - "preflight": { - "ok": true, - "checks": [ - "rule_enabled", - "runner_available", - "permissions_ok" - ], - "scope": "team", - "owner_id": 80011, - "team_id": 123, - "app_name": "flashcat-ai-sre", - "warnings": [] - }, - "run": { - "run_id": "taskrun_manual_5oDvqiG64uur6sBNsTc4u", - "session_id": "sess_manual_f8oDvqiG64uur6sBNsTc4u" - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AutomationRuleIDRequest" - }, - "example": { - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b" - } - } - } - } - } - }, - "/safari/automation/template/list": { - "post": { - "operationId": "automation-template-read-list", - "summary": "列出自动化模板", - "description": "按语言列出自动化预设模板。", - "tags": [ - "AI SRE/Automations" - ], - "security": [ - { - "AppKeyAuth": [] - } - ], - "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | 有效 `app_key`;结果按调用者可见范围过滤 |\n", - "href": "/zh/api-reference/ai-sre/automations/automation-template-read-list", - "metadata": { - "sidebarTitle": "列出自动化模板" - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ResponseEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/AutomationTemplateListResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "templates": [ - { - "name": "噪音治理", - "description": "分析近期告警噪音并给出治理建议。", - "icon": "bell-off", - "enabled": true, - "prompt": "检查过去 24 小时告警噪音、升级负载和值班处理情况。" - } - ] + "templates": [ + { + "name": "噪音治理", + "description": "分析近期告警噪音并给出治理建议。", + "icon": "bell-off", + "enabled": true, + "prompt": "检查过去 24 小时告警噪音、升级负载和值班处理情况。" + } + ] } } } @@ -26009,7 +25579,7 @@ "summary": "列出自动化运行历史", "description": "列出调用者可管理规则的运行历史。", "tags": [ - "AI SRE/Automations" + "AI SRE/自动化" ], "security": [ { @@ -26107,98 +25677,6 @@ } } } - }, - "/safari/automation/triggers/{trigger_id}/fire": { - "post": { - "operationId": "automation-trigger-write-fire", - "summary": "触发自动化 HTTP POST trigger", - "description": "通过 HTTP POST trigger URL 触发一次自动化运行。", - "tags": [ - "AI SRE/Automations" - ], - "security": [ - { - "AutomationTriggerBearerAuth": [] - } - ], - "x-mint": { - "content": "## 调用限制\n\n| 项 | 值 |\n| ------ | ----- |\n| 速率限制 | **1,000 次/分钟**;**50 次/秒** 每账户 |\n| 权限 | HTTP POST trigger Bearer Token |\n\n## 使用说明\n\n- 此接口不使用 `app_key`。将自动化创建或 token 轮换时返回的 token 放在 `Authorization: Bearer ` 请求头中。\n- 请求体最大 256 KiB,可为空;`text` 会作为本次运行上下文传给 Agent,`dedup_key` 用于幂等。\n- 成功后立即返回 `202 Accepted` 和 run ID,实际会话在后台运行。\n", - "href": "/zh/api-reference/ai-sre/automations/automation-trigger-write-fire", - "metadata": { - "sidebarTitle": "触发自动化 HTTP POST trigger" - } - }, - "responses": { - "202": { - "description": "Accepted", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/ResponseEnvelope" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/AutomationFireAPITriggerResponse" - } - } - } - ] - }, - "example": { - "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4", - "data": { - "run_id": "taskrun_5oDvqiG64uur6sBNsTc4u", - "rule_id": "auto_7NnLzY2Qp8xS4kUaV3mR6b", - "trigger_kind": "http_post", - "status": "running" - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "429": { - "$ref": "#/components/responses/TooManyRequests" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "parameters": [ - { - "name": "trigger_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "HTTP POST trigger ID。" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AutomationFireAPITriggerRequest" - }, - "example": { - "text": "A deployment finished for checkout-api. Check whether related alerts increased.", - "dedup_key": "deploy-2026-06-29-001" - } - } - } - } - } } }, "components": { @@ -29522,7 +29000,7 @@ "type": "integer", "minimum": 0, "maximum": 3600, - "description": "聚合窗口,单位秒,0 表示不聚合。" + "description": "延迟窗口,单位秒,0 表示不延迟。" }, "template_id": { "type": "string", @@ -29805,7 +29283,7 @@ "type": "integer", "minimum": 0, "maximum": 3600, - "description": "聚合窗口,单位秒,0 表示不聚合。" + "description": "延迟窗口,单位秒,0 表示不延迟。" }, "template_id": { "type": "string", @@ -30837,7 +30315,7 @@ }, "aggr_window": { "type": "integer", - "description": "聚合窗口,单位秒。" + "description": "延迟窗口,单位秒。" }, "rule_name": { "type": "string", @@ -31589,7 +31067,7 @@ }, "aggr_window": { "type": "integer", - "description": "聚合窗口,单位秒,0 表示不聚合。" + "description": "延迟窗口,单位秒,0 表示不延迟。" }, "template_id": { "type": "string", @@ -45942,15 +45420,16 @@ }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "是否为此规则创建并启用 On-call 故障触发器。" + "description": "是否启用 On-call 故障触发器。" }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "可触发此规则的 On-call 协作空间 ID。" + "description": "监听的 On-call 集成 ID 列表;创建或启用该触发器时至少需要一个有效 ID。" }, "oncall_incident_severities": { "type": "array", @@ -45962,7 +45441,7 @@ "Info" ] }, - "description": "可触发此规则的故障等级。" + "description": "监听的故障严重程度,支持 Critical、Warning 和 Info;创建或启用该触发器时至少需要一个值。" } }, "required": [ @@ -46024,21 +45503,18 @@ "type": "boolean", "description": "是否启用 HTTP POST trigger。不存在时设为 true 会创建。" }, - "rotate_http_post_trigger_token": { - "type": "boolean", - "description": "是否轮换 HTTP POST trigger token。新 token 只会在本次响应中返回。" - }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "On-call 故障触发器是否启用。不存在时发送 true,并同时提供协作空间和等级过滤条件,会创建触发器。" + "description": "是否启用 On-call 故障触发器。" }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "可触发此规则的 On-call 协作空间 ID。" + "description": "监听的 On-call 集成 ID 列表;创建或启用该触发器时至少需要一个有效 ID。" }, "oncall_incident_severities": { "type": "array", @@ -46050,7 +45526,11 @@ "Info" ] }, - "description": "可触发此规则的故障等级。" + "description": "监听的故障严重程度,支持 Critical、Warning 和 Info;创建或启用该触发器时至少需要一个值。" + }, + "rotate_http_post_trigger_token": { + "type": "boolean", + "description": "是否轮换 HTTP POST trigger token。新 token 只会在本次响应中返回。" } }, "required": [ @@ -46222,44 +45702,22 @@ "type": "boolean", "description": "HTTP POST trigger 是否启用。" }, - "http_post_token": { - "type": "string", - "description": "HTTP POST trigger token。只在创建或轮换 token 的响应中返回;请立即保存。" - }, - "can_edit": { - "type": "boolean", - "description": "当前调用者是否可管理该规则。" - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "创建时间,Unix 毫秒。" - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "更新时间,Unix 毫秒。" - }, - "schedule_next_fire_at_ms": { - "type": "integer", - "format": "int64", - "description": "下一次计划触发时间,Unix 毫秒;0 表示暂无可用的下一次计划触发。" - }, "oncall_incident_trigger_id": { "type": "string", "description": "On-call 故障触发器 ID。" }, "oncall_incident_trigger_enabled": { "type": "boolean", - "description": "On-call 故障触发器是否启用。" + "description": "是否启用 On-call 故障触发器。" }, "oncall_incident_channel_ids": { "type": "array", "items": { "type": "integer", - "format": "int64" + "format": "int64", + "minimum": 1 }, - "description": "故障触发器监听的 On-call 协作空间 ID。" + "description": "监听的 On-call 集成 ID 列表;创建或启用该触发器时至少需要一个有效 ID。" }, "oncall_incident_severities": { "type": "array", @@ -46271,7 +45729,30 @@ "Info" ] }, - "description": "故障触发器监听的故障等级。" + "description": "监听的故障严重程度,支持 Critical、Warning 和 Info;创建或启用该触发器时至少需要一个值。" + }, + "http_post_token": { + "type": "string", + "description": "HTTP POST trigger token。只在创建或轮换 token 的响应中返回;请立即保存。" + }, + "can_edit": { + "type": "boolean", + "description": "当前调用者是否可管理该规则。" + }, + "created_at": { + "type": "integer", + "format": "int64", + "description": "创建时间,Unix 毫秒。" + }, + "updated_at": { + "type": "integer", + "format": "int64", + "description": "更新时间,Unix 毫秒。" + }, + "schedule_next_fire_at_ms": { + "type": "integer", + "format": "int64", + "description": "下一次计划触发时间,Unix 毫秒;0 表示暂无可用的下一次计划触发。" } }, "required": [ @@ -46538,50 +46019,6 @@ "updated_at" ] }, - "AutomationFireAPITriggerRequest": { - "type": "object", - "description": "HTTP POST trigger 请求体。请求体可为空;字段存在时必须是字符串。", - "properties": { - "text": { - "type": "string", - "description": "传给本次自动化运行的上下文文本。" - }, - "dedup_key": { - "type": "string", - "description": "可选幂等键;相同 trigger + dedup_key 会复用同一次运行。" - } - } - }, - "AutomationFireAPITriggerResponse": { - "type": "object", - "properties": { - "run_id": { - "type": "string", - "description": "已创建或复用的运行 ID。" - }, - "rule_id": { - "type": "string", - "description": "规则 ID。" - }, - "trigger_kind": { - "type": "string", - "enum": [ - "http_post" - ], - "description": "触发方式。" - }, - "status": { - "type": "string", - "description": "运行当前状态。" - } - }, - "required": [ - "run_id", - "rule_id", - "trigger_kind", - "status" - ] - }, "FacetCountItem": { "type": "object", "description": "一个分面值及其出现次数。", @@ -47305,269 +46742,108 @@ } } }, - "AutomationRuleRunPreflight": { + "CreateStatusPageRequest": { "type": "object", "properties": { - "ok": { - "type": "boolean", - "description": "规则是否可以启动一次运行。" - }, - "checks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "本次执行前检查的检查项。" - }, - "scope": { + "name": { "type": "string", - "enum": [ - "person", - "team" - ], - "description": "本次运行使用的隐藏会话作用域。" - }, - "owner_id": { - "type": "integer", - "format": "int64", - "description": "本次运行上下文使用的负责人 ID。" - }, - "team_id": { - "type": "integer", - "format": "int64", - "description": "团队作用域运行使用的团队 ID;个人运行时为 0。" + "description": "状态页展示名称。", + "maxLength": 255 }, - "app_name": { + "url_name": { "type": "string", - "description": "执行此规则的 AI SRE App。" + "description": "URL 安全的状态页路径,在账户和状态页类型内唯一。", + "maxLength": 255 }, - "warnings": { - "type": "array", - "items": { - "type": "string" - }, - "description": "不阻塞启动的执行前警告。" - } - }, - "required": [ - "ok", - "checks", - "scope", - "owner_id", - "team_id", - "app_name" - ] - }, - "AutomationRuleRunView": { - "type": "object", - "properties": { - "run_id": { + "type": { "type": "string", - "description": "已创建的自动化运行 ID。" + "description": "状态页可见性类型。", + "enum": [ + "public", + "internal" + ] }, - "session_id": { - "type": "string", - "description": "为本次运行启动的隐藏 AI SRE 会话 ID。" - } - }, - "required": [ - "run_id" - ] - }, - "AutomationRuleRunResponse": { - "type": "object", - "properties": { - "rule_id": { + "custom_domain": { "type": "string", - "description": "规则 ID。" + "description": "公开状态页使用的自定义域名。", + "maxLength": 255 }, - "trigger_kind": { + "page_title": { "type": "string", - "enum": [ - "manual" - ], - "description": "本次运行的触发来源。" + "description": "状态页浏览器标题。" }, - "preflight": { - "$ref": "#/components/schemas/AutomationRuleRunPreflight" - }, - "run": { - "$ref": "#/components/schemas/AutomationRuleRunView" - } - }, - "required": [ - "rule_id", - "trigger_kind", - "preflight" - ] - }, - "IncidentTriggerSubscriptionUpsertRequest": { - "type": "object", - "description": "创建或更新故障触发订阅。", - "properties": { - "subscription_id": { + "page_header": { "type": "string", - "description": "已有订阅 ID。省略时按 source、consumer、consumer_ref 创建或更新。" + "description": "状态页页头内容。" }, - "source": { + "page_footer": { "type": "string", - "description": "订阅来源。AI SRE 自动化规则使用 `ai_sre_automation`。" + "description": "状态页页脚内容。" }, - "consumer": { + "date_view": { "type": "string", - "description": "消费方系统。AI SRE 自动化规则使用 `fc_safari`。" + "description": "事件日期展示方式。", + "enum": [ + "calendar", + "list" + ] }, - "consumer_ref": { + "display_uptime_mode": { "type": "string", - "description": "消费方持有的引用 ID,例如自动化规则 ID。" - }, - "channel_ids": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer", - "format": "int64" - }, - "description": "新故障可触发消费方的 On-call 协作空间 ID。" + "description": "可用率展示方式。", + "enum": [ + "chart_and_percentage", + "chart", + "none" + ] }, - "severities": { + "custom_links": { "type": "array", - "minItems": 1, + "description": "状态页展示的自定义导航链接。", "items": { - "type": "string", - "enum": [ - "Critical", - "Warning", - "Info" - ] - }, - "description": "订阅的故障等级;不支持 `Ok`。" - }, - "enabled": { - "type": "boolean", - "description": "订阅是否启用;省略时默认为 true。" - } - }, - "required": [ - "source", - "consumer", - "consumer_ref", - "channel_ids", - "severities" - ] - }, - "IncidentTriggerSubscriptionDeleteRequest": { - "type": "object", - "description": "按消费方引用删除故障触发订阅。", - "properties": { - "source": { - "type": "string", - "description": "订阅来源。" + "type": "object", + "additionalProperties": { + "type": "string" + } + } }, - "consumer": { + "contact_info": { "type": "string", - "description": "消费方系统。" + "description": "联系信息,例如 mailto 或网站 URL。" }, - "consumer_ref": { - "type": "string", - "description": "消费方持有的引用 ID,例如自动化规则 ID。" + "subscription": { + "$ref": "#/components/schemas/StatusPageSubscriptionItem" } }, "required": [ - "source", - "consumer", - "consumer_ref" + "name", + "url_name", + "type", + "date_view", + "display_uptime_mode" ] }, - "IncidentTriggerSubscription": { + "CreateStatusPageResponse": { "type": "object", - "description": "On-call 存储的故障触发订阅。", "properties": { - "subscription_id": { - "type": "string", - "description": "订阅 ID。" - }, - "account_id": { + "page_id": { "type": "integer", "format": "int64", - "description": "账户 ID。" + "description": "创建的状态页 ID。" }, - "source": { + "page_name": { "type": "string", - "description": "订阅来源。" + "description": "创建的状态页名称。" }, - "consumer": { + "page_url_name": { "type": "string", - "description": "消费方系统。" - }, - "consumer_ref": { - "type": "string", - "description": "消费方持有的引用 ID。" - }, - "channel_ids": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" - }, - "description": "已订阅的协作空间 ID。" - }, - "severities": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "Critical", - "Warning", - "Info" - ] - }, - "description": "已订阅的故障等级。" - }, - "enabled": { - "type": "boolean", - "description": "订阅是否启用。" - }, - "created_by": { - "type": "integer", - "format": "int64", - "description": "创建订阅的成员 ID。" - }, - "updated_by": { - "type": "integer", - "format": "int64", - "description": "最后更新订阅的成员 ID。" - }, - "created_at": { - "type": "integer", - "format": "int64", - "description": "订阅创建时间,Unix 秒。" - }, - "updated_at": { - "type": "integer", - "format": "int64", - "description": "订阅最后更新时间,Unix 秒。" - }, - "deleted_at": { - "type": "integer", - "format": "int64", - "description": "订阅删除时间,Unix 秒;0 表示仍有效。" + "description": "最终分配给状态页的 URL 安全路径。" } }, "required": [ - "subscription_id", - "account_id", - "source", - "consumer", - "consumer_ref", - "channel_ids", - "severities", - "enabled", - "created_by", - "updated_by", - "created_at", - "updated_at", - "deleted_at" + "page_id", + "page_name", + "page_url_name" ] } } diff --git a/roundtrip_gen_test.go b/roundtrip_gen_test.go index ff80ad2..74efd33 100644 --- a/roundtrip_gen_test.go +++ b/roundtrip_gen_test.go @@ -8,39 +8,35 @@ import "encoding/json" // endpoint's response data payload into its generated Go type. It drives the // spec-example round-trip test (roundtrip_test.go). var exampleDataDecoders = map[string]func(json.RawMessage) error{ - "GET /incident/post-mortem/info": func(d json.RawMessage) error { var v PostMortemItem; return json.Unmarshal(d, &v) }, - "GET /incident/post-mortem/template/info": func(d json.RawMessage) error { var v PostMortemTemplate; return json.Unmarshal(d, &v) }, - "GET /status-page/change/active/list": func(d json.RawMessage) error { var v StatusPageChangeListResponse; return json.Unmarshal(d, &v) }, - "GET /status-page/change/info": func(d json.RawMessage) error { var v StatusPageChangeItem; return json.Unmarshal(d, &v) }, - "GET /status-page/change/list": func(d json.RawMessage) error { var v StatusPageChangeListResponse; return json.Unmarshal(d, &v) }, - "GET /status-page/list": func(d json.RawMessage) error { var v ListStatusPageResponse; return json.Unmarshal(d, &v) }, - "GET /status-page/migration/status": func(d json.RawMessage) error { var v StatusPageMigrationJob; return json.Unmarshal(d, &v) }, - "GET /status-page/subscriber/list": func(d json.RawMessage) error { var v StatusPageSubscriberListResponse; return json.Unmarshal(d, &v) }, - "POST /account/info": func(d json.RawMessage) error { var v AccountInfo; return json.Unmarshal(d, &v) }, - "POST /alert-event/list": func(d json.RawMessage) error { var v AlertEventGlobalListResponse; return json.Unmarshal(d, &v) }, - "POST /alert/event/list": func(d json.RawMessage) error { var v AlertEventListResponse; return json.Unmarshal(d, &v) }, - "POST /alert/feed": func(d json.RawMessage) error { var v AlertFeedResponse; return json.Unmarshal(d, &v) }, - "POST /alert/info": func(d json.RawMessage) error { var v AlertItem; return json.Unmarshal(d, &v) }, - "POST /alert/list": func(d json.RawMessage) error { var v AlertListResponse; return json.Unmarshal(d, &v) }, - "POST /alert/list-by-ids": func(d json.RawMessage) error { var v AlertListResponse; return json.Unmarshal(d, &v) }, - "POST /alert/pipeline/info": func(d json.RawMessage) error { var v AlertPipelineItem; return json.Unmarshal(d, &v) }, - "POST /alert/pipeline/list": func(d json.RawMessage) error { var v AlertPipelineListResponse; return json.Unmarshal(d, &v) }, - "POST /audit/operation/list": func(d json.RawMessage) error { var v AuditOperationListResponse; return json.Unmarshal(d, &v) }, - "POST /audit/search": func(d json.RawMessage) error { var v AuditSearchResponse; return json.Unmarshal(d, &v) }, - "POST /calendar/create": func(d json.RawMessage) error { var v CalendarCreateResponse; return json.Unmarshal(d, &v) }, - "POST /calendar/event/list": func(d json.RawMessage) error { var v CalEventListResponse; return json.Unmarshal(d, &v) }, - "POST /calendar/event/upsert": func(d json.RawMessage) error { var v CalEventUpsertResponse; return json.Unmarshal(d, &v) }, - "POST /calendar/info": func(d json.RawMessage) error { var v CalendarItem; return json.Unmarshal(d, &v) }, - "POST /calendar/list": func(d json.RawMessage) error { var v CalendarListResponse; return json.Unmarshal(d, &v) }, - "POST /change/list": func(d json.RawMessage) error { var v ListChangeResponse; return json.Unmarshal(d, &v) }, - "POST /channel/create": func(d json.RawMessage) error { var v ChannelCreateResponse; return json.Unmarshal(d, &v) }, - "POST /channel/escalate/rule/create": func(d json.RawMessage) error { var v RuleCreateResponse; return json.Unmarshal(d, &v) }, - "POST /channel/escalate/rule/info": func(d json.RawMessage) error { var v EscalateRuleItem; return json.Unmarshal(d, &v) }, - "POST /channel/escalate/rule/list": func(d json.RawMessage) error { var v ListEscalationRulesResponse; return json.Unmarshal(d, &v) }, - "POST /channel/escalate/webhook/robot/list": func(d json.RawMessage) error { - var v ChannelsChannelEscalateWebhookRobotListResponse - return json.Unmarshal(d, &v) - }, + "GET /incident/post-mortem/info": func(d json.RawMessage) error { var v PostMortemItem; return json.Unmarshal(d, &v) }, + "GET /incident/post-mortem/template/info": func(d json.RawMessage) error { var v PostMortemTemplate; return json.Unmarshal(d, &v) }, + "GET /status-page/change/active/list": func(d json.RawMessage) error { var v StatusPageChangeListResponse; return json.Unmarshal(d, &v) }, + "GET /status-page/change/info": func(d json.RawMessage) error { var v StatusPageChangeItem; return json.Unmarshal(d, &v) }, + "GET /status-page/change/list": func(d json.RawMessage) error { var v StatusPageChangeListResponse; return json.Unmarshal(d, &v) }, + "GET /status-page/list": func(d json.RawMessage) error { var v ListStatusPageResponse; return json.Unmarshal(d, &v) }, + "GET /status-page/migration/status": func(d json.RawMessage) error { var v StatusPageMigrationJob; return json.Unmarshal(d, &v) }, + "GET /status-page/subscriber/list": func(d json.RawMessage) error { var v StatusPageSubscriberListResponse; return json.Unmarshal(d, &v) }, + "POST /account/info": func(d json.RawMessage) error { var v AccountInfo; return json.Unmarshal(d, &v) }, + "POST /alert-event/list": func(d json.RawMessage) error { var v AlertEventGlobalListResponse; return json.Unmarshal(d, &v) }, + "POST /alert/event/list": func(d json.RawMessage) error { var v AlertEventListResponse; return json.Unmarshal(d, &v) }, + "POST /alert/feed": func(d json.RawMessage) error { var v AlertFeedResponse; return json.Unmarshal(d, &v) }, + "POST /alert/info": func(d json.RawMessage) error { var v AlertItem; return json.Unmarshal(d, &v) }, + "POST /alert/list": func(d json.RawMessage) error { var v AlertListResponse; return json.Unmarshal(d, &v) }, + "POST /alert/list-by-ids": func(d json.RawMessage) error { var v AlertListResponse; return json.Unmarshal(d, &v) }, + "POST /alert/pipeline/info": func(d json.RawMessage) error { var v AlertPipelineItem; return json.Unmarshal(d, &v) }, + "POST /alert/pipeline/list": func(d json.RawMessage) error { var v AlertPipelineListResponse; return json.Unmarshal(d, &v) }, + "POST /audit/operation/list": func(d json.RawMessage) error { var v AuditOperationListResponse; return json.Unmarshal(d, &v) }, + "POST /audit/search": func(d json.RawMessage) error { var v AuditSearchResponse; return json.Unmarshal(d, &v) }, + "POST /calendar/create": func(d json.RawMessage) error { var v CalendarCreateResponse; return json.Unmarshal(d, &v) }, + "POST /calendar/event/list": func(d json.RawMessage) error { var v CalEventListResponse; return json.Unmarshal(d, &v) }, + "POST /calendar/event/upsert": func(d json.RawMessage) error { var v CalEventUpsertResponse; return json.Unmarshal(d, &v) }, + "POST /calendar/info": func(d json.RawMessage) error { var v CalendarItem; return json.Unmarshal(d, &v) }, + "POST /calendar/list": func(d json.RawMessage) error { var v CalendarListResponse; return json.Unmarshal(d, &v) }, + "POST /change/list": func(d json.RawMessage) error { var v ListChangeResponse; return json.Unmarshal(d, &v) }, + "POST /channel/create": func(d json.RawMessage) error { var v ChannelCreateResponse; return json.Unmarshal(d, &v) }, + "POST /channel/escalate/rule/create": func(d json.RawMessage) error { var v RuleCreateResponse; return json.Unmarshal(d, &v) }, + "POST /channel/escalate/rule/info": func(d json.RawMessage) error { var v EscalateRuleItem; return json.Unmarshal(d, &v) }, + "POST /channel/escalate/rule/list": func(d json.RawMessage) error { var v ListEscalationRulesResponse; return json.Unmarshal(d, &v) }, "POST /channel/info": func(d json.RawMessage) error { var v ChannelItem; return json.Unmarshal(d, &v) }, "POST /channel/infos": func(d json.RawMessage) error { var v ChannelInfosResponse; return json.Unmarshal(d, &v) }, "POST /channel/inhibit/rule/create": func(d json.RawMessage) error { var v RuleCreateResponse; return json.Unmarshal(d, &v) }, @@ -67,7 +63,6 @@ var exampleDataDecoders = map[string]func(json.RawMessage) error{ "POST /field/create": func(d json.RawMessage) error { var v CreateFieldResponse; return json.Unmarshal(d, &v) }, "POST /field/info": func(d json.RawMessage) error { var v FieldItem; return json.Unmarshal(d, &v) }, "POST /field/list": func(d json.RawMessage) error { var v FieldListResponse; return json.Unmarshal(d, &v) }, - "POST /incident-trigger-subscription/upsert": func(d json.RawMessage) error { var v IncidentTriggerSubscription; return json.Unmarshal(d, &v) }, "POST /incident/alert/list": func(d json.RawMessage) error { var v ListIncidentAlertsResponse; return json.Unmarshal(d, &v) }, "POST /incident/create": func(d json.RawMessage) error { var v CreateIncidentResponse; return json.Unmarshal(d, &v) }, "POST /incident/custom-action/do": func(d json.RawMessage) error { var v DoIncidentCustomActionResponse; return json.Unmarshal(d, &v) }, @@ -155,7 +150,6 @@ var exampleDataDecoders = map[string]func(json.RawMessage) error{ "POST /safari/automation/rule/delete": func(d json.RawMessage) error { var v any; return json.Unmarshal(d, &v) }, "POST /safari/automation/rule/get": func(d json.RawMessage) error { var v AutomationRuleItem; return json.Unmarshal(d, &v) }, "POST /safari/automation/rule/list": func(d json.RawMessage) error { var v AutomationRuleListResponse; return json.Unmarshal(d, &v) }, - "POST /safari/automation/rule/run": func(d json.RawMessage) error { var v AutomationRuleRunResponse; return json.Unmarshal(d, &v) }, "POST /safari/automation/rule/update": func(d json.RawMessage) error { var v AutomationRuleItem; return json.Unmarshal(d, &v) }, "POST /safari/automation/run/list": func(d json.RawMessage) error { var v AutomationRunListResponse; return json.Unmarshal(d, &v) }, "POST /safari/automation/template/list": func(d json.RawMessage) error { var v AutomationTemplateListResponse; return json.Unmarshal(d, &v) }, @@ -190,6 +184,7 @@ var exampleDataDecoders = map[string]func(json.RawMessage) error{ return json.Unmarshal(d, &v) }, "POST /status-page/component/upsert": func(d json.RawMessage) error { var v UpsertStatusPageComponentResponse; return json.Unmarshal(d, &v) }, + "POST /status-page/create": func(d json.RawMessage) error { var v CreateStatusPageResponse; return json.Unmarshal(d, &v) }, "POST /status-page/migrate-email-subscribers": func(d json.RawMessage) error { var v StatusPageMigrationStartResponse; return json.Unmarshal(d, &v) }, "POST /status-page/migrate-structure": func(d json.RawMessage) error { var v StatusPageMigrationStartResponse; return json.Unmarshal(d, &v) }, "POST /status-page/section/upsert": func(d json.RawMessage) error { var v UpsertStatusPageSectionResponse; return json.Unmarshal(d, &v) }, diff --git a/status_pages.go b/status_pages.go index 0058ae7..27cee68 100644 --- a/status_pages.go +++ b/status_pages.go @@ -155,8 +155,13 @@ func (s *StatusPagesService) ComponentUpsert(ctx context.Context, req *UpsertSta // Create a new status page. // // API: POST /status-page/create (statusPageCreate). -func (s *StatusPagesService) Create(ctx context.Context) (*Response, error) { - return s.client.do(ctx, "/status-page/create", nil, nil) +func (s *StatusPagesService) Create(ctx context.Context, req *CreateStatusPageRequest) (*CreateStatusPageResponse, *Response, error) { + out := new(CreateStatusPageResponse) + resp, err := s.client.do(ctx, "/status-page/create", req, out) + if err != nil { + return nil, resp, err + } + return out, resp, nil } // Delete status page.