66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Summary 订阅列表
|
|
// @Tags 租户配置
|
|
// @Param id path int true "配置 ID"
|
|
// @Success 200 {object} map[string]any
|
|
// @Security BearerAuth
|
|
// @Router /api/v1/oci-configs/{id}/subscriptions [get]
|
|
func (h *ociConfigHandler) subscriptions(c *gin.Context) {
|
|
id, ok := pathID(c)
|
|
if !ok {
|
|
return
|
|
}
|
|
subs, err := h.svc.Subscriptions(c.Request.Context(), id)
|
|
if err != nil {
|
|
respondError(c, err)
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, subs)
|
|
}
|
|
|
|
// @Summary 订阅详情
|
|
// @Tags 租户配置
|
|
// @Param id path int true "配置 ID"
|
|
// @Param subscriptionId path string true "subscriptionId"
|
|
// @Success 200 {object} map[string]any
|
|
// @Security BearerAuth
|
|
// @Router /api/v1/oci-configs/{id}/subscriptions/{subscriptionId} [get]
|
|
func (h *ociConfigHandler) subscriptionDetail(c *gin.Context) {
|
|
id, ok := pathID(c)
|
|
if !ok {
|
|
return
|
|
}
|
|
detail, err := h.svc.SubscriptionDetail(c.Request.Context(), id, c.Param("subscriptionId"))
|
|
if err != nil {
|
|
respondError(c, err)
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, detail)
|
|
}
|
|
|
|
// @Summary 限额服务列表
|
|
// @Tags 租户配置
|
|
// @Param id path int true "配置 ID"
|
|
// @Success 200 {object} map[string]any
|
|
// @Security BearerAuth
|
|
// @Router /api/v1/oci-configs/{id}/limits/services [get]
|
|
func (h *ociConfigHandler) limitServices(c *gin.Context) {
|
|
id, ok := pathID(c)
|
|
if !ok {
|
|
return
|
|
}
|
|
services, err := h.svc.LimitServices(c.Request.Context(), id, c.Query("region"))
|
|
if err != nil {
|
|
respondError(c, err)
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, services)
|
|
}
|