仓库自包含化:Docker/CI/文档/规范入库,路由分组拆分
CI / test (push) Successful in 15s

This commit is contained in:
Wang Defa
2026-07-09 19:18:04 +08:00
parent b9a3e97e84
commit 3e0389c1e9
83 changed files with 20241 additions and 248 deletions
+132
View File
@@ -8,6 +8,12 @@ import (
"oci-portal/internal/oci"
)
// @Summary 实例形状列表
// @Tags 租户配置
// @Param id path int true "配置 ID"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/shapes [get]
func (h *ociConfigHandler) shapes(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -21,6 +27,12 @@ func (h *ociConfigHandler) shapes(c *gin.Context) {
c.JSON(http.StatusOK, shapes)
}
// @Summary 镜像列表
// @Tags 租户配置
// @Param id path int true "配置 ID"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/images [get]
func (h *ociConfigHandler) images(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -38,6 +50,13 @@ func (h *ociConfigHandler) images(c *gin.Context) {
c.JSON(http.StatusOK, images)
}
// @Summary 镜像详情
// @Tags 租户配置
// @Param id path int true "配置 ID"
// @Param imageId path string true "imageId"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/images/{imageId} [get]
func (h *ociConfigHandler) getImage(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -67,6 +86,12 @@ type renameRequest struct {
DisplayName string `json:"displayName" binding:"required"`
}
// @Summary VCN 列表
// @Tags 网络
// @Param id path int true "配置 ID"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns [get]
func (h *ociConfigHandler) listVCNs(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -80,6 +105,13 @@ func (h *ociConfigHandler) listVCNs(c *gin.Context) {
c.JSON(http.StatusOK, vcns)
}
// @Summary 创建 VCN
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param body body createVCNRequest true "请求体"
// @Success 201 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns [post]
func (h *ociConfigHandler) createVCN(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -105,6 +137,13 @@ func (h *ociConfigHandler) createVCN(c *gin.Context) {
c.JSON(http.StatusCreated, vcn)
}
// @Summary VCN 详情
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param vcnId path string true "vcnId"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns/{vcnId} [get]
func (h *ociConfigHandler) getVCN(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -118,6 +157,14 @@ func (h *ociConfigHandler) getVCN(c *gin.Context) {
c.JSON(http.StatusOK, vcn)
}
// @Summary 更新 VCN
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param vcnId path string true "vcnId"
// @Param body body renameRequest true "请求体"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns/{vcnId} [put]
func (h *ociConfigHandler) updateVCN(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -136,6 +183,13 @@ func (h *ociConfigHandler) updateVCN(c *gin.Context) {
c.JSON(http.StatusOK, vcn)
}
// @Summary 删除 VCN
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param vcnId path string true "vcnId"
// @Success 204 "无内容"
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns/{vcnId} [delete]
func (h *ociConfigHandler) deleteVCN(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -152,6 +206,14 @@ type enableIPv6Request struct {
Region string `json:"region"`
}
// @Summary VCN 启用 IPv6
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param vcnId path string true "vcnId"
// @Param body body enableIPv6Request true "请求体"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/vcns/{vcnId}/enable-ipv6 [post]
func (h *ociConfigHandler) enableVCNIPv6(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -182,6 +244,12 @@ type createSubnetRequest struct {
ProhibitPublicIP bool `json:"prohibitPublicIp"`
}
// @Summary 子网列表
// @Tags 网络
// @Param id path int true "配置 ID"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/subnets [get]
func (h *ociConfigHandler) listSubnets(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -195,6 +263,13 @@ func (h *ociConfigHandler) listSubnets(c *gin.Context) {
c.JSON(http.StatusOK, subnets)
}
// @Summary 创建子网
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param body body createSubnetRequest true "请求体"
// @Success 201 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/subnets [post]
func (h *ociConfigHandler) createSubnet(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -221,6 +296,13 @@ func (h *ociConfigHandler) createSubnet(c *gin.Context) {
c.JSON(http.StatusCreated, subnet)
}
// @Summary 子网详情
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param subnetId path string true "subnetId"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/subnets/{subnetId} [get]
func (h *ociConfigHandler) getSubnet(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -234,6 +316,14 @@ func (h *ociConfigHandler) getSubnet(c *gin.Context) {
c.JSON(http.StatusOK, subnet)
}
// @Summary 更新子网
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param subnetId path string true "subnetId"
// @Param body body renameRequest true "请求体"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/subnets/{subnetId} [put]
func (h *ociConfigHandler) updateSubnet(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -252,6 +342,13 @@ func (h *ociConfigHandler) updateSubnet(c *gin.Context) {
c.JSON(http.StatusOK, subnet)
}
// @Summary 删除子网
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param subnetId path string true "subnetId"
// @Success 204 "无内容"
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/subnets/{subnetId} [delete]
func (h *ociConfigHandler) deleteSubnet(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -281,6 +378,12 @@ type updateSecurityListRequest struct {
EgressRules *[]oci.SecurityRule `json:"egressRules"`
}
// @Summary 安全列表清单
// @Tags 网络
// @Param id path int true "配置 ID"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/security-lists [get]
func (h *ociConfigHandler) listSecurityLists(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -294,6 +397,13 @@ func (h *ociConfigHandler) listSecurityLists(c *gin.Context) {
c.JSON(http.StatusOK, lists)
}
// @Summary 创建安全列表
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param body body createSecurityListRequest true "请求体"
// @Success 201 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/security-lists [post]
func (h *ociConfigHandler) createSecurityList(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -318,6 +428,13 @@ func (h *ociConfigHandler) createSecurityList(c *gin.Context) {
c.JSON(http.StatusCreated, list)
}
// @Summary 安全列表详情
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param securityListId path string true "securityListId"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/security-lists/{securityListId} [get]
func (h *ociConfigHandler) getSecurityList(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -331,6 +448,14 @@ func (h *ociConfigHandler) getSecurityList(c *gin.Context) {
c.JSON(http.StatusOK, list)
}
// @Summary 更新安全列表
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param securityListId path string true "securityListId"
// @Param body body updateSecurityListRequest true "请求体"
// @Success 200 {object} map[string]any
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/security-lists/{securityListId} [put]
func (h *ociConfigHandler) updateSecurityList(c *gin.Context) {
id, ok := pathID(c)
if !ok {
@@ -354,6 +479,13 @@ func (h *ociConfigHandler) updateSecurityList(c *gin.Context) {
c.JSON(http.StatusOK, list)
}
// @Summary 删除安全列表
// @Tags 网络
// @Param id path int true "配置 ID"
// @Param securityListId path string true "securityListId"
// @Success 204 "无内容"
// @Security BearerAuth
// @Router /api/v1/oci-configs/{id}/security-lists/{securityListId} [delete]
func (h *ociConfigHandler) deleteSecurityList(c *gin.Context) {
id, ok := pathID(c)
if !ok {