Skip to content

Commit

Permalink
Merge pull request #64 from yunkon-kim/240516-14
Browse files Browse the repository at this point in the history
Update response message and link
  • Loading branch information
yunkon-kim authored May 16, 2024
2 parents 43023b6 + bb0c3a6 commit 3b968e6
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions pkg/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ const docTemplate = `{
}
}
},
"/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}/status": {
"/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}": {
"get": {
"description": "Check the status of a specific request by its ID",
"consumes": [
Expand Down Expand Up @@ -893,7 +893,7 @@ const docTemplate = `{
}
}
},
"/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}/status": {
"/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}": {
"get": {
"description": "Check the status of a specific request by its ID",
"consumes": [
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
}
}
},
"/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}/status": {
"/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}": {
"get": {
"description": "Check the status of a specific request by its ID",
"consumes": [
Expand Down Expand Up @@ -886,7 +886,7 @@
}
}
},
"/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}/status": {
"/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}": {
"get": {
"description": "Check the status of a specific request by its ID",
"consumes": [
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ paths:
AWS VPN tunnels
tags:
- '[VPN] GCP to AWS VPN tunnel configuration'
/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}/status:
/rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}:
get:
consumes:
- application/json
Expand Down Expand Up @@ -781,7 +781,7 @@ paths:
Azure VPN tunnels
tags:
- '[VPN] GCP to Azure VPN tunnel configuration'
/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}/status:
/rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}:
get:
consumes:
- application/json
Expand Down
13 changes: 7 additions & 6 deletions pkg/api/rest/handler/vpn-gcp-aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func InitTerrariumForGcpAwsVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully initialized an infrastructure terrarium",
Text: "the infrastructure terrarium is successfully initialized",
Detail: ret,
}

Expand Down Expand Up @@ -386,6 +386,7 @@ func CreateInfracodeOfGcpAwsVpn(c echo.Context) error {
}
return c.JSON(http.StatusBadRequest, res)
}
log.Debug().Msgf("%+v", req) // debug

projectRoot := viper.GetString("mcterrarium.root")

Expand Down Expand Up @@ -427,7 +428,7 @@ func CreateInfracodeOfGcpAwsVpn(c echo.Context) error {

res := model.Response{
Success: true,
Text: "Successfully created the infracode to configure GCP to AWS VPN tunnels",
Text: "the infracode to configure GCP to AWS VPN tunnels is Successfully created",
}

log.Debug().Msgf("%+v", res) // debug
Expand Down Expand Up @@ -493,7 +494,7 @@ func CheckInfracodeOfGcpAwsVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully completed the infracode checking process",
Text: "the infracode checking process is successfully completed",
Detail: ret,
}

Expand Down Expand Up @@ -559,7 +560,7 @@ func CreateGcpAwsVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully accepted the request to deploy resource (currently being processed)",
Text: "the request (id: " + reqId + ") is successfully accepted and still deploying resource",
Detail: ret,
}

Expand Down Expand Up @@ -654,7 +655,7 @@ func DestroyGcpAwsVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully accepted the request to destroy the resouces (currently being processed)",
Text: "the request (id: " + reqId + ") is successfully accepted and still destroying resource",
Detail: ret,
}

Expand All @@ -675,7 +676,7 @@ func DestroyGcpAwsVpn(c echo.Context) error {
// @Failure 400 {object} model.Response "Bad Request"
// @Failure 500 {object} model.Response "Internal Server Error"
// @Failure 503 {object} model.Response "Service Unavailable"
// @Router /rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId}/status [get]
// @Router /rg/{resourceGroupId}/vpn/gcp-aws/request/{requestId} [get]
func GetRequestStatusOfGcpAwsVpn(c echo.Context) error {

rgId := c.Param("resourceGroupId")
Expand Down
13 changes: 7 additions & 6 deletions pkg/api/rest/handler/vpn-gcp-azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func InitTerrariumForGcpAzureVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully initialized an infrastructure terrarium",
Text: "the infrastructure terrarium is successfully initialized",
Detail: ret,
}

Expand Down Expand Up @@ -443,7 +443,7 @@ func CreateInfracodeOfGcpAzureVpn(c echo.Context) error {

res := model.Response{
Success: true,
Text: "Successfully created the infracode to configure GCP to Azure VPN tunnels",
Text: "the infracode to configure GCP to Azure VPN tunnels is Successfully created",
}

log.Debug().Msgf("%+v", res) // debug
Expand Down Expand Up @@ -510,7 +510,7 @@ func CheckInfracodeOfGcpAzureVpn(c echo.Context) error {

res := model.Response{
Success: true,
Text: "successfully completed the infracode checking process",
Text: "the infracode checking process is successfully completed",
Detail: ret,
}

Expand Down Expand Up @@ -574,9 +574,10 @@ func CreateGcpAzureVpn(c echo.Context) error {
}
return c.JSON(http.StatusInternalServerError, res)
}

res := model.Response{
Success: true,
Text: "resource deployment request has been accepted and is currently being processed",
Text: "the request (id: " + reqId + ") is successfully accepted and still deploying resource",
Detail: ret,
}

Expand Down Expand Up @@ -644,7 +645,7 @@ func DestroyGcpAzureVpn(c echo.Context) error {
}
res := model.Response{
Success: true,
Text: "successfully accepted the request to destroy the resouces (currently being processed)",
Text: "the request (id: " + reqId + ") is successfully accepted and still destroying resource",
Detail: ret,
}

Expand All @@ -665,7 +666,7 @@ func DestroyGcpAzureVpn(c echo.Context) error {
// @Failure 400 {object} model.Response "Bad Request"
// @Failure 500 {object} model.Response "Internal Server Error"
// @Failure 503 {object} model.Response "Service Unavailable"
// @Router /rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId}/status [get]
// @Router /rg/{resourceGroupId}/vpn/gcp-azure/request/{requestId} [get]
func GetRequestStatusOfGcpAzureVpn(c echo.Context) error {

rgId := c.Param("resourceGroupId")
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/rest/route/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
// /terrarium/rg/:rgId/vpn/...
func RegisterRoutesForVPN(g *echo.Group) {
// GCP and AWS
g.POST("/rg/:resourceGroupId/vpn/gcp-aws/init", handler.InitTerrariumForGcpAwsVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-aws/terrarium", handler.InitTerrariumForGcpAwsVpn)
g.DELETE("/rg/:resourceGroupId/vpn/gcp-aws/clear", handler.ClearGcpAwsVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-aws", handler.GetResourceInfoOfGcpAwsVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-aws/infracode", handler.CreateInfracodeOfGcpAwsVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-aws/plan", handler.CheckInfracodeOfGcpAwsVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-aws", handler.CreateGcpAwsVpn)
g.DELETE("/rg/:resourceGroupId/vpn/gcp-aws", handler.DestroyGcpAwsVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-aws/request/:requestId/status", handler.GetRequestStatusOfGcpAwsVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-aws/request/:requestId", handler.GetRequestStatusOfGcpAwsVpn)

// GCP and Azure
g.POST("/rg/:resourceGroupId/vpn/gcp-azure/init", handler.InitTerrariumForGcpAzureVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-azure/terrarium", handler.InitTerrariumForGcpAzureVpn)
g.DELETE("/rg/:resourceGroupId/vpn/gcp-azure/clear", handler.ClearGcpAzureVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-azure/resource/info", handler.GetResourceInfoOfGcpAzureVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-azure/infracode", handler.CreateInfracodeOfGcpAzureVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-azure/plan", handler.CheckInfracodeOfGcpAzureVpn)
g.POST("/rg/:resourceGroupId/vpn/gcp-azure", handler.CreateGcpAzureVpn)
g.DELETE("/rg/:resourceGroupId/vpn/gcp-azure", handler.DestroyGcpAzureVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-azure/request/:requestId/status", handler.GetRequestStatusOfGcpAzureVpn)
g.GET("/rg/:resourceGroupId/vpn/gcp-azure/request/:requestId", handler.GetRequestStatusOfGcpAzureVpn)
}
2 changes: 1 addition & 1 deletion templates/vpn/gcp-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ variable "gcp-region" {
variable "gcp-vpc-network-name" {
type = string
description = "The VPC network name in GCP"
default = "tofu-gcp-vpc"
default = "terrarium-vpc01"
}

# variable "gcp-subnetwork-name" {
Expand Down

0 comments on commit 3b968e6

Please sign in to comment.