Skip to content

Commit

Permalink
Handle the missing vNet/subnets by the unexpected outside operations
Browse files Browse the repository at this point in the history
* Add RefineVNet() and RefineSubent(), which operates based on information managed by Tumblebug
* Add actions (refine, force) on the following APIs
  - `DELETE /ns/{nsId}/resources/vNet/{vNetId}?action=xxx`
  - `DELETE /ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}?action=xxx`
* Add the API to get subnet
  - `GET /ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}`
* Improve comments in overall vNet/subnet functions and handlers
  • Loading branch information
yunkon-kim committed Sep 11, 2024
1 parent 7d4957e commit c1b7e59
Show file tree
Hide file tree
Showing 7 changed files with 840 additions and 188 deletions.
35 changes: 23 additions & 12 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8125,7 +8125,7 @@ const docTemplate = `{
}
},
"delete": {
"description": "Delete VNet",
"description": "Delete VNet\n- withsubnets: delete VNet and its subnets\n- refine: delete information of VNet and its subnets if there's no info/resource in Spider/CSP\n- force: delete VNet and its subnets regardless of the status of info/resource in Spider/CSP",
"consumes": [
"application/json"
],
Expand All @@ -8135,7 +8135,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete VNet",
"summary": "Delete VNet (supporting actions: withsubnet, refine, force)",
"operationId": "DelVNet",
"parameters": [
{
Expand All @@ -8155,12 +8155,13 @@ const docTemplate = `{
},
{
"enum": [
"true",
"false"
"withsubnets",
"refine",
"force"
],
"type": "string",
"description": "Delete subnets as well",
"name": "withSubnets",
"description": "Action",
"name": "action",
"in": "query"
}
],
Expand All @@ -8182,7 +8183,7 @@ const docTemplate = `{
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet": {
"get": {
"description": "List all subnets (metadata)",
"description": "List all subnets",
"consumes": [
"application/json"
],
Expand All @@ -8192,7 +8193,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "List all subnets (metadata)",
"summary": "List all subnets",
"operationId": "GetAllSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8295,7 +8296,7 @@ const docTemplate = `{
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}": {
"get": {
"description": "Get Subnet (metadata)",
"description": "Get Subnet",
"consumes": [
"application/json"
],
Expand All @@ -8305,7 +8306,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Get Subnet (metadata)",
"summary": "Get Subnet",
"operationId": "GetSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8353,7 +8354,7 @@ const docTemplate = `{
}
},
"delete": {
"description": "Delete Subnet",
"description": "Delete Subnet\n- refine: delete information of subnet if there's no info/resource in Spider/CSP\n- force: delete subnet regardless of the status of info/resource in Spider/CSP",
"consumes": [
"application/json"
],
Expand All @@ -8363,7 +8364,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete Subnet",
"summary": "Delete Subnet (supporting actions: refine, force)",
"operationId": "DelSubnet",
"parameters": [
{
Expand All @@ -8387,6 +8388,16 @@ const docTemplate = `{
"name": "subnetId",
"in": "path",
"required": true
},
{
"enum": [
"refine",
"force"
],
"type": "string",
"description": "Action",
"name": "action",
"in": "query"
}
],
"responses": {
Expand Down
35 changes: 23 additions & 12 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8118,7 +8118,7 @@
}
},
"delete": {
"description": "Delete VNet",
"description": "Delete VNet\n- withsubnets: delete VNet and its subnets\n- refine: delete information of VNet and its subnets if there's no info/resource in Spider/CSP\n- force: delete VNet and its subnets regardless of the status of info/resource in Spider/CSP",
"consumes": [
"application/json"
],
Expand All @@ -8128,7 +8128,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete VNet",
"summary": "Delete VNet (supporting actions: withsubnet, refine, force)",
"operationId": "DelVNet",
"parameters": [
{
Expand All @@ -8148,12 +8148,13 @@
},
{
"enum": [
"true",
"false"
"withsubnets",
"refine",
"force"
],
"type": "string",
"description": "Delete subnets as well",
"name": "withSubnets",
"description": "Action",
"name": "action",
"in": "query"
}
],
Expand All @@ -8175,7 +8176,7 @@
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet": {
"get": {
"description": "List all subnets (metadata)",
"description": "List all subnets",
"consumes": [
"application/json"
],
Expand All @@ -8185,7 +8186,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "List all subnets (metadata)",
"summary": "List all subnets",
"operationId": "GetAllSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8288,7 +8289,7 @@
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}": {
"get": {
"description": "Get Subnet (metadata)",
"description": "Get Subnet",
"consumes": [
"application/json"
],
Expand All @@ -8298,7 +8299,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Get Subnet (metadata)",
"summary": "Get Subnet",
"operationId": "GetSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8346,7 +8347,7 @@
}
},
"delete": {
"description": "Delete Subnet",
"description": "Delete Subnet\n- refine: delete information of subnet if there's no info/resource in Spider/CSP\n- force: delete subnet regardless of the status of info/resource in Spider/CSP",
"consumes": [
"application/json"
],
Expand All @@ -8356,7 +8357,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete Subnet",
"summary": "Delete Subnet (supporting actions: refine, force)",
"operationId": "DelSubnet",
"parameters": [
{
Expand All @@ -8380,6 +8381,16 @@
"name": "subnetId",
"in": "path",
"required": true
},
{
"enum": [
"refine",
"force"
],
"type": "string",
"description": "Action",
"name": "action",
"in": "query"
}
],
"responses": {
Expand Down
39 changes: 27 additions & 12 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8933,7 +8933,11 @@ paths:
delete:
consumes:
- application/json
description: Delete VNet
description: |-
Delete VNet
- withsubnets: delete VNet and its subnets
- refine: delete information of VNet and its subnets if there's no info/resource in Spider/CSP
- force: delete VNet and its subnets regardless of the status of info/resource in Spider/CSP
operationId: DelVNet
parameters:
- default: default
Expand All @@ -8947,12 +8951,13 @@ paths:
name: vNetId
required: true
type: string
- description: Delete subnets as well
- description: Action
enum:
- "true"
- "false"
- withsubnets
- refine
- force
in: query
name: withSubnets
name: action
type: string
produces:
- application/json
Expand All @@ -8965,7 +8970,7 @@ paths:
description: Not Found
schema:
$ref: '#/definitions/model.SimpleMsg'
summary: Delete VNet
summary: 'Delete VNet (supporting actions: withsubnet, refine, force)'
tags:
- '[Infra Resource] Network Management'
get:
Expand Down Expand Up @@ -9007,7 +9012,7 @@ paths:
get:
consumes:
- application/json
description: List all subnets (metadata)
description: List all subnets
operationId: GetAllSubnet
parameters:
- default: default
Expand Down Expand Up @@ -9036,7 +9041,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/model.SimpleMsg'
summary: List all subnets (metadata)
summary: List all subnets
tags:
- '[Infra Resource] Network Management'
post:
Expand Down Expand Up @@ -9084,7 +9089,10 @@ paths:
delete:
consumes:
- application/json
description: Delete Subnet
description: |-
Delete Subnet
- refine: delete information of subnet if there's no info/resource in Spider/CSP
- force: delete subnet regardless of the status of info/resource in Spider/CSP
operationId: DelSubnet
parameters:
- default: default
Expand All @@ -9103,6 +9111,13 @@ paths:
name: subnetId
required: true
type: string
- description: Action
enum:
- refine
- force
in: query
name: action
type: string
produces:
- application/json
responses:
Expand All @@ -9114,13 +9129,13 @@ paths:
description: Not Found
schema:
$ref: '#/definitions/model.SimpleMsg'
summary: Delete Subnet
summary: 'Delete Subnet (supporting actions: refine, force)'
tags:
- '[Infra Resource] Network Management'
get:
consumes:
- application/json
description: Get Subnet (metadata)
description: Get Subnet
operationId: GetSubnet
parameters:
- default: default
Expand Down Expand Up @@ -9154,7 +9169,7 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/model.SimpleMsg'
summary: Get Subnet (metadata)
summary: Get Subnet
tags:
- '[Infra Resource] Network Management'
/ns/{nsId}/sharedResource:
Expand Down
Loading

0 comments on commit c1b7e59

Please sign in to comment.