feat: add port-sharing backend (#11939)

This commit is contained in:
Garrett Delfosse
2024-02-13 09:31:20 -05:00
committed by GitHub
parent c939416702
commit 3ab3a62bef
48 changed files with 1947 additions and 59 deletions
+193 -2
View File
@@ -7188,6 +7188,125 @@ const docTemplate = `{
}
}
},
"/workspaces/{workspace}/port-share": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"PortSharing"
],
"summary": "Get workspace agent port shares",
"operationId": "get-workspace-agent-port-shares",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShares"
}
}
}
},
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"PortSharing"
],
"summary": "Upsert workspace agent port share",
"operationId": "upsert-workspace-agent-port-share",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
},
{
"description": "Upsert port sharing level request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.UpsertWorkspaceAgentPortShareRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShare"
}
}
}
},
"delete": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": [
"application/json"
],
"tags": [
"PortSharing"
],
"summary": "Get workspace agent port shares",
"operationId": "get-workspace-agent-port-shares",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
},
{
"description": "Delete port sharing level request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.DeleteWorkspaceAgentPortShareRequest"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/workspaces/{workspace}/resolve-autostart": {
"get": {
"security": [
@@ -9028,6 +9147,17 @@ const docTemplate = `{
}
}
},
"codersdk.DeleteWorkspaceAgentPortShareRequest": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
}
}
},
"codersdk.DeploymentConfig": {
"type": "object",
"properties": {
@@ -9337,13 +9467,15 @@ const docTemplate = `{
"codersdk.Experiment": {
"type": "string",
"enum": [
"example"
"example",
"shared-ports"
],
"x-enum-comments": {
"ExperimentExample": "This isn't used for anything."
},
"x-enum-varnames": [
"ExperimentExample"
"ExperimentExample",
"ExperimentSharedPorts"
]
},
"codersdk.ExternalAuth": {
@@ -11022,6 +11154,9 @@ const docTemplate = `{
"type": "string",
"format": "uuid"
},
"max_port_share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
},
"max_ttl_ms": {
"description": "TODO(@dean): remove max_ttl once autostop_requirement is matured",
"type": "integer"
@@ -11839,6 +11974,20 @@ const docTemplate = `{
}
}
},
"codersdk.UpsertWorkspaceAgentPortShareRequest": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
},
"share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
}
}
},
"codersdk.User": {
"type": "object",
"required": [
@@ -12533,6 +12682,48 @@ const docTemplate = `{
}
}
},
"codersdk.WorkspaceAgentPortShare": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
},
"share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
},
"workspace_id": {
"type": "string",
"format": "uuid"
}
}
},
"codersdk.WorkspaceAgentPortShareLevel": {
"type": "string",
"enum": [
"owner",
"authenticated",
"public"
],
"x-enum-varnames": [
"WorkspaceAgentPortShareLevelOwner",
"WorkspaceAgentPortShareLevelAuthenticated",
"WorkspaceAgentPortShareLevelPublic"
]
},
"codersdk.WorkspaceAgentPortShares": {
"type": "object",
"properties": {
"shares": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShare"
}
}
}
},
"codersdk.WorkspaceAgentScript": {
"type": "object",
"properties": {
+173 -2
View File
@@ -6350,6 +6350,111 @@
}
}
},
"/workspaces/{workspace}/port-share": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["PortSharing"],
"summary": "Get workspace agent port shares",
"operationId": "get-workspace-agent-port-shares",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShares"
}
}
}
},
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["PortSharing"],
"summary": "Upsert workspace agent port share",
"operationId": "upsert-workspace-agent-port-share",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
},
{
"description": "Upsert port sharing level request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.UpsertWorkspaceAgentPortShareRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShare"
}
}
}
},
"delete": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": ["application/json"],
"tags": ["PortSharing"],
"summary": "Get workspace agent port shares",
"operationId": "get-workspace-agent-port-shares",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "workspace",
"in": "path",
"required": true
},
{
"description": "Delete port sharing level request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.DeleteWorkspaceAgentPortShareRequest"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/workspaces/{workspace}/resolve-autostart": {
"get": {
"security": [
@@ -8064,6 +8169,17 @@
}
}
},
"codersdk.DeleteWorkspaceAgentPortShareRequest": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
}
}
},
"codersdk.DeploymentConfig": {
"type": "object",
"properties": {
@@ -8368,11 +8484,11 @@
},
"codersdk.Experiment": {
"type": "string",
"enum": ["example"],
"enum": ["example", "shared-ports"],
"x-enum-comments": {
"ExperimentExample": "This isn't used for anything."
},
"x-enum-varnames": ["ExperimentExample"]
"x-enum-varnames": ["ExperimentExample", "ExperimentSharedPorts"]
},
"codersdk.ExternalAuth": {
"type": "object",
@@ -9964,6 +10080,9 @@
"type": "string",
"format": "uuid"
},
"max_port_share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
},
"max_ttl_ms": {
"description": "TODO(@dean): remove max_ttl once autostop_requirement is matured",
"type": "integer"
@@ -10730,6 +10849,20 @@
}
}
},
"codersdk.UpsertWorkspaceAgentPortShareRequest": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
},
"share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
}
}
},
"codersdk.User": {
"type": "object",
"required": ["created_at", "email", "id", "username"],
@@ -11403,6 +11536,44 @@
}
}
},
"codersdk.WorkspaceAgentPortShare": {
"type": "object",
"properties": {
"agent_name": {
"type": "string"
},
"port": {
"type": "integer"
},
"share_level": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShareLevel"
},
"workspace_id": {
"type": "string",
"format": "uuid"
}
}
},
"codersdk.WorkspaceAgentPortShareLevel": {
"type": "string",
"enum": ["owner", "authenticated", "public"],
"x-enum-varnames": [
"WorkspaceAgentPortShareLevelOwner",
"WorkspaceAgentPortShareLevelAuthenticated",
"WorkspaceAgentPortShareLevelPublic"
]
},
"codersdk.WorkspaceAgentPortShares": {
"type": "object",
"properties": {
"shares": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.WorkspaceAgentPortShare"
}
}
}
},
"codersdk.WorkspaceAgentScript": {
"type": "object",
"properties": {