Skip to content

Commit

Permalink
Add network utility APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored Jan 29, 2024
2 parents a1544bf + 89c5f9f commit 635710e
Show file tree
Hide file tree
Showing 7 changed files with 586 additions and 11 deletions.
177 changes: 177 additions & 0 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7974,6 +7974,98 @@ const docTemplate = `{
}
}
},
"/util/net/design": {
"post": {
"description": "Design a hierarchical network configuration of a VPC network or multi-cloud network consisting of multiple VPC networks",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Utility] Multi-cloud network design"
],
"summary": "Design a multi-cloud network configuration",
"parameters": [
{
"description": "A root/main network CIDR block and subnetting rules",
"name": "subnettingReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToDesignNetworkRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToDesignNetworkReponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/util/net/validate": {
"post": {
"description": "Validate a hierarchical configuration of a VPC network or multi-cloud network consisting of multiple VPC networks",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Utility] Multi-cloud network design"
],
"summary": "Validate a multi-cloud network configuration",
"parameters": [
{
"description": "A hierarchical network configuration",
"name": "subnettingReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToValidateNetworkRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/{nsId}/checkResource/{resourceType}/{resourceId}": {
"get": {
"description": "Check resources' existence",
Expand Down Expand Up @@ -11928,6 +12020,91 @@ const docTemplate = `{
"$ref": "#/definitions/mcis.resourceOnTumblebug"
}
}
},
"netutil.Network": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string"
},
"name": {
"type": "string"
},
"subnets": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.Network"
}
}
}
},
"netutil.RestPostUtilToDesignNetworkReponse": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string"
},
"name": {
"type": "string"
},
"subnets": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.Network"
}
}
}
},
"netutil.RestPostUtilToDesignNetworkRequest": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string",
"example": "192.168.0.0/16"
},
"subnettingRules": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.SubnettingRule"
}
}
}
},
"netutil.RestPostUtilToValidateNetworkRequest": {
"type": "object",
"properties": {
"networkConfiguration": {
"$ref": "#/definitions/netutil.Network"
}
}
},
"netutil.SubnettingRule": {
"type": "object",
"properties": {
"type": {
"allOf": [
{
"$ref": "#/definitions/netutil.SubnettingRuleType"
}
],
"example": "minSubnets"
},
"value": {
"type": "integer",
"example": 2
}
}
},
"netutil.SubnettingRuleType": {
"type": "string",
"enum": [
"minSubnets",
"minHosts"
],
"x-enum-varnames": [
"SubnettingRuleTypeMinSubnets",
"SubnettingRuleTypeMinHosts"
]
}
},
"securityDefinitions": {
Expand Down
177 changes: 177 additions & 0 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7967,6 +7967,98 @@
}
}
},
"/util/net/design": {
"post": {
"description": "Design a hierarchical network configuration of a VPC network or multi-cloud network consisting of multiple VPC networks",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Utility] Multi-cloud network design"
],
"summary": "Design a multi-cloud network configuration",
"parameters": [
{
"description": "A root/main network CIDR block and subnetting rules",
"name": "subnettingReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToDesignNetworkRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToDesignNetworkReponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/util/net/validate": {
"post": {
"description": "Validate a hierarchical configuration of a VPC network or multi-cloud network consisting of multiple VPC networks",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Utility] Multi-cloud network design"
],
"summary": "Validate a multi-cloud network configuration",
"parameters": [
{
"description": "A hierarchical network configuration",
"name": "subnettingReq",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/netutil.RestPostUtilToValidateNetworkRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/{nsId}/checkResource/{resourceType}/{resourceId}": {
"get": {
"description": "Check resources' existence",
Expand Down Expand Up @@ -11921,6 +12013,91 @@
"$ref": "#/definitions/mcis.resourceOnTumblebug"
}
}
},
"netutil.Network": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string"
},
"name": {
"type": "string"
},
"subnets": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.Network"
}
}
}
},
"netutil.RestPostUtilToDesignNetworkReponse": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string"
},
"name": {
"type": "string"
},
"subnets": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.Network"
}
}
}
},
"netutil.RestPostUtilToDesignNetworkRequest": {
"type": "object",
"properties": {
"cidrBlock": {
"type": "string",
"example": "192.168.0.0/16"
},
"subnettingRules": {
"type": "array",
"items": {
"$ref": "#/definitions/netutil.SubnettingRule"
}
}
}
},
"netutil.RestPostUtilToValidateNetworkRequest": {
"type": "object",
"properties": {
"networkConfiguration": {
"$ref": "#/definitions/netutil.Network"
}
}
},
"netutil.SubnettingRule": {
"type": "object",
"properties": {
"type": {
"allOf": [
{
"$ref": "#/definitions/netutil.SubnettingRuleType"
}
],
"example": "minSubnets"
},
"value": {
"type": "integer",
"example": 2
}
}
},
"netutil.SubnettingRuleType": {
"type": "string",
"enum": [
"minSubnets",
"minHosts"
],
"x-enum-varnames": [
"SubnettingRuleTypeMinSubnets",
"SubnettingRuleTypeMinHosts"
]
}
},
"securityDefinitions": {
Expand Down
Loading

0 comments on commit 635710e

Please sign in to comment.