mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
1949 lines
62 KiB
Go
1949 lines
62 KiB
Go
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
|
package docs
|
|
|
|
import "github.com/swaggo/swag"
|
|
|
|
const docTemplate = `{
|
|
"schemes": {{ marshal .Schemes }},
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "{{escape .Description}}",
|
|
"title": "{{.Title}}",
|
|
"contact": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/api/healthz": {
|
|
"get": {
|
|
"description": "Returns a 200 if the service is up",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"health"
|
|
],
|
|
"summary": "Basic health check",
|
|
"responses": {
|
|
"200": {
|
|
"description": "ok",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/admin/users": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Returns paginated list of users (admin only)",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"admin"
|
|
],
|
|
"summary": "Admin: list all users",
|
|
"parameters": [
|
|
{
|
|
"type": "integer",
|
|
"description": "Page number (1-based)",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "Page size (max 200)",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.ListUsersOut"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"admin"
|
|
],
|
|
"summary": "Admin: create user",
|
|
"parameters": [
|
|
{
|
|
"description": "payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.AdminCreateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.userOut"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/admin/users/{userId}": {
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"admin"
|
|
],
|
|
"summary": "Admin: delete user",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "User ID",
|
|
"name": "userId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"admin"
|
|
],
|
|
"summary": "Admin: update user",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "User ID",
|
|
"name": "userId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "payload",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.AdminUpdateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.userOut"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"409": {
|
|
"description": "conflict",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/introspect": {
|
|
"post": {
|
|
"description": "Returns whether the token is active and basic metadata",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Introspect a token",
|
|
"parameters": [
|
|
{
|
|
"description": "token",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/login": {
|
|
"post": {
|
|
"description": "Authenticates a user and returns a JWT bearer token",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Authenticate and return a token",
|
|
"parameters": [
|
|
{
|
|
"description": "User login input",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.LoginInput"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "token",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/logout": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Revoke a refresh token",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Logout user",
|
|
"parameters": [
|
|
{
|
|
"description": "refresh_token",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/logout_all": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Revokes all active refresh tokens for the authenticated user",
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Logout from all sessions",
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/me": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Returns the authenticated user's profile and auth context",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Get authenticated user info",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.MeResponse"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/password/change": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Changes the password for the authenticated user",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Change password",
|
|
"parameters": [
|
|
{
|
|
"description": "current_password, new_password",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/password/forgot": {
|
|
"post": {
|
|
"description": "Sends a reset token to the user's email address",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Request password reset",
|
|
"parameters": [
|
|
{
|
|
"description": "email",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/password/reset": {
|
|
"post": {
|
|
"description": "Resets the password using a valid reset token",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Confirm password reset",
|
|
"parameters": [
|
|
{
|
|
"description": "token, new_password",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/refresh": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Use a refresh token to obtain a new access token",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Refresh access token",
|
|
"parameters": [
|
|
{
|
|
"description": "refresh_token",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "new access token",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/refresh/rotate": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Exchanges a valid refresh token for a new access and refresh token, revoking the old one",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Rotate refresh token",
|
|
"parameters": [
|
|
{
|
|
"description": "refresh_token",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "access_token, refresh_token",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/register": {
|
|
"post": {
|
|
"description": "Registers a new user and stores credentials",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Register a new user",
|
|
"parameters": [
|
|
{
|
|
"description": "User registration input",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/authn.RegisterInput"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "created",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/verify": {
|
|
"get": {
|
|
"description": "Verifies the user's email using a token (often from an emailed link)",
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Verify email address",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "verification token",
|
|
"name": "token",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/auth/verify/resend": {
|
|
"post": {
|
|
"description": "Sends a new email verification token if needed",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Resend email verification",
|
|
"parameters": [
|
|
{
|
|
"description": "email",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "no content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/orgs": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "List organizations for user",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/models.Organization"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Creates a new organization and assigns the authenticated user as an admin member",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "Create a new organization",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Optional organization context (ignored for creation)",
|
|
"name": "X-Org-ID",
|
|
"in": "header"
|
|
},
|
|
{
|
|
"description": "Organization Input",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/orgs.OrgInput"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "organization_id",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid input",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "internal error",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/orgs/invite": {
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "Invite user to organization",
|
|
"parameters": [
|
|
{
|
|
"description": "Invite input",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/orgs.InviteInput"
|
|
}
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Organization context",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "invited",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "bad request",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/orgs/members": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Returns a list of all members in the current organization",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "List organization members",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization context",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/models.Member"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/orgs/members/{userId}": {
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "Remove member from organization",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "User ID",
|
|
"name": "userId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "deleted",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/orgs/{orgId}": {
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "Delete organization",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization ID",
|
|
"name": "orgId",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "deleted",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"organizations"
|
|
],
|
|
"summary": "Update organization metadata",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Org ID",
|
|
"name": "orgId",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Organization data",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/orgs.OrgInput"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/models.Organization"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "forbidden",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/ssh": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Returns ssh keys for the organization in X-Org-ID.",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"ssh"
|
|
],
|
|
"summary": "List ssh keys (org scoped)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization UUID",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/ssh.sshResponse"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "organization required",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "failed to list keys",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Generates an RSA keypair, saves it, and returns metadata. Optionally set ` + "`" + `download` + "`" + ` to \"public\", \"private\", or \"both\" to download files immediately.",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"ssh"
|
|
],
|
|
"summary": "Create ssh keypair (org scoped)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization UUID",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"description": "Key generation options",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/ssh.createSSHRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"$ref": "#/definitions/ssh.sshResponse"
|
|
},
|
|
"headers": {
|
|
"Content-Disposition": {
|
|
"type": "string",
|
|
"description": "When download is requested"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid json / invalid bits",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "organization required",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "generation/create failed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/ssh/{id}": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Returns public key fields. Append ` + "`" + `?reveal=true` + "`" + ` to include the private key PEM.",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"ssh"
|
|
],
|
|
"summary": "Get ssh key by ID (org scoped)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization UUID",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "SSH Key ID (UUID)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "boolean",
|
|
"description": "Reveal private key PEM",
|
|
"name": "reveal",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "When reveal=true",
|
|
"schema": {
|
|
"$ref": "#/definitions/ssh.sshRevealResponse"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid id",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "organization required",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "fetch failed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Permanently deletes a keypair.",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"ssh"
|
|
],
|
|
"summary": "Delete ssh keypair (org scoped)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization UUID",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "SSH Key ID (UUID)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "No Content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid id",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "organization required",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "delete failed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/ssh/{id}/download": {
|
|
"get": {
|
|
"security": [
|
|
{
|
|
"BearerAuth": []
|
|
}
|
|
],
|
|
"description": "Download ` + "`" + `part=public|private|both` + "`" + ` of the keypair. ` + "`" + `both` + "`" + ` returns a zip file.",
|
|
"produces": [
|
|
"text/plain"
|
|
],
|
|
"tags": [
|
|
"ssh"
|
|
],
|
|
"summary": "Download ssh key files by ID (org scoped)",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Organization UUID",
|
|
"name": "X-Org-ID",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "SSH Key ID (UUID)",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
},
|
|
{
|
|
"enum": [
|
|
"public",
|
|
"private",
|
|
"both"
|
|
],
|
|
"type": "string",
|
|
"description": "Which part to download",
|
|
"name": "part",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "file content",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "invalid id / invalid part",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "organization required",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "not found",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "download failed",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"authn.AdminCreateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string",
|
|
"example": "jane@example.com"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "Jane Doe"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"example": "Secret123!"
|
|
},
|
|
"role": {
|
|
"description": "Role allowed values: \"user\" or \"admin\"",
|
|
"type": "string",
|
|
"enum": [
|
|
"user",
|
|
"admin"
|
|
],
|
|
"example": "user"
|
|
}
|
|
}
|
|
},
|
|
"authn.AdminUpdateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string",
|
|
"example": "jane@example.com"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "Jane Doe"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"example": "NewSecret123!"
|
|
},
|
|
"role": {
|
|
"type": "string",
|
|
"enum": [
|
|
"user",
|
|
"admin"
|
|
],
|
|
"example": "admin"
|
|
}
|
|
}
|
|
},
|
|
"authn.AuthClaimsDTO": {
|
|
"type": "object",
|
|
"properties": {
|
|
"aud": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"exp": {
|
|
"type": "integer"
|
|
},
|
|
"iat": {
|
|
"type": "integer"
|
|
},
|
|
"iss": {
|
|
"type": "string"
|
|
},
|
|
"nbf": {
|
|
"type": "integer"
|
|
},
|
|
"orgs": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"roles": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"sub": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"authn.ListUsersOut": {
|
|
"type": "object",
|
|
"properties": {
|
|
"page": {
|
|
"type": "integer"
|
|
},
|
|
"page_size": {
|
|
"type": "integer"
|
|
},
|
|
"total": {
|
|
"type": "integer"
|
|
},
|
|
"users": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/authn.UserListItem"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"authn.LoginInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string",
|
|
"example": "me@here.com"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"example": "123456"
|
|
}
|
|
}
|
|
},
|
|
"authn.MeResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"claims": {
|
|
"$ref": "#/definitions/authn.AuthClaimsDTO"
|
|
},
|
|
"org_role": {
|
|
"type": "string"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"user_id": {
|
|
"$ref": "#/definitions/authn.UserDTO"
|
|
}
|
|
}
|
|
},
|
|
"authn.RegisterInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string",
|
|
"example": "me@here.com"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "My Name"
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"example": "123456"
|
|
}
|
|
}
|
|
},
|
|
"authn.UserDTO": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"email_verified": {
|
|
"type": "boolean"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"$ref": "#/definitions/models.Role"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"authn.UserListItem": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"email_verified": {
|
|
"type": "boolean"
|
|
},
|
|
"id": {},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {}
|
|
}
|
|
},
|
|
"authn.userOut": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"email_verified": {
|
|
"type": "boolean"
|
|
},
|
|
"id": {},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {}
|
|
}
|
|
},
|
|
"models.Member": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"organization": {
|
|
"$ref": "#/definitions/models.Organization"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"description": "e.g. admin, member",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/models.MemberRole"
|
|
}
|
|
]
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
},
|
|
"user": {
|
|
"$ref": "#/definitions/models.User"
|
|
},
|
|
"user_id": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.MemberRole": {
|
|
"type": "string",
|
|
"enum": [
|
|
"admin",
|
|
"member",
|
|
"user"
|
|
],
|
|
"x-enum-varnames": [
|
|
"MemberRoleAdmin",
|
|
"MemberRoleMember",
|
|
"MemberRoleUser"
|
|
]
|
|
},
|
|
"models.Organization": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"logo": {
|
|
"type": "string"
|
|
},
|
|
"metadata": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"slug": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"models.Role": {
|
|
"type": "string",
|
|
"enum": [
|
|
"admin",
|
|
"user"
|
|
],
|
|
"x-enum-varnames": [
|
|
"RoleAdmin",
|
|
"RoleUser"
|
|
]
|
|
},
|
|
"models.User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"email_verified": {
|
|
"type": "boolean"
|
|
},
|
|
"email_verified_at": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"$ref": "#/definitions/models.Role"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"orgs.InviteInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"role": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"orgs.OrgInput": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"slug": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"ssh.createSSHRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"bits": {
|
|
"type": "integer",
|
|
"example": 4096
|
|
},
|
|
"comment": {
|
|
"type": "string",
|
|
"example": "deploy@autoglue"
|
|
},
|
|
"download": {
|
|
"type": "string",
|
|
"example": "both"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"ssh.sshResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"fingerprint": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"public_keys": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"ssh.sshRevealResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"created_at": {
|
|
"type": "string"
|
|
},
|
|
"fingerprint": {
|
|
"type": "string"
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"organization_id": {
|
|
"type": "string"
|
|
},
|
|
"private_key": {
|
|
"type": "string"
|
|
},
|
|
"public_keys": {
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"BearerAuth": {
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "1.0",
|
|
Host: "",
|
|
BasePath: "/",
|
|
Schemes: []string{"http"},
|
|
Title: "AutoGlue API",
|
|
Description: "API for managing K3s clusters across cloud providers",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|