Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle the missing vNet/subnets by the unexpected outside operations #1814

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ services:

# CB-Spider
cb-spider:
image: cloudbaristaorg/cb-spider:0.9.3
image: cloudbaristaorg/cb-spider:0.9.6
container_name: cb-spider
# build:
# context: ../cb-spider
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ require (
github.com/rs/zerolog v1.32.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
github.com/swaggo/echo-swagger v1.4.1
github.com/swaggo/swag v1.16.3
github.com/tidwall/gjson v1.17.1
Expand All @@ -33,7 +32,6 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand Down Expand Up @@ -71,7 +69,6 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand Down
35 changes: 23 additions & 12 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8155,7 +8155,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 @@ -8165,7 +8165,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete VNet",
"summary": "Delete VNet (supporting actions: withsubnet, refine, force)",
"operationId": "DelVNet",
"parameters": [
{
Expand All @@ -8185,12 +8185,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 @@ -8212,7 +8213,7 @@ const docTemplate = `{
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet": {
"get": {
"description": "List all subnets (metadata)",
"description": "List all subnets",
"consumes": [
"application/json"
],
Expand All @@ -8222,7 +8223,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "List all subnets (metadata)",
"summary": "List all subnets",
"operationId": "GetAllSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8325,7 +8326,7 @@ const docTemplate = `{
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}": {
"get": {
"description": "Get Subnet (metadata)",
"description": "Get Subnet",
"consumes": [
"application/json"
],
Expand All @@ -8335,7 +8336,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Get Subnet (metadata)",
"summary": "Get Subnet",
"operationId": "GetSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8383,7 +8384,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 @@ -8393,7 +8394,7 @@ const docTemplate = `{
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete Subnet",
"summary": "Delete Subnet (supporting actions: refine, force)",
"operationId": "DelSubnet",
"parameters": [
{
Expand All @@ -8417,6 +8418,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 @@ -8148,7 +8148,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 @@ -8158,7 +8158,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete VNet",
"summary": "Delete VNet (supporting actions: withsubnet, refine, force)",
"operationId": "DelVNet",
"parameters": [
{
Expand All @@ -8178,12 +8178,13 @@
},
{
"enum": [
"true",
"false"
"withsubnets",
"refine",
"force"
],
"type": "string",
"description": "Delete subnets as well",
"name": "withSubnets",
"description": "Action",
"name": "action",
"in": "query"
}
],
Expand All @@ -8205,7 +8206,7 @@
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet": {
"get": {
"description": "List all subnets (metadata)",
"description": "List all subnets",
"consumes": [
"application/json"
],
Expand All @@ -8215,7 +8216,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "List all subnets (metadata)",
"summary": "List all subnets",
"operationId": "GetAllSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8318,7 +8319,7 @@
},
"/ns/{nsId}/resources/vNet/{vNetId}/subnet/{subnetId}": {
"get": {
"description": "Get Subnet (metadata)",
"description": "Get Subnet",
"consumes": [
"application/json"
],
Expand All @@ -8328,7 +8329,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Get Subnet (metadata)",
"summary": "Get Subnet",
"operationId": "GetSubnet",
"parameters": [
{
Expand Down Expand Up @@ -8376,7 +8377,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 @@ -8386,7 +8387,7 @@
"tags": [
"[Infra Resource] Network Management"
],
"summary": "Delete Subnet",
"summary": "Delete Subnet (supporting actions: refine, force)",
"operationId": "DelSubnet",
"parameters": [
{
Expand All @@ -8410,6 +8411,16 @@
"name": "subnetId",
"in": "path",
"required": true
},
{
"enum": [
"refine",
"force"
],
"type": "string",
"description": "Action",
"name": "action",
"in": "query"
}
],
"responses": {
Expand Down
40 changes: 28 additions & 12 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6166,8 +6166,12 @@ paths:
delete:
tags:
- "[Infra Resource] Network Management"
summary: Delete VNet
description: Delete VNet
summary: "Delete VNet (supporting actions: withsubnet, refine, force)"
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:
- name: nsId
Expand All @@ -6183,14 +6187,15 @@ paths:
required: true
schema:
type: string
- name: withSubnets
- name: action
in: query
description: Delete subnets as well
description: Action
schema:
type: string
enum:
- "true"
- "false"
- withsubnets
- refine
- force
responses:
"200":
description: OK
Expand All @@ -6208,8 +6213,8 @@ paths:
get:
tags:
- "[Infra Resource] Network Management"
summary: List all subnets (metadata)
description: List all subnets (metadata)
summary: List all subnets
description: List all subnets
operationId: GetAllSubnet
parameters:
- name: nsId
Expand Down Expand Up @@ -6295,8 +6300,8 @@ paths:
get:
tags:
- "[Infra Resource] Network Management"
summary: Get Subnet (metadata)
description: Get Subnet (metadata)
summary: Get Subnet
description: Get Subnet
operationId: GetSubnet
parameters:
- name: nsId
Expand Down Expand Up @@ -6340,8 +6345,11 @@ paths:
delete:
tags:
- "[Infra Resource] Network Management"
summary: Delete Subnet
description: Delete Subnet
summary: "Delete Subnet (supporting actions: refine, force)"
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:
- name: nsId
Expand All @@ -6363,6 +6371,14 @@ paths:
required: true
schema:
type: string
- name: action
in: query
description: Action
schema:
type: string
enum:
- refine
- force
responses:
"200":
description: OK
Expand Down
Loading