- route definition
- Url: /api/v1/rate-limits
- Method: GET
- Request:
RateLimitsListRequest - Response:
RateLimitsListResponse
- request definition
type RateLimitsListRequest struct {
Resource string `form:"resource,optional"`
}
- response definition
type RateLimitsListResponse struct {
Items []RateLimit `json:"items"`
}
- route definition
- Url: /api/v1/rate-limits
- Method: PUT
- Request:
RateLimitUpsertRequest - Response:
RateLimitResponse
- 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"`
}
- 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"`
}
- route definition
- Url: /api/v1/rate-limits/:id
- Method: GET
- Request:
RateLimitGetRequest - Response:
RateLimitResponse
- request definition
type RateLimitGetRequest struct {
ID string `path:"id"`
}
- 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"`
}
- route definition
- Url: /api/v1/rate-limits/:id
- Method: DELETE
- Request:
RateLimitDeleteRequest - Response:
-
- request definition
type RateLimitDeleteRequest struct {
ID string `path:"id"`
}
- response definition
- route definition
- Url: /api/v1/rate-limits/preview
- Method: POST
- Request:
RateLimitPreviewRequest - Response:
RateLimitPreviewResponse
- request definition
type RateLimitPreviewRequest struct {
Rules interface{} `json:"rules"`
}
- response definition
type RateLimitPreviewResponse struct {
Matches interface{} `json:"matches"`
Impact interface{} `json:"impact"`
}