-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.v1.yaml
More file actions
1317 lines (1316 loc) · 46.6 KB
/
Copy pathopenapi.v1.yaml
File metadata and controls
1317 lines (1316 loc) · 46.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: 分布式配置文档服务 管理面 API v1
version: 1.0.0
description: |
管理面 REST 契约,与 docs/design-v2.md §5.3 一致。
数据面为 gRPC,正式契约见 proto/config.v1.proto。
所有管理写操作应携带 Idempotency-Key 请求头(幂等,见 design-v2 §4.2)。
contact:
name: Defing Config Service
servers:
- url: http://localhost:8384
security:
- AdminSession: []
paths:
/api/v1/login:
post:
summary: 登录(单一管理员会话 I7;第二个登录返回 409)
security: []
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/LoginRequest' }
responses:
'200':
description: 登录成功
content:
application/json:
schema: { $ref: '#/components/schemas/LoginResponse' }
'401': { $ref: '#/components/responses/Unauthorized' }
'409': { $ref: '#/components/responses/SessionInUse' }
/api/v1/logout:
post:
summary: 登出(使当前会话失效)
responses:
'204': { description: 成功 }
'401': { $ref: '#/components/responses/Unauthorized' }
/api/v1/heartbeat:
post:
summary: 会话心跳续期(默认每 5min)
responses:
'200':
description: 续期成功
content:
application/json:
schema:
type: object
properties:
expires_at: { type: string, format: date-time }
'401': { $ref: '#/components/responses/Unauthorized' }
/api/v1/me/password:
post:
summary: 自助修改自己的密码(全局管理员 / 项目管理员通用;校验当前密码,改后全部旧会话失效需重新登录)
security:
- AdminSession: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [current_password, new_password]
properties:
current_password: { type: string, description: 当前密码(验证本人;错误返回 401 ERR_BAD_CREDENTIALS) }
new_password: { type: string, minLength: 6, description: 新密码(≥6 位) }
responses:
'200':
description: 已修改(当前会话一并失效)
'401': { $ref: '#/components/responses/Unauthorized' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects:
get:
summary: 项目列表
responses:
'200':
description: 成功
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Project' }
post:
summary: 创建项目(name 全局唯一;可选 clone_from 克隆源项目已发布结构)
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string, maxLength: 128 }
clone_from:
type: string
description: 可选:从该项目克隆已发布结构(新项目结构直接以 v1 落地;不传/空串 = 空结构普通创建)
responses:
'200':
description: 已创建(默认创建 dev/test/prod 分支)
content:
application/json:
schema:
type: object
required: [id, branches]
properties:
id: { type: string }
branches:
type: array
items: { type: string }
'409': { $ref: '#/components/responses/Conflict' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}:
get:
summary: 项目详情
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/Project' }
'404': { $ref: '#/components/responses/NotFound' }
delete:
summary: 删除项目(需确认 force=true 参数)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { name: force, in: query, schema: { type: boolean, default: false } }
responses:
'204': { description: 成功 }
'404': { $ref: '#/components/responses/NotFound' }
/api/v1/projects/{p}/branches:
get:
summary: 分支列表(含活动版本号)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 成功
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/Branch' }
post:
summary: 新建分支(继承当前已发布结构与活动版本值)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string, pattern: '^[a-z0-9][a-z0-9-]{0,63}$' }
responses:
'201':
description: 已创建
content:
application/json:
schema: { $ref: '#/components/schemas/Branch' }
'409': { $ref: '#/components/responses/Conflict' }
/api/v1/projects/{p}/branches/{b}:
get:
summary: 分支详情
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/Branch' }
'404': { $ref: '#/components/responses/NotFound' }
delete:
summary: 删除分支(活动版本为 1 且无草稿时可删)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
responses:
'204': { description: 成功 }
'409': { $ref: '#/components/responses/Conflict' }
/api/v1/projects/{p}/structure:
get:
summary: 查询已发布结构(当前生效版本)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 成功
content:
application/json:
schema:
type: object
required: [version, groups]
properties:
version: { type: integer, format: int64, description: 当前已发布结构版本 }
groups:
type: array
items: { $ref: '#/components/schemas/GroupDef' }
'401': { $ref: '#/components/responses/Unauthorized' }
'404': { $ref: '#/components/responses/NotFound' }
/api/v1/projects/{p}/structure-draft:
get:
summary: 读取结构草稿(含基础版本)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/StructureDraft' }
put:
summary: 整体替换结构草稿(base_version 必须匹配当前基础版本,否则 409)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/StructureDraft' }
responses:
'200':
description: 已保存
content:
application/json:
schema: { $ref: '#/components/schemas/StructureDraft' }
'409': { $ref: '#/components/responses/Conflict' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}/structure-draft/publish:
post:
summary: 发布结构(对全部分支同时生效,所有分支版本号推进)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PublishRequest' }
responses:
'200':
description: 已发布
content:
application/json:
schema:
type: object
required: [structure_version, affected_branches]
properties:
structure_version: { type: integer, format: int64 }
affected_branches:
type: array
items:
type: object
properties:
branch: { type: string }
version: { type: integer, format: int64 }
'422': { $ref: '#/components/responses/PublishBlocked' }
/api/v1/projects/{p}/branches/{b}/draft:
get:
summary: 读取分支值草稿(待发布变更)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/DraftBody' }
put:
summary: 更新值草稿(updates 覆盖写入;deletes 按 "group/key" 移除)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/DraftBody' }
responses:
'200':
description: 已保存
content:
application/json:
schema: { $ref: '#/components/schemas/DraftBody' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}/branches/{b}/publish:
post:
summary: 发布分支版本(原子;幂等键防重复)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PublishRequest' }
responses:
'200':
description: 已发布
content:
application/json:
schema: { $ref: '#/components/schemas/PublishResult' }
'409': { $ref: '#/components/responses/NoDraft' }
'422': { $ref: '#/components/responses/PublishBlocked' }
/api/v1/projects/{p}/branches/{b}/versions:
get:
summary: 版本历史
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
- { name: limit, in: query, schema: { type: integer, maximum: 200, default: 50 } }
- { name: before, in: query, schema: { type: integer, format: int64 } }
responses:
'200':
description: 成功
content:
application/json:
schema:
type: object
properties:
versions:
type: array
items: { $ref: '#/components/schemas/Version' }
/api/v1/projects/{p}/branches/{b}/config:
get:
summary: 管理面查看配置(secret 默认掩码;reveal=true 需会话+审计)
security:
- AdminSession: []
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
- { name: reveal, in: query, schema: { type: boolean, default: false } }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/ConfigSnapshot' }
'404': { $ref: '#/components/responses/NotFound' }
/api/v1/projects/{p}/branches/{b}/rollback:
post:
summary: 回滚到指定版本(以旧内容创建新版本)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/RollbackRequest' }
responses:
'200':
description: 已回滚
content:
application/json:
schema:
type: object
required: [new_version]
properties:
new_version: { type: integer, format: int64 }
'404': { $ref: '#/components/responses/NotFound' }
/api/v1/projects/{p}/branches/{b}/gray-publish:
post:
summary: 灰度发布(固化草稿 → 灰度快照 + 灰度规则;稳定版不动)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/GrayPublishRequest' }
responses:
'200':
description: 已发布灰度
content:
application/json:
schema: { $ref: '#/components/schemas/GrayPublishResult' }
'409': { $ref: '#/components/responses/NoDraft' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}/branches/{b}/gray-promote:
post:
summary: 灰度转正(灰度内容 → 新稳定版;清灰度)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/GrayCommentRequest' }
responses:
'200':
description: 已转正
content:
application/json:
schema:
type: object
required: [active_version]
properties:
active_version: { type: integer, format: int64 }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}/branches/{b}/gray-abort:
post:
summary: 灰度下量/回滚(摘灰度指针,客户端回落稳定版)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/GrayCommentRequest' }
responses:
'200':
description: 已下量
content:
application/json:
schema:
type: object
required: [fallback_version]
properties:
fallback_version: { type: integer, format: int64 }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/projects/{p}/branches/{b}/gray-status:
get:
summary: 灰度状态(gray_active/gray_seq/gray_rule/active_version)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/GrayStatus' }
'404': { $ref: '#/components/responses/NotFound' }
/api/v1/projects/{p}/diff:
get:
summary: 分支间值对比(同结构按 key)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { name: branch_a, in: query, required: true, schema: { type: string } }
- { name: branch_b, in: query, required: true, schema: { type: string } }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/DiffResult' }
/api/v1/projects/{p}/promote:
post:
summary: 值提升(写入目标分支值草稿;默认不覆盖目标已改项)
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PromoteRequest' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/PromoteResult' }
/api/v1/shared:
get:
summary: 共享项列表
responses:
'200':
description: 成功
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/SharedItem' }
post:
summary: 新建共享项(写共享草稿)
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/SharedItem' }
responses:
'201': { $ref: '#/components/responses/Created' }
/api/v1/shared-draft:
get:
summary: 共享草稿列表(secret 值掩码)
responses:
'200':
description: 成功
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/SharedItem' }
put:
summary: 更新共享草稿
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/SharedItem' }
responses:
'200': { description: 已保存 }
/api/v1/shared/publish:
post:
summary: 发布共享项(auto 模式自动级联受影响项目;返回受影响列表)
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PublishRequest' }
responses:
'200':
description: 已发布
content:
application/json:
schema: { $ref: '#/components/schemas/SharedPublishResult' }
'422': { $ref: '#/components/responses/PublishBlocked' }
/api/v1/shared/{key}:
delete:
summary: 删除已发布共享项(连同草稿);被项目结构引用 → 409 Conflict
parameters:
- { name: key, in: path, required: true, schema: { type: string } }
responses:
'204': { description: 已删除 }
'409': { $ref: '#/components/responses/Conflict' }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/shared-draft/{key}:
delete:
summary: 删除共享草稿(幂等)
parameters:
- { name: key, in: path, required: true, schema: { type: string } }
responses:
'204': { description: 已删除 }
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/audit:
get:
summary: 审计查询
parameters:
- { name: action, in: query, schema: { type: string } }
- { name: since, in: query, schema: { type: string, format: date-time } }
- { name: limit, in: query, schema: { type: integer, default: 100, maximum: 1000 } }
responses:
'200':
description: 成功
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/AuditEntry' }
/api/v1/cluster/join:
post:
summary: 新节点加入(加为 learner;经 leader)
security: []
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/JoinRequest' }
responses:
'200':
description: 已受理,返回成员表
content:
application/json:
schema: { $ref: '#/components/schemas/MemberList' }
/api/v1/cluster/promote:
post:
summary: 将 learner 提升为 voter
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [node_id]
properties:
node_id: { type: string }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/MemberList' }
/api/v1/cluster/remove:
post:
summary: 移除节点(先降 learner 再移除)
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [node_id]
properties:
node_id: { type: string }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/MemberList' }
/api/v1/cluster/members:
get:
summary: 集群成员表(含节点地址/角色;SDK 端点池刷新用)
security: []
responses:
'200':
description: 成功
content:
application/json:
schema:
type: object
properties:
node_id: { type: string, nullable: true }
current_leader: { type: string, nullable: true }
state: { type: string }
members:
type: array
items: { $ref: '#/components/schemas/Member' }
/api/v1/admin/rotate-master-key:
post:
summary: 轮换主密钥(KeyRing 追加 + 环文件持久化;DEK 重包由后台任务执行)
security:
- AdminSession: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [new_key]
properties:
new_key: { type: string, description: base64 32B 新 KEK }
responses:
'200':
description: 已轮换(返回 generation 与环条目数)
'422': { $ref: '#/components/responses/ValidationFailed' }
/api/v1/admin/force-logout:
post:
summary: 强制下线管理员会话(CLI `dsh admin force-logout` 兜底,I7)
security:
- AdminSession: []
responses:
'200': { description: 已下线 }
/api/v1/admin/set-password:
post:
summary: 修改管理员密码(哈希落状态机,集群一致;旧会话失效)
security:
- AdminSession: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [password]
properties:
password: { type: string, minLength: 6 }
responses:
'200': { description: 已修改 }
/api/v1/admin/snapshot:
get:
summary: 备份快照(状态机 KV dump;`dsh admin snapshot --out` 存盘)
security:
- AdminSession: []
responses:
'200':
description: 状态机 dump({version, kind, entries:[{key,value}]})
/api/v1/admin/retention-status:
get:
summary: 保留策略状态(--version-retention / --audit-retention 配置 + 计数)
security:
- AdminSession: []
responses:
'200':
description: 保留策略与当前计数
/healthz:
get:
summary: 存活检查
security: []
responses:
'200':
description: 存活
content:
application/json:
schema:
type: object
properties:
status: { type: string, enum: [ok] }
/readyz:
get:
summary: 就绪检查(已加入集群且可服务)
security: []
responses:
'200':
description: 就绪
content:
application/json:
schema:
type: object
properties:
status: { type: string, enum: [ok] }
'503':
description: 未就绪
/metrics:
get:
summary: Prometheus 指标文本
security: []
responses:
'200':
description: 指标文本(text/plain; version=0.0.4)
/admin:
get:
summary: 内嵌 Admin UI
security: []
responses:
'200':
description: HTML 页面
/v1/projects/{p}/branches/{b}/snapshot:
get:
summary: SDK 数据面快照(纯值输出;secret 恒脱敏为掩码 "***",面向应用经 TLS 拉取)
security: []
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
responses:
'200':
description: 成功
content:
application/json:
schema: { $ref: '#/components/schemas/ConfigSnapshot' }
'404': { $ref: '#/components/responses/NotFound' }
/v1/projects/{p}/branches/{b}/watch:
get:
summary: SDK 数据面 SSE 订阅(发布事件流;keepalive 注释帧)
security: []
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
- { name: after_version, in: query, schema: { type: integer, format: int64 }, description: 断线续传起点(重放该版本之后的历史事件再转实时) }
responses:
'200':
description: text/event-stream
/v1/projects/{p}/branches/{b}/config:
get:
summary: 渲染输出配置文档(YAML/TOML/JSON/ENV;secret 默认掩码)
security: []
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { $ref: '#/components/parameters/BranchPath' }
- { name: format, in: query, schema: { type: string, enum: [yaml, toml, json, env], default: yaml }, description: "env = .env 文件(GROUP__KEY=VALUE,组/键大写,双下划线分隔)" }
- { name: version, in: query, schema: { type: integer, format: int64 } }
- { name: reveal, in: query, schema: { type: boolean, default: false }, description: 需权限+审计 }
responses:
'200':
description: 渲染文档(Content-Type 按 format)
content:
application/octet-stream: {}
'404': { $ref: '#/components/responses/NotFound' }
# F10(P3-④ 补全):项目管理员(PA)账号管理面(admin-only;global admin 管理)
/api/v1/projects/{p}/admins:
get:
summary: 项目管理员账号列表(该项目的 PA;global admin 会话)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 账号列表
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/ProjectAdminAccount' }
'401': { $ref: '#/components/responses/Unauthorized' }
post:
summary: 创建项目管理员账号(用户名 [A-Za-z0-9_-]{2,64} 且 ≠ admin)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PAUpsertRequest' }
responses:
'201':
description: 创建成功
content:
application/json:
schema: { $ref: '#/components/schemas/ProjectAdminAccount' }
'409': { $ref: '#/components/responses/Conflict' }
'422': { $ref: '#/components/responses/Validation' }
/api/v1/projects/{p}/admins/{u}:
put:
summary: 修改项目管理员密码(旧会话即时失效)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { name: u, in: path, required: true, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PAUpsertRequest' }
responses:
'200':
description: 修改成功
'404': { $ref: '#/components/responses/NotFound' }
delete:
summary: 删除项目管理员账号(级联删除其会话)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { name: u, in: path, required: true, schema: { type: string } }
responses:
'204': { description: 删除成功 }
'404': { $ref: '#/components/responses/NotFound' }
# 项目访问令牌(project-token):数据面 SDK 机器凭据(admin-only;仅全局管理员可管理)
/api/v1/projects/{p}/tokens:
get:
summary: 项目访问令牌列表(不含明文与 hash;含 revoked 标记)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
responses:
'200':
description: 令牌列表
content:
application/json:
schema:
type: array
items: { $ref: '#/components/schemas/ProjectToken' }
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
post:
summary: 创建项目访问令牌(明文仅创建响应返回一次;SHA-256 落盘)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/TokenCreateRequest' }
responses:
'201':
description: 创建成功(token 明文仅此一次)
content:
application/json:
schema: { $ref: '#/components/schemas/TokenCreatedResponse' }
'409': { $ref: '#/components/responses/Conflict' }
'404': { $ref: '#/components/responses/NotFound' }
'403': { $ref: '#/components/responses/Forbidden' }
/api/v1/projects/{p}/tokens/{id}:
delete:
summary: 吊销项目访问令牌(幂等;已吊销重复删仍 204)
security: [AdminSession: []]
parameters:
- { $ref: '#/components/parameters/ProjectPath' }
- { name: id, in: path, required: true, schema: { type: string }, description: token id(hash 前 16 位) }
responses:
'204': { description: 吊销成功 }
'404': { $ref: '#/components/responses/NotFound' }
'403': { $ref: '#/components/responses/Forbidden' }
components:
securitySchemes:
AdminSession:
type: http
scheme: bearer
description: 管理面会话令牌(/api/v1/login 获取;单会话强制)
parameters:
ProjectPath:
name: p
in: path
required: true
schema: { type: string }
description: 项目名
BranchPath:
name: b
in: path
required: true
schema: { type: string }
description: 分支名(dev/test/prod 或自定义)
responses:
Unauthorized:
description: 未认证或会话过期(ERR_SESSION_EXPIRED)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
SessionInUse:
description: 已有管理员在线(ERR_SESSION_IN_USE)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
NotFound:
description: 不存在(ERR_NOT_FOUND)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
Conflict:
description: 冲突(ERR_CONFLICT / 命名冲突 / base_version 不匹配)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
ValidationFailed:
description: 校验失败(ERR_VALIDATION,detail 携带明细)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
PublishBlocked:
description: 完整性校验阻断发布(ERR_PUBLISH_BLOCKED,detail 携带明细)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
NoDraft:
description: 无待发布草稿(ERR_NO_DRAFT)
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorBody' }
Created:
description: 已创建
content:
application/json:
schema: { $ref: '#/components/schemas/SharedItem' }
schemas:
ErrorBody:
type: object
required: [code, message]
properties:
code: { type: string }
message: { type: string }
detail: { type: object, additionalProperties: true }
request_id: { type: string }
LoginRequest:
type: object
required: [password]
properties:
password: { type: string }
device_id: { type: string }
LoginResponse:
type: object
required: [token, expires_at]
properties:
token: { type: string }
expires_at: { type: string, format: date-time }
must_change_password: { type: boolean, default: false }
Project:
type: object
required: [id, name]
properties:
id: { type: string }
name: { type: string }
created_at: { type: string, format: date-time }
Branch:
type: object
required: [name, active_version]
properties:
name: { type: string }
active_version: { type: integer, format: int64 }
structure_version: { type: integer, format: int64 }
created_at: { type: string, format: date-time }
draft_rev: { type: integer, format: int64, description: 草稿修订号(乐观锁) }
shared_refs:
type: array
description: 结构 shared 项 × 本分支绑定解析值(secret 已掩码);未绑定项 shared_key 为空串、version/value 为 null
items:
type: object
properties:
group: { type: string }
key: { type: string }
shared_key: { type: string, description: 本分支绑定的共享项 key;空串 = 未绑定 }
version: { type: [integer, "null"], format: int64 }
value:
anyOf:
- { $ref: '#/components/schemas/Value' }
- { type: "null" }
ConfigSnapshot:
type: object
required: [project, branch, version]
properties:
project: { type: string }
branch: { type: string }
version: { type: integer, format: int64 }
# G3/D27+R1:数据面按身份 resolve 的结果——灰度命中时 version=active(v/ 空间)、
# resolved_version=gray_seq、gray=true;稳定路径 resolved_version=version。
resolved_version: { type: integer, format: int64 }
gray: { type: boolean, default: false }
structure_version: { type: integer, format: int64 }
groups:
type: object