From c1f4920370f57640e7a902ed3b7058aa0d4bc41e Mon Sep 17 00:00:00 2001 From: powerkimhub Date: Mon, 9 Sep 2024 15:04:35 +0900 Subject: [PATCH] Add API to retrieve Subnet info from a VPC, and add 'force' option to Swagger description for RemoveSubnet. --- .../common-runtime/VPC-SubnetManager.go | 91 +++++++++++++++++++ api-runtime/rest-runtime/CBSpiderRuntime.go | 3 +- api-runtime/rest-runtime/ClusterRest.go | 2 +- api-runtime/rest-runtime/DiskRest.go | 2 +- api-runtime/rest-runtime/KeyPairRest.go | 2 +- api-runtime/rest-runtime/MyImageRest.go | 2 +- api-runtime/rest-runtime/NLBRest.go | 2 +- api-runtime/rest-runtime/SecurityGroupRest.go | 2 +- api-runtime/rest-runtime/VMRest.go | 2 +- api-runtime/rest-runtime/VPC-SubnetRest.go | 55 ++++++++++- api/docs.go | 87 ++++++++++++++++-- api/swagger.json | 87 ++++++++++++++++-- api/swagger.yaml | 65 +++++++++++-- 13 files changed, 366 insertions(+), 36 deletions(-) diff --git a/api-runtime/common-runtime/VPC-SubnetManager.go b/api-runtime/common-runtime/VPC-SubnetManager.go index cd8bf1562..9892dc85e 100644 --- a/api-runtime/common-runtime/VPC-SubnetManager.go +++ b/api-runtime/common-runtime/VPC-SubnetManager.go @@ -950,6 +950,97 @@ func AddSubnet(connectionName string, rsType string, vpcName string, reqInfo cre return &info, nil } +// (1) get spiderIID(NameId) +// (2) get resource(driverIID) +// (3) set ResourceInfo(userIID) +func GetSubnet(connectionName string, vpcName string, nameID string) (*cres.SubnetInfo, error) { + cblog.Info("call GetSubnet()") + + // (1) check empty and trim user inputs + connectionName, err := EmptyCheckAndTrim("connectionName", connectionName) + if err != nil { + cblog.Error(err) + return nil, err + } + + vpcName, err = EmptyCheckAndTrim("vpcName", vpcName) + if err != nil { + cblog.Error(err) + return nil, err + } + + nameID, err = EmptyCheckAndTrim("nameID", nameID) + if err != nil { + cblog.Error(err) + return nil, err + } + + // (2) Get Cloud Connection + cldConn, err := ccm.GetCloudConnection(connectionName) + if err != nil { + cblog.Error(err) + return nil, err + } + + // (3) Get VPC Handler + handler, err := cldConn.CreateVPCHandler() + if err != nil { + cblog.Error(err) + return nil, err + } + + // (4) Use vpcSPLock for locking based on VPC and Subnet nameID + vpcSPLock.RLock(connectionName, vpcName) + defer vpcSPLock.RUnlock(connectionName, vpcName) + + // (5) Get VPC IID Info from infostore + var iidInfo VPCIIDInfo + err = infostore.GetByConditions(&iidInfo, CONNECTION_NAME_COLUMN, connectionName, NAME_ID_COLUMN, vpcName) + if err != nil { + cblog.Error(err) + return nil, err + } + + // (6) Get VPC Info using handler.GetVPC() and driverIID + vpcInfo, err := handler.GetVPC(getDriverIID(cres.IID{NameId: iidInfo.NameId, SystemId: iidInfo.SystemId})) + if err != nil { + cblog.Error(err) + return nil, err + } + + // (7) Set user IID (NameId) for the VPC resource + vpcInfo.IId = getUserIID(cres.IID{NameId: iidInfo.NameId, SystemId: iidInfo.SystemId}) + + // (8) Search for the subnet by nameID within the VPC's SubnetInfoList + for _, subnetInfo := range vpcInfo.SubnetInfoList { + + // (9) Get Subnet IID Info from infostore + var subnetIIDInfo SubnetIIDInfo + err := infostore.GetByConditionsAndContain(&subnetIIDInfo, CONNECTION_NAME_COLUMN, connectionName, + OWNER_VPC_NAME_COLUMN, vpcInfo.IId.NameId, SYSTEM_ID_COLUMN, getMSShortID(subnetInfo.IId.SystemId)) + if err != nil { + if checkNotFoundError(err) { + cblog.Info("Subnet not found in infostore:", err) + continue + } + cblog.Error(err) + return nil, err + } + + if subnetIIDInfo.NameId == nameID { + subnetInfo.IId = getUserIID(cres.IID{NameId: subnetIIDInfo.NameId, SystemId: subnetIIDInfo.SystemId}) + if subnetInfo.Zone == "" { + subnetInfo.Zone = subnetIIDInfo.ZoneId + } + + return &subnetInfo, nil + } + } + + // If no matching subnet was found + return nil, fmt.Errorf("Subnet with nameID %s not found in VPC %s", nameID, vpcName) +} + // (1) get spiderIID // (2) delete Resource(SystemId) // (3) delete IID diff --git a/api-runtime/rest-runtime/CBSpiderRuntime.go b/api-runtime/rest-runtime/CBSpiderRuntime.go index 1b2518eb7..f2a3c94df 100644 --- a/api-runtime/rest-runtime/CBSpiderRuntime.go +++ b/api-runtime/rest-runtime/CBSpiderRuntime.go @@ -42,7 +42,7 @@ var cblog *logrus.Logger // @title CB-Spider REST API // @version latest -// @description **🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [Simple Guide](https://github.com/cloud-barista/cb-spider/wiki/Simple-Sample-API-Guide)** +// @description **🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [API Guide](https://github.com/cloud-barista/cb-spider/wiki/REST-API-Examples)** // @contact.name API Support // @contact.url http://cloud-barista.github.io @@ -267,6 +267,7 @@ func RunServer() { {"DELETE", "/vpc/:Name", DeleteVPC}, //-- for subnet {"POST", "/vpc/:VPCName/subnet", AddSubnet}, + {"GET", "/vpc/:VPCName/subnet/:Name", GetSubnet}, {"DELETE", "/vpc/:VPCName/subnet/:SubnetName", RemoveSubnet}, {"DELETE", "/vpc/:VPCName/cspsubnet/:Id", RemoveCSPSubnet}, //-- for management diff --git a/api-runtime/rest-runtime/ClusterRest.go b/api-runtime/rest-runtime/ClusterRest.go index 44a3b2766..9ed457958 100644 --- a/api-runtime/rest-runtime/ClusterRest.go +++ b/api-runtime/rest-runtime/ClusterRest.go @@ -532,7 +532,7 @@ func ChangeNodeGroupScaling(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a Cluster" // @Param Name path string true "The name of the Cluster to delete" -// @Param force query string false "Force delete the Cluster" +// @Param force query string false "Force delete the Cluster. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/DiskRest.go b/api-runtime/rest-runtime/DiskRest.go index 534ae71d5..220174e20 100644 --- a/api-runtime/rest-runtime/DiskRest.go +++ b/api-runtime/rest-runtime/DiskRest.go @@ -331,7 +331,7 @@ func IncreaseDiskSize(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a Disk" // @Param Name path string true "The name of the Disk to delete" -// @Param force query string false "Force delete the Disk" +// @Param force query string false "Force delete the Disk. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/KeyPairRest.go b/api-runtime/rest-runtime/KeyPairRest.go index 6a58ecffd..0e47e5c66 100644 --- a/api-runtime/rest-runtime/KeyPairRest.go +++ b/api-runtime/rest-runtime/KeyPairRest.go @@ -273,7 +273,7 @@ func GetKey(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a KeyPair" // @Param Name path string true "The name of the KeyPair to delete" -// @Param force query string false "Force delete the KeyPair" +// @Param force query string false "Force delete the KeyPair. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/MyImageRest.go b/api-runtime/rest-runtime/MyImageRest.go index 6b1a346ae..27d341db3 100644 --- a/api-runtime/rest-runtime/MyImageRest.go +++ b/api-runtime/rest-runtime/MyImageRest.go @@ -277,7 +277,7 @@ func GetMyImage(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a MyImage" // @Param Name path string true "The name of the MyImage to delete" -// @Param force query string false "Force delete the MyImage" +// @Param force query string false "Force delete the MyImage. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/NLBRest.go b/api-runtime/rest-runtime/NLBRest.go index 98d67aec5..e7dd8c9d5 100644 --- a/api-runtime/rest-runtime/NLBRest.go +++ b/api-runtime/rest-runtime/NLBRest.go @@ -704,7 +704,7 @@ func GetVMGroupHealthInfo(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting an NLB" // @Param Name path string true "The name of the NLB to delete" -// @Param force query string false "Force delete the NLB" +// @Param force query string false "Force delete the NLB. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/SecurityGroupRest.go b/api-runtime/rest-runtime/SecurityGroupRest.go index 0968a96d4..1c5e30b43 100644 --- a/api-runtime/rest-runtime/SecurityGroupRest.go +++ b/api-runtime/rest-runtime/SecurityGroupRest.go @@ -275,7 +275,7 @@ func GetSecurity(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a SecurityGroup" // @Param Name path string true "The name of the SecurityGroup to delete" -// @Param force query string false "Force delete the SecurityGroup" +// @Param force query string false "Force delete the SecurityGroup. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/VMRest.go b/api-runtime/rest-runtime/VMRest.go index 8b973aa5b..106c26c77 100644 --- a/api-runtime/rest-runtime/VMRest.go +++ b/api-runtime/rest-runtime/VMRest.go @@ -404,7 +404,7 @@ func GetCSPVM(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for terminating a VM" // @Param Name path string true "The name of the VM to terminate" -// @Param force query string false "Force terminate the VM" +// @Param force query string false "Force terminate the VM. ex) true or false(default: false)" // @Success 200 {object} VMStatusResponse "Result of the terminate operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api-runtime/rest-runtime/VPC-SubnetRest.go b/api-runtime/rest-runtime/VPC-SubnetRest.go index 6736a652b..72e382ad6 100644 --- a/api-runtime/rest-runtime/VPC-SubnetRest.go +++ b/api-runtime/rest-runtime/VPC-SubnetRest.go @@ -9,6 +9,8 @@ package restruntime import ( + "strings" + cmrt "github.com/cloud-barista/cb-spider/api-runtime/common-runtime" cres "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources" @@ -381,6 +383,56 @@ func AddSubnet(c echo.Context) error { return c.JSON(http.StatusOK, result) } +// getSubnet godoc +// @ID get-subnet +// @Summary Get Subnet +// @Description Retrieve a specific Subnet from a VPC. +// @Tags [VPC Management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to get a Subnet for" +// @Param VPCName path string true "The name of the VPC" +// @Param SubnetName path string true "The name of the Subnet to retrieve" +// @Success 200 {object} cres.SubnetInfo "Details of the requested Subnet" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid parameters" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{VPCName}/subnet/{SubnetName} [get] +func GetSubnet(c echo.Context) error { + cblog.Info("call GetSubnet()") + + var req ConnectionRequest + + if err := c.Bind(&req); err != nil { + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + + // To support for Get-Query Param Type API + if req.ConnectionName == "" { + req.ConnectionName = c.QueryParam("ConnectionName") + } + + vpcName := c.Param("VPCName") + subnetName := c.Param("Name") + + // Validate that connectionName, vpcName, and subnetName are not empty + if req.ConnectionName == "" || vpcName == "" || subnetName == "" { + return echo.NewHTTPError(http.StatusBadRequest, "Missing required parameters") + } + + // Call common-runtime GetSubnet function + result, err := cmrt.GetSubnet(req.ConnectionName, vpcName, subnetName) + if err != nil { + if strings.Contains(err.Error(), "not found") { + return echo.NewHTTPError(http.StatusNotFound, "Subnet not found") + } + return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) + } + + // Return the subnet info as JSON + return c.JSON(http.StatusOK, result) +} + // removeSubnet godoc // @ID remove-subnet // @Summary Remove Subnet @@ -390,6 +442,7 @@ func AddSubnet(c echo.Context) error { // @Produce json // @Param VPCName path string true "The name of the VPC" // @Param SubnetName path string true "The name of the Subnet to remove" +// @Param force query string false "Force delete the VPC. ex) true or false(default: false)" // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for removing a Subnet" // @Success 200 {object} BooleanInfo "Result of the remove operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" @@ -501,7 +554,7 @@ func GetVPC(c echo.Context) error { // @Produce json // @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a VPC" // @Param Name path string true "The name of the VPC to delete" -// @Param force query string false "Force delete the VPC" +// @Param force query string false "Force delete the VPC. ex) true or false(default: false)" // @Success 200 {object} BooleanInfo "Result of the delete operation" // @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" // @Failure 404 {object} SimpleMsg "Resource Not Found" diff --git a/api/docs.go b/api/docs.go index 40144e955..34aacc36c 100644 --- a/api/docs.go +++ b/api/docs.go @@ -738,7 +738,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the Cluster", + "description": "Force delete the Cluster. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -2832,7 +2832,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the Disk", + "description": "Force delete the Disk. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -3714,7 +3714,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the KeyPair", + "description": "Force delete the KeyPair. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -3938,7 +3938,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the MyImage", + "description": "Force delete the MyImage. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -4162,7 +4162,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the NLB", + "description": "Force delete the NLB. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -6317,7 +6317,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the SecurityGroup", + "description": "Force delete the SecurityGroup. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -6659,7 +6659,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force terminate the VM", + "description": "Force terminate the VM. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -7319,7 +7319,7 @@ const docTemplate = `{ }, { "type": "string", - "description": "Force delete the VPC", + "description": "Force delete the VPC. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -7480,6 +7480,69 @@ const docTemplate = `{ } }, "/vpc/{VPCName}/subnet/{SubnetName}": { + "get": { + "description": "Retrieve a specific Subnet from a VPC.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[VPC Management]" + ], + "summary": "Get Subnet", + "operationId": "get-subnet", + "parameters": [ + { + "type": "string", + "description": "The name of the Connection to get a Subnet for", + "name": "ConnectionName", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "The name of the VPC", + "name": "VPCName", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the Subnet to retrieve", + "name": "SubnetName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Details of the requested Subnet", + "schema": { + "$ref": "#/definitions/spider.SubnetInfo" + } + }, + "400": { + "description": "Bad Request, possibly due to invalid parameters", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + }, + "404": { + "description": "Resource Not Found", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + } + } + }, "delete": { "description": "Remove an existing Subnet from a VPC.", "consumes": [ @@ -7508,6 +7571,12 @@ const docTemplate = `{ "in": "path", "required": true }, + { + "type": "string", + "description": "Force delete the VPC. ex) true or false(default: false)", + "name": "force", + "in": "query" + }, { "description": "Request body for removing a Subnet", "name": "ConnectionRequest", @@ -11268,7 +11337,7 @@ var SwaggerInfo = &swag.Spec{ BasePath: "/spider", Schemes: []string{"http"}, Title: "CB-Spider REST API", - Description: "**🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [Simple Guide](https://github.com/cloud-barista/cb-spider/wiki/Simple-Sample-API-Guide)**", + Description: "**🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [API Guide](https://github.com/cloud-barista/cb-spider/wiki/REST-API-Examples)**", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/api/swagger.json b/api/swagger.json index 327e892e8..d80e73766 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -4,7 +4,7 @@ ], "swagger": "2.0", "info": { - "description": "**🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [Simple Guide](https://github.com/cloud-barista/cb-spider/wiki/Simple-Sample-API-Guide)**", + "description": "**🕷️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** **🕷️ [API Guide](https://github.com/cloud-barista/cb-spider/wiki/REST-API-Examples)**", "title": "CB-Spider REST API", "contact": { "name": "API Support", @@ -735,7 +735,7 @@ }, { "type": "string", - "description": "Force delete the Cluster", + "description": "Force delete the Cluster. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -2829,7 +2829,7 @@ }, { "type": "string", - "description": "Force delete the Disk", + "description": "Force delete the Disk. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -3711,7 +3711,7 @@ }, { "type": "string", - "description": "Force delete the KeyPair", + "description": "Force delete the KeyPair. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -3935,7 +3935,7 @@ }, { "type": "string", - "description": "Force delete the MyImage", + "description": "Force delete the MyImage. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -4159,7 +4159,7 @@ }, { "type": "string", - "description": "Force delete the NLB", + "description": "Force delete the NLB. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -6314,7 +6314,7 @@ }, { "type": "string", - "description": "Force delete the SecurityGroup", + "description": "Force delete the SecurityGroup. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -6656,7 +6656,7 @@ }, { "type": "string", - "description": "Force terminate the VM", + "description": "Force terminate the VM. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -7316,7 +7316,7 @@ }, { "type": "string", - "description": "Force delete the VPC", + "description": "Force delete the VPC. ex) true or false(default: false)", "name": "force", "in": "query" } @@ -7477,6 +7477,69 @@ } }, "/vpc/{VPCName}/subnet/{SubnetName}": { + "get": { + "description": "Retrieve a specific Subnet from a VPC.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "[VPC Management]" + ], + "summary": "Get Subnet", + "operationId": "get-subnet", + "parameters": [ + { + "type": "string", + "description": "The name of the Connection to get a Subnet for", + "name": "ConnectionName", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "The name of the VPC", + "name": "VPCName", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "The name of the Subnet to retrieve", + "name": "SubnetName", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "Details of the requested Subnet", + "schema": { + "$ref": "#/definitions/spider.SubnetInfo" + } + }, + "400": { + "description": "Bad Request, possibly due to invalid parameters", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + }, + "404": { + "description": "Resource Not Found", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/spider.SimpleMsg" + } + } + } + }, "delete": { "description": "Remove an existing Subnet from a VPC.", "consumes": [ @@ -7505,6 +7568,12 @@ "in": "path", "required": true }, + { + "type": "string", + "description": "Force delete the VPC. ex) true or false(default: false)", + "name": "force", + "in": "query" + }, { "description": "Request body for removing a Subnet", "name": "ConnectionRequest", diff --git a/api/swagger.yaml b/api/swagger.yaml index 65a722148..f25be10b6 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -2632,7 +2632,7 @@ info: name: API Support url: http://cloud-barista.github.io description: "**\U0001F577️ [User Guide](https://github.com/cloud-barista/cb-spider/wiki/features-and-usages)** - \ **\U0001F577️ [Simple Guide](https://github.com/cloud-barista/cb-spider/wiki/Simple-Sample-API-Guide)**" + \ **\U0001F577️ [API Guide](https://github.com/cloud-barista/cb-spider/wiki/REST-API-Examples)**" license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html @@ -3121,7 +3121,7 @@ paths: name: Name required: true type: string - - description: Force delete the Cluster + - description: 'Force delete the Cluster. ex) true or false(default: false)' in: query name: force type: string @@ -4545,7 +4545,7 @@ paths: name: Name required: true type: string - - description: Force delete the Disk + - description: 'Force delete the Disk. ex) true or false(default: false)' in: query name: force type: string @@ -5146,7 +5146,7 @@ paths: name: Name required: true type: string - - description: Force delete the KeyPair + - description: 'Force delete the KeyPair. ex) true or false(default: false)' in: query name: force type: string @@ -5301,7 +5301,7 @@ paths: name: Name required: true type: string - - description: Force delete the MyImage + - description: 'Force delete the MyImage. ex) true or false(default: false)' in: query name: force type: string @@ -5456,7 +5456,7 @@ paths: name: Name required: true type: string - - description: Force delete the NLB + - description: 'Force delete the NLB. ex) true or false(default: false)' in: query name: force type: string @@ -6941,7 +6941,7 @@ paths: name: Name required: true type: string - - description: Force delete the SecurityGroup + - description: 'Force delete the SecurityGroup. ex) true or false(default: false)' in: query name: force type: string @@ -7178,7 +7178,7 @@ paths: name: Name required: true type: string - - description: Force terminate the VM + - description: 'Force terminate the VM. ex) true or false(default: false)' in: query name: force type: string @@ -7634,7 +7634,7 @@ paths: name: Name required: true type: string - - description: Force delete the VPC + - description: 'Force delete the VPC. ex) true or false(default: false)' in: query name: force type: string @@ -7804,6 +7804,10 @@ paths: name: SubnetName required: true type: string + - description: 'Force delete the VPC. ex) true or false(default: false)' + in: query + name: force + type: string - description: Request body for removing a Subnet in: body name: ConnectionRequest @@ -7833,6 +7837,49 @@ paths: summary: Remove Subnet tags: - '[VPC Management]' + get: + consumes: + - application/json + description: Retrieve a specific Subnet from a VPC. + operationId: get-subnet + parameters: + - description: The name of the Connection to get a Subnet for + in: query + name: ConnectionName + required: true + type: string + - description: The name of the VPC + in: path + name: VPCName + required: true + type: string + - description: The name of the Subnet to retrieve + in: path + name: SubnetName + required: true + type: string + produces: + - application/json + responses: + "200": + description: Details of the requested Subnet + schema: + $ref: '#/definitions/spider.SubnetInfo' + "400": + description: Bad Request, possibly due to invalid parameters + schema: + $ref: '#/definitions/spider.SimpleMsg' + "404": + description: Resource Not Found + schema: + $ref: '#/definitions/spider.SimpleMsg' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/spider.SimpleMsg' + summary: Get Subnet + tags: + - '[VPC Management]' schemes: - http securityDefinitions: