8000 docs: API templateversions, templates, members, organizations by mtojek · Pull Request #5546 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

docs: API templateversions, templates, members, organizations #5546

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

Merged
merged 26 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
/workspaces
  • Loading branch information
mtojek committed Jan 3, 2023
commit f37c6b3ce2d77b66334e3f5c37960d56d62fcec4
146 changes: 146 additions & 0 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,112 @@ const docTemplate = `{
}
}
},
"/workspaces/{id}/builds": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Builds"
],
"summary": "Get workspace builds by workspace ID",
"operationId": "get-workspace-builds-by-workspace-id",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "After ID",
"name": "after_id",
"in": "query"
},
{
"type": "integer",
"description": "Page limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Page offset",
"name": "offset",
"in": "query"
},
{
"type": "string",
"format": "date-time",
"description": "Since timestamp",
"name": "since",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.WorkspaceBuild"
}
}
}
}
},
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": [
"application/json"
],
"tags": [
"Builds"
],
"summary": "Create workspace build",
"operationId": "create-workspace-build",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Create workspace build request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.CreateWorkspaceBuildRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceBuild"
}
}
}
}
},
"/workspaces/{workspace}": {
"patch": {
"security": [
Expand Down Expand Up @@ -2104,6 +2210,46 @@ const docTemplate = `{
}
}
},
"codersdk.CreateWorkspaceBuildRequest": {
"type": "object",
"required": [
"transition"
],
"properties": {
"dry_run": {
"type": "boolean"
},
"orphan": {
"description": "Orphan may be set for the Destroy transition.",
"type": "boolean"
},
"parameter_values": {
"description": "ParameterValues are optional. It will write params to the 'workspace' scope.\nThis will overwrite any existing parameters with the same name.\nThis will not delete old params not included in this list.",
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.CreateParameterRequest"
}
},
"state": {
"type": "array",
"items": {
"type": "integer"
}
},
"template_version_id": {
"type": "string"
},
"transition": {
"type": "string",
"enum": [
"create",
"start",
"stop",
"delete"
]
}
}
},
"codersdk.DERP": {
"type": "object",
"properties": {
Expand Down
131 changes: 131 additions & 0 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,104 @@
}
}
},
"/workspaces/{id}/builds": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Builds"],
"summary": "Get workspace builds by workspace ID",
"operationId": "get-workspace-builds-by-workspace-id",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"format": "uuid",
"description": "After ID",
"name": "after_id",
"in": "query"
},
{
"type": "integer",
"description": "Page limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Page offset",
"name": "offset",
"in": "query"
},
{
"type": "string",
"format": "date-time",
"description": "Since timestamp",
"name": "since",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.WorkspaceBuild"
}
}
}
}
},
"post": {
"security": [
{
"CoderSessionToken": []
}
],
"produces": ["application/json"],
"tags": ["Builds"],
"summary": "Create workspace build",
"operationId": "create-workspace-build",
"parameters": [
{
"type": "string",
"format": "uuid",
"description": "Workspace ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Create workspace build request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/codersdk.CreateWorkspaceBuildRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.WorkspaceBuild"
}
}
}
}
},
"/workspaces/{workspace}": {
"patch": {
"security": [
Expand Down Expand Up @@ -1852,6 +1950,39 @@
}
}
},
"codersdk.CreateWorkspaceBuildRequest": {
"type": "object",
"required": ["transition"],
"properties": {
"dry_run": {
"type": "boolean"
},
"orphan": {
"description": "Orphan may be set for the Destroy transition.",
"type": "boolean"
},
"parameter_values": {
"description": "ParameterValues are optional. It will write params to the 'workspace' scope.\nThis will overwrite any existing parameters with the same name.\nThis will not delete old params not included in this list.",
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.CreateParameterRequest"
}
},
"state": {
"type": "array",
"items": {
"type": "integer"
}
},
"template_version_id": {
"type": "string"
},
"transition": {
"type": "string",
"enum": ["create", "start", "stop", "delete"]
}
}
},
"codersdk.DERP": {
"type": "object",
"properties": {
Expand Down
25 changes: 25 additions & 0 deletions coderd/workspacebuilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ func (api *API) workspaceBuild(rw http.ResponseWriter, r *http.Request) {
httpapi.Write(ctx, rw, http.StatusOK, apiBuild)
}

// @Summary Get workspace builds by workspace ID
// @ID get-workspace-builds-by-workspace-id
// @Security CoderSessionToken
// @Produce json
// @Tags Builds
// @Param id path string true "Workspace ID" format(uuid)
// @Param after_id query string false "After ID" format(uuid)
// @Param limit query int false "Page limit"
// @Param offset query int false "Page offset"
// @Param since query string false "Since timestamp" format(date-time)
// @Success 200 {array} codersdk.WorkspaceBuild
// @Router /workspaces/{id}/builds [get]
func (api *API) workspaceBuilds(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
workspace := httpmw.WorkspaceParam(r)
Expand Down Expand Up @@ -262,6 +274,19 @@ func (api *API) workspaceBuildByBuildNumber(rw http.ResponseWriter, r *http.Requ
httpapi.Write(ctx, rw, http.StatusOK, apiBuild)
}

// @Summary Create workspace build
// @ID create-workspace-build
// @Security CoderSessionToken
// @Accepts json
// @Produce json
// @Tags Builds
// @Param id path string true "Workspace ID" format(uuid)
// @Param request body codersdk.CreateWorkspaceBuildRequest true "Create workspace build request"
// @Success 200 {object} codersdk.WorkspaceBuild
// @Router /workspaces/{id}/builds [post]
//
// Azure supports instance identity verification:
// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service?tabs=linux#tabgroup_14
func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
apiKey := httpmw.APIKey(r)
Expand Down
16 changes: 8 additions & 8 deletions coderd/workspaceresourceauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func (api *API) postWorkspaceAuthAzureInstanceIdentity(rw http.ResponseWriter, r
api.handleAuthInstanceID(rw, r, instanceID)
}

// AWS supports instance identity verification:
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
// Using this, we can exchange a signed instance payload for an agent token.
//
// @Summary Authenticate agent on AWS instance
// @ID authenticate-agent-on-aws-instance
// @Security CoderSessionToken
Expand All @@ -57,6 +53,10 @@ func (api *API) postWorkspaceAuthAzureInstanceIdentity(rw http.ResponseWriter, r
// @Param request body codersdk.AWSInstanceIdentityToken true "Instance identity token"
// @Success 200 {object} codersdk.WorkspaceAgentAuthenticateResponse
// @Router /workspaceagents/aws-instance-identity [post]
//
// AWS supports instance identity verification:
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
// Using this, we can exchange a signed instance payload for an agent token.
func (api *API) postWorkspaceAuthAWSInstanceIdentity(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
var req codersdk.AWSInstanceIdentityToken
Expand All @@ -74,10 +74,6 @@ func (api *API) postWorkspaceAuthAWSInstanceIdentity(rw http.ResponseWriter, r *
api.handleAuthInstanceID(rw, r, identity.InstanceID)
}

// Google Compute Engine supports instance identity verification:
// https://cloud.google.com/compute/docs/instances/verifying-instance-identity
// Using this, we can exchange a signed instance payload for an agent token.
//
// @Summary Authenticate agent on Google Cloud instance
// @ID authenticate-agent-on-google-cloud-instance
// @Security CoderSessionToken
Expand All @@ -86,6 +82,10 @@ func (api *API) postWorkspaceAuthAWSInstanceIdentity(rw http.ResponseWriter, r *
// @Param request body codersdk.GoogleInstanceIdentityToken true "Instance identity token"
// @Success 200 {object} codersdk.WorkspaceAgentAuthenticateResponse
// @Router /workspaceagents/google-instance-identity [post]
//
// Google Compute Engine supports instance identity verification:
// https://cloud.google.com/compute/docs/instances/verifying-instance-identity
// Using this, we can exchange a signed instance payload for an agent token.
func (api *API) postWorkspaceAuthGoogleInstanceIdentity(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
var req codersdk.GoogleInstanceIdentityToken
Expand Down
Loading
0