CroupierCroupier
指南
架构
API 参考
开发
  • C++ SDK
  • Go SDK
  • Java SDK
  • JavaScript SDK
  • Python SDK
  • C# SDK
  • Lua SDK
分析
GitHub
指南
架构
API 参考
开发
  • C++ SDK
  • Go SDK
  • Java SDK
  • JavaScript SDK
  • Python SDK
  • C# SDK
  • Lua SDK
分析
GitHub
  • API 参考

    • API 概览
    • gRPC API
    • REST API
  • 运维管理

    • 运维 API
    • 运维核心 API
    • 运维简化 API
    • 管理员 API
    • 备份 API
    • 配置 API
    • 迁移 API
    • 监控 API
    • 节点 API
  • Agent & 函数

    • Agent API
    • 函数 API
    • 任务 API
    • /api/pack.html
    • Schema API
  • 认证与权限

    • 认证 API
    • 审批 API
    • 审计 API
    • 限流 API
  • 游戏管理

    • 游戏 API
    • 玩家 API
    • 实体 API
    • /api/component.html
    • 注册表 API
  • 消息通知

    • 消息 API
    • 告警 API
    • 支持 API
    • 工单 API
    • 反馈 API
  • 平台与集成

    • 平台 API
    • Provider API
    • 证书 API
    • 存储 API
  • 数据分析

    • 数据分析 API
    • 行为分析 API
    • 分析概览 API
    • 支付分析 API
    • 留存分析 API
  • 其他

    • 分配 API
    • 常见问题
    • 元数据 API
    • 配置文件 API
    • Workspace API

限流 API

1. "获取限流规则列表"

  1. route definition
  • Url: /api/v1/rate-limits
  • Method: GET
  • Request: RateLimitsListRequest
  • Response: RateLimitsListResponse
  1. request definition
type RateLimitsListRequest struct {
	Resource string `form:"resource,optional"`
}
  1. response definition
type RateLimitsListResponse struct {
	Items []RateLimit `json:"items"`
}

2. "创建/更新限流规则"

  1. route definition
  • Url: /api/v1/rate-limits
  • Method: PUT
  • Request: RateLimitUpsertRequest
  • Response: RateLimitResponse
  1. request definition
type RateLimitUpsertRequest struct {
	Name string `json:"name"`
	Resource string `json:"resource"`
	Limit int `json:"limit"`
	Window int `json:"window"`
	Action string `json:"action"`
	Rules interface{} `json:"rules,optional"`
}
  1. response definition
type RateLimitResponse struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Resource string `json:"resource"` // function, api, user
	Limit int `json:"limit"` // 每秒请求数
	Window int `json:"window"` // 时间窗口(秒)
	Action string `json:"action"` // reject, throttle
	Rules interface{} `json:"rules"`
	Status int `json:"status"`
	UpdatedAt string `json:"updatedAt"`
}

type RateLimit struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Resource string `json:"resource"` // function, api, user
	Limit int `json:"limit"` // 每秒请求数
	Window int `json:"window"` // 时间窗口(秒)
	Action string `json:"action"` // reject, throttle
	Rules interface{} `json:"rules"`
	Status int `json:"status"`
	UpdatedAt string `json:"updatedAt"`
}

3. "获取限流规则"

  1. route definition
  • Url: /api/v1/rate-limits/:id
  • Method: GET
  • Request: RateLimitGetRequest
  • Response: RateLimitResponse
  1. request definition
type RateLimitGetRequest struct {
	ID string `path:"id"`
}
  1. response definition
type RateLimitResponse struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Resource string `json:"resource"` // function, api, user
	Limit int `json:"limit"` // 每秒请求数
	Window int `json:"window"` // 时间窗口(秒)
	Action string `json:"action"` // reject, throttle
	Rules interface{} `json:"rules"`
	Status int `json:"status"`
	UpdatedAt string `json:"updatedAt"`
}

type RateLimit struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Resource string `json:"resource"` // function, api, user
	Limit int `json:"limit"` // 每秒请求数
	Window int `json:"window"` // 时间窗口(秒)
	Action string `json:"action"` // reject, throttle
	Rules interface{} `json:"rules"`
	Status int `json:"status"`
	UpdatedAt string `json:"updatedAt"`
}

4. "删除限流规则"

  1. route definition
  • Url: /api/v1/rate-limits/:id
  • Method: DELETE
  • Request: RateLimitDeleteRequest
  • Response: -
  1. request definition
type RateLimitDeleteRequest struct {
	ID string `path:"id"`
}
  1. response definition

5. "预览限流规则"

  1. route definition
  • Url: /api/v1/rate-limits/preview
  • Method: POST
  • Request: RateLimitPreviewRequest
  • Response: RateLimitPreviewResponse
  1. request definition
type RateLimitPreviewRequest struct {
	Rules interface{} `json:"rules"`
}
  1. response definition
type RateLimitPreviewResponse struct {
	Matches interface{} `json:"matches"`
	Impact interface{} `json:"impact"`
}
在 GitHub 上编辑此页
最后更新: 2026/3/19 10:26
Prev
审计 API