Skip to content

Commit fc00d7e

Browse files
committed
workspaceagents.go in progress
1 parent 663ec87 commit fc00d7e

File tree

10 files changed

+1056
-306
lines changed

10 files changed

+1056
-306
lines changed

coderd/apidoc/docs.go

Lines changed: 197 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ const docTemplate = `{
886886
"application/json"
887887
],
888888
"tags": [
889-
"Workspaces"
889+
"Agents"
890890
],
891891
"summary": "Authenticate agent on AWS instance",
892892
"operationId": "authenticate-agent-on-aws-instance",
@@ -922,7 +922,7 @@ const docTemplate = `{
922922
"application/json"
923923
],
924924
"tags": [
925-
"Workspaces"
925+
"Agents"
926926
],
927927
"summary": "Authenticate agent on Azure instance",
928928
"operationId": "authenticate-agent-on-azure-instance",
@@ -958,7 +958,7 @@ const docTemplate = `{
958958
"application/json"
959959
],
960960
"tags": [
961-
"Workspaces"
961+
"Agents"
962962
],
963963
"summary": "Authenticate agent on Google Cloud instance",
964964
"operationId": "authenticate-agent-on-google-cloud-instance",
@@ -983,6 +983,34 @@ const docTemplate = `{
983983
}
984984
}
985985
},
986+
"/workspaceagents/me/metadata": {
987+
"get": {
988+
"security": [
989+
{
990+
"CoderSessionToken": []
991+
}
992+
],
993+
"consumes": [
994+
"application/json"
995+
],
996+
"produces": [
997+
"application/json"
998+
],
999+
"tags": [
1000+
"Agents"
1001+
],
1002+
"summary": "Get authorized workspace agent metadata",
1003+
"operationId": "get-authorized-workspace-agent-metadata",
1004+
"responses": {
1005+
"200": {
1006+
"description": "OK",
1007+
"schema": {
1008+
"$ref": "#/definitions/codersdk.WorkspaceAgentMetadata"
1009+
}
1010+
}
1011+
}
1012+
}
1013+
},
9861014
"/workspacebuilds/{workspacebuild}": {
9871015
"get": {
9881016
"security": [
@@ -2867,13 +2895,15 @@ const docTemplate = `{
28672895
"type": "integer"
28682896
},
28692897
"created_at": {
2870-
"type": "string"
2898+
"type": "string",
2899+
"format": "date-time"
28712900
},
28722901
"directory": {
28732902
"type": "string"
28742903
},
28752904
"disconnected_at": {
2876-
"type": "string"
2905+
"type": "string",
2906+
"format": "date-time"
28772907
},
28782908
"environment_variables": {
28792909
"type": "object",
@@ -2882,16 +2912,19 @@ const docTemplate = `{
28822912
}
28832913
},
28842914
"first_connected_at": {
2885-
"type": "string"
2915+
"type": "string",
2916+
"format": "date-time"
28862917
},
28872918
"id": {
2888-
"type": "string"
2919+
"type": "string",
2920+
"format": "uuid"
28892921
},
28902922
"instance_id": {
28912923
"type": "string"
28922924
},
28932925
"last_connected_at": {
2894-
"type": "string"
2926+
"type": "string",
2927+
"format": "date-time"
28952928
},
28962929
"latency": {
28972930
"description": "DERPLatency is mapped by region name (e.g. \"New York City\", \"Seattle\").",
@@ -2907,19 +2940,27 @@ const docTemplate = `{
29072940
"type": "string"
29082941
},
29092942
"resource_id": {
2910-
"type": "string"
2943+
"type": "string",
2944+
"format": "uuid"
29112945
},
29122946
"startup_script": {
29132947
"type": "string"
29142948
},
29152949
"status": {
2916-
"type": "string"
2950+
"type": "string",
2951+
"enum": [
2952+
"connecting",
2953+
"connected",
2954+
"disconnected",
2955+
"timeout"
2956+
]
29172957
},
29182958
"troubleshooting_url": {
29192959
"type": "string"
29202960
},
29212961
"updated_at": {
2922-
"type": "string"
2962+
"type": "string",
2963+
"format": "date-time"
29232964
},
29242965
"version": {
29252966
"type": "string"
@@ -2934,6 +2975,42 @@ const docTemplate = `{
29342975
}
29352976
}
29362977
},
2978+
"codersdk.WorkspaceAgentMetadata": {
2979+
"type": "object",
2980+
"properties": {
2981+
"apps": {
2982+
"type": "array",
2983+
"items": {
2984+
"$ref": "#/definitions/codersdk.WorkspaceApp"
2985+
}
2986+
},
2987+
"derpmap": {
2988+
"$ref": "#/definitions/tailcfg.DERPMap"
2989+
},
2990+
"directory": {
2991+
"type": "string"
2992+
},
2993+
"environment_variables": {
2994+
"type": "object",
2995+
"additionalProperties": {
2996+
"type": "string"
2997+
}
2998+
},
2999+
"git_auth_configs": {
3000+
"description": "GitAuthConfigs stores the number of Git configurations\nthe Coder deployment has. If this number is \u003e0, we\nset up special configuration in the workspace.",
3001+
"type": "integer"
3002+
},
3003+
"motd_file": {
3004+
"type": "string"
3005+
},
3006+
"startup_script": {
3007+
"type": "string"
3008+
},
3009+
"vscode_port_proxy_uri": {
3010+
"type": "string"
3011+
}
3012+
}
3013+
},
29373014
"codersdk.WorkspaceApp": {
29383015
"type": "object",
29393016
"properties": {
@@ -2960,10 +3037,16 @@ const docTemplate = `{
29603037
"type": "string"
29613038
},
29623039
"id": {
2963-
"type": "string"
3040+
"type": "string",
3041+
"format": "uuid"
29643042
},
29653043
"sharing_level": {
2966-
"type": "string"
3044+
"type": "string",
3045+
"enum": [
3046+
"owner",
3047+
"authenticated",
3048+
"public"
3049+
]
29673050
},
29683051
"slug": {
29693052
"description": "Slug is a unique identifier within the agent.",
@@ -3156,6 +3239,107 @@ const docTemplate = `{
31563239
},
31573240
"netip.Addr": {
31583241
"type": "object"
3242+
},
3243+
"tailcfg.DERPMap": {
3244+
"type": "object",
3245+
"properties": {
3246+
"omitDefaultRegions": {
3247+
"description": "OmitDefaultRegions specifies to not use Tailscale's DERP servers, and only use those\nspecified in this DERPMap. If there are none set outside of the defaults, this is a noop.",
3248+
"type": "boolean"
3249+
},
3250+
"regions": {
3251+
"description": "Regions is the set of geographic regions running DERP node(s).\n\nIt's keyed by the DERPRegion.RegionID.\n\nThe numbers are not necessarily contiguous.",
3252+
"type": "object",
3253+
"additionalProperties": {
3254+
"$ref": "#/definitions/tailcfg.DERPRegion"
3255+
}
3256+
}
3257+
}
3258+
},
3259+
"tailcfg.DERPNode": {
3260+
"type": "object",
3261+
"properties": {
3262+
"certName": {
3263+
"description": "CertName optionally specifies the expected TLS cert common\nname. If empty, HostName is used. If CertName is non-empty,\nHostName is only used for the TCP dial (if IPv4/IPv6 are\nnot present) + TLS ClientHello.",
3264+
"type": "string"
3265+
},
3266+
"derpport": {
3267+
"description": "DERPPort optionally provides an alternate TLS port number\nfor the DERP HTTPS server.\n\nIf zero, 443 is used.",
3268+
"type": "integer"
3269+
},
3270+
"forceHTTP": {
3271+
"description": "ForceHTTP is used by unit tests to force HTTP.\nIt should not be set by users.",
3272+
"type": "boolean"
3273+
},
3274+
"hostName": {
3275+
"description": "HostName is the DERP node's hostname.\n\nIt is required but need not be unique; multiple nodes may\nhave the same HostName but vary in configuration otherwise.",
3276+
"type": "string"
3277+
},
3278+
"insecureForTests": {
3279+
"description": "InsecureForTests is used by unit tests to disable TLS verification.\nIt should not be set by users.",
3280+
"type": "boolean"
3281+
},
3282+
"ipv4": {
3283+
"description": "IPv4 optionally forces an IPv4 address to use, instead of using DNS.\nIf empty, A record(s) from DNS lookups of HostName are used.\nIf the string is not an IPv4 address, IPv4 is not used; the\nconventional string to disable IPv4 (and not use DNS) is\n\"none\".",
3284+
"type": "string"
3285+
},
3286+
"ipv6": {
3287+
"description": "IPv6 optionally forces an IPv6 address to use, instead of using DNS.\nIf empty, AAAA record(s) from DNS lookups of HostName are used.\nIf the string is not an IPv6 address, IPv6 is not used; the\nconventional string to disable IPv6 (and not use DNS) is\n\"none\".",
3288+
"type": "string"
3289+
},
3290+
"name": {
3291+
"description": "Name is a unique node name (across all regions).\nIt is not a host name.\nIt's typically of the form \"1b\", \"2a\", \"3b\", etc. (region\nID + suffix within that region)",
3292+
"type": "string"
3293+
},
3294+
"regionID": {
3295+
"description": "RegionID is the RegionID of the DERPRegion that this node\nis running in.",
3296+
"type": "integer"
3297+
},
3298+
"stunonly": {
3299+
"description": "STUNOnly marks a node as only a STUN server and not a DERP\nserver.",
3300+
"type": "boolean"
3301+
},
3302+
"stunport": {
3303+
"description": "Port optionally specifies a STUN port to use.\nZero means 3478.\nTo disable STUN on this node, use -1.",
3304+
"type": "integer"
3305+
},
3306+
"stuntestIP": {
3307+
"description": "STUNTestIP is used in tests to override the STUN server's IP.\nIf empty, it's assumed to be the same as the DERP server.",
3308+
"type": "string"
3309+
}
3310+
}
3311+
},
3312+
"tailcfg.DERPRegion": {
3313+
"type": "object",
3314+
"properties": {
3315+
"avoid": {
3316+
"description": "Avoid is whether the client should avoid picking this as its home\nregion. The region should only be used if a peer is there.\nClients already using this region as their home should migrate\naway to a new region without Avoid set.",
3317+
"type": "boolean"
3318+
},
3319+
"embeddedRelay": {
3320+
"description": "EmbeddedRelay is true when the region is bundled with the Coder\ncontrol plane.",
3321+
"type": "boolean"
3322+
},
3323+
"nodes": {
3324+
"description": "Nodes are the DERP nodes running in this region, in\npriority order for the current client. Client TLS\nconnections should ideally only go to the first entry\n(falling back to the second if necessary). STUN packets\nshould go to the first 1 or 2.\n\nIf nodes within a region route packets amongst themselves,\nbut not to other regions. That said, each user/domain\nshould get a the same preferred node order, so if all nodes\nfor a user/network pick the first one (as they should, when\nthings are healthy), the inter-cluster routing is minimal\nto zero.",
3325+
"type": "array",
3326+
"items": {
3327+
"$ref": "#/definitions/tailcfg.DERPNode"
3328+
}
3329+
},
3330+
"regionCode": {
3331+
"description": "RegionCode is a short name for the region. It's usually a popular\ncity or airport code in the region: \"nyc\", \"sf\", \"sin\",\n\"fra\", etc.",
3332+
"type": "string"
3333+
},
3334+
"regionID": {
3335+
"description": "RegionID is a unique integer for a geographic region.\n\nIt corresponds to the legacy derpN.tailscale.com hostnames\nused by older clients. (Older clients will continue to resolve\nderpN.tailscale.com when contacting peers, rather than use\nthe server-provided DERPMap)\n\nRegionIDs must be non-zero, positive, and guaranteed to fit\nin a JavaScript number.\n\nRegionIDs in range 900-999 are reserved for end users to run their\nown DERP nodes.",
3336+
"type": "integer"
3337+
},
3338+
"regionName": {
3339+
"description": "RegionName is a long English name for the region: \"New York City\",\n\"San Francisco\", \"Singapore\", \"Frankfurt\", etc.",
3340+
"type": "string"
3341+
}
3342+
}
31593343
}
31603344
},
31613345
"securityDefinitions": {

0 commit comments

Comments
 (0)