Correct API reference endpoint details/params for secrets, folders, environments, secret imports

This commit is contained in:
Tuan Dang
2023-11-08 15:58:18 +02:00
parent cae7e1808d
commit 5ee79be873
19 changed files with 1367 additions and 808 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,7 @@ import { ForbiddenError, subject } from "@casl/ability";
export const createSecretImp = async (req: Request, res: Response) => { export const createSecretImp = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Create secret import' #swagger.summary = 'Create secret import'
#swagger.description = 'Create a new secret import for a specified workspace and environment' #swagger.description = 'Create secret import'
#swagger.requestBody = { #swagger.requestBody = {
content: { content: {
@@ -32,36 +32,36 @@ export const createSecretImp = async (req: Request, res: Response) => {
"properties": { "properties": {
"workspaceId": { "workspaceId": {
"type": "string", "type": "string",
"description": "ID of the workspace where the secret import will be created", "description": "ID of workspace where to create secret import",
"example": "someWorkspaceId" "example": "someWorkspaceId"
}, },
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Environment to import to", "description": "Slug of environment where to create secret import",
"example": "production" "example": "dev"
}, },
"folderId": { "directory": {
"type": "string", "type": "string",
"description": "Folder ID. Use root for the root folder.", "description": "Path where to create secret import like / or /foo/bar. Default is /",
"example": "my_folder" "example": "/foo/bar"
}, },
"secretImport": { "secretImport": {
"type": "object", "type": "object",
"properties": { "properties": {
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Import from environment", "description": "Slug of environment to import from",
"example": "development" "example": "development"
}, },
"secretPath": { "secretPath": {
"type": "string", "type": "string",
"description": "Import from secret path", "description": "Path where to import from like / or /foo/bar.",
"example": "/user/oauth" "example": "/user/oauth"
} }
} }
} }
}, },
"required": ["workspaceId", "environment", "folderName"] "required": ["workspaceId", "environment", "directory", "secretImport"]
} }
} }
} }
@@ -206,12 +206,12 @@ export const createSecretImp = async (req: Request, res: Response) => {
*/ */
export const updateSecretImport = async (req: Request, res: Response) => { export const updateSecretImport = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Update a secret import' #swagger.summary = 'Update secret import'
#swagger.description = 'Updates an existing secret import based on the provided ID and new import details' #swagger.description = 'Update secret import'
#swagger.parameters['id'] = { #swagger.parameters['id'] = {
in: 'path', in: 'path',
description: 'ID of the secret import to be updated', description: 'ID of secret import to update',
required: true, required: true,
type: 'string', type: 'string',
example: 'import12345' example: 'import12345'
@@ -225,19 +225,19 @@ export const updateSecretImport = async (req: Request, res: Response) => {
"properties": { "properties": {
"secretImports": { "secretImports": {
"type": "array", "type": "array",
"description": "List of new secret imports", "description": "List of secret imports to update to",
"items": { "items": {
"type": "object", "type": "object",
"properties": { "properties": {
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Environment of the secret import", "description": "Slug of environment to import from",
"example": "production" "example": "dev"
}, },
"secretPath": { "secretPath": {
"type": "string", "type": "string",
"description": "Path of the secret import", "description": "Path where to import secrets from like / or /foo/bar",
"example": "/path/to/secret" "example": "/foo/bar"
} }
}, },
"required": ["environment", "secretPath"] "required": ["environment", "secretPath"]
@@ -364,7 +364,7 @@ export const deleteSecretImport = async (req: Request, res: Response) => {
#swagger.parameters['id'] = { #swagger.parameters['id'] = {
in: 'path', in: 'path',
description: 'ID of the secret import', description: 'ID of parent secret import document from which to delete secret import',
required: true, required: true,
type: 'string', type: 'string',
example: '12345abcde' example: '12345abcde'
@@ -378,12 +378,12 @@ export const deleteSecretImport = async (req: Request, res: Response) => {
"properties": { "properties": {
"secretImportEnv": { "secretImportEnv": {
"type": "string", "type": "string",
"description": "Import from environment", "description": "Slug of environment of import to delete",
"example": "someWorkspaceId" "example": "someWorkspaceId"
}, },
"secretImportPath": { "secretImportPath": {
"type": "string", "type": "string",
"description": "Import from secret path", "description": "Path like / or /foo/bar of import to delete",
"example": "production" "example": "production"
} }
}, },
@@ -489,12 +489,12 @@ export const deleteSecretImport = async (req: Request, res: Response) => {
*/ */
export const getSecretImports = async (req: Request, res: Response) => { export const getSecretImports = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Retrieve secret imports' #swagger.summary = 'Get secret imports'
#swagger.description = 'Fetches the secret imports based on the workspaceId, environment, and folderId' #swagger.description = 'Get secret imports'
#swagger.parameters['workspaceId'] = { #swagger.parameters['workspaceId'] = {
in: 'query', in: 'query',
description: 'ID of the workspace of secret imports to get', description: 'ID of workspace where to get secret imports from',
required: true, required: true,
type: 'string', type: 'string',
example: 'workspace12345' example: 'workspace12345'
@@ -502,15 +502,15 @@ export const getSecretImports = async (req: Request, res: Response) => {
#swagger.parameters['environment'] = { #swagger.parameters['environment'] = {
in: 'query', in: 'query',
description: 'Environment of secret imports to get', description: 'Slug of environment where to get secret imports from',
required: true, required: true,
type: 'string', type: 'string',
example: 'production' example: 'production'
} }
#swagger.parameters['folderId'] = { #swagger.parameters['directory'] = {
in: 'query', in: 'query',
description: 'ID of the folder containing the secret imports. Default: root', description: 'Path where to get secret imports from like / or /foo/bar. Default is /',
required: false, required: false,
type: 'string', type: 'string',
example: 'folder12345' example: 'folder12345'

View File

@@ -27,11 +27,12 @@ const ERR_FOLDER_NOT_FOUND = BadRequestError({ message: "The folder doesn't exis
// verify workspace id/environment // verify workspace id/environment
export const createFolder = async (req: Request, res: Response) => { export const createFolder = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Create a folder' #swagger.summary = 'Create folder'
#swagger.description = 'Create a new folder in a specified workspace and environment' #swagger.description = 'Create folder'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
"bearerAuth": []
}] }]
#swagger.requestBody = { #swagger.requestBody = {
@@ -42,23 +43,23 @@ export const createFolder = async (req: Request, res: Response) => {
"properties": { "properties": {
"workspaceId": { "workspaceId": {
"type": "string", "type": "string",
"description": "ID of the workspace where the folder will be created", "description": "ID of the workspace where to create folder",
"example": "someWorkspaceId" "example": "someWorkspaceId"
}, },
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Environment where the folder will reside", "description": "Slug of environment where to create folder",
"example": "production" "example": "production"
}, },
"folderName": { "folderName": {
"type": "string", "type": "string",
"description": "Name of the folder to be created", "description": "Name of folder to create",
"example": "my_folder" "example": "my_folder"
}, },
"parentFolderId": { "directory": {
"type": "string", "type": "string",
"description": "ID of the parent folder under which this folder will be created. If not specified, it will be created at the root level.", "description": "Path where to create folder like / or /foo/bar. Default is /",
"example": "someParentFolderId" "example": "/foo/bar"
} }
}, },
"required": ["workspaceId", "environment", "folderName"] "required": ["workspaceId", "environment", "folderName"]
@@ -219,18 +220,18 @@ export const createFolder = async (req: Request, res: Response) => {
*/ */
export const updateFolderById = async (req: Request, res: Response) => { export const updateFolderById = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Update a folder by ID' #swagger.summary = 'Update folder'
#swagger.description = 'Update the name of a folder in a specified workspace and environment by its ID' #swagger.description = 'Update folder'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
"bearerAuth": []
}] }]
#swagger.parameters['folderId'] = { #swagger.parameters['folderName'] = {
"description": "ID of the folder to be updated", "description": "Name of folder to update",
"required": true, "required": true,
"type": "string", "type": "string"
"in": "path"
} }
#swagger.requestBody = { #swagger.requestBody = {
@@ -241,18 +242,23 @@ export const updateFolderById = async (req: Request, res: Response) => {
"properties": { "properties": {
"workspaceId": { "workspaceId": {
"type": "string", "type": "string",
"description": "ID of the workspace where the folder is located", "description": "ID of workspace where to update folder",
"example": "someWorkspaceId" "example": "someWorkspaceId"
}, },
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Environment where the folder is located", "description": "Slug of environment where to update folder",
"example": "production" "example": "production"
}, },
"name": { "name": {
"type": "string", "type": "string",
"description": "New name for the folder", "description": "Name of folder to update to",
"example": "updated_folder_name" "example": "updated_folder_name"
},
"directory": {
"type": "string",
"description": "Path where to update folder like / or /foo/bar. Default is /",
"example": "/foo/bar"
} }
}, },
"required": ["workspaceId", "environment", "name"] "required": ["workspaceId", "environment", "name"]
@@ -387,15 +393,16 @@ export const updateFolderById = async (req: Request, res: Response) => {
*/ */
export const deleteFolder = async (req: Request, res: Response) => { export const deleteFolder = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Delete a folder by ID' #swagger.summary = 'Delete folder'
#swagger.description = 'Delete the specified folder from a specified workspace and environment using its ID' #swagger.description = 'Delete folder'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
"bearerAuth": []
}] }]
#swagger.parameters['folderId'] = { #swagger.parameters['folderName'] = {
"description": "ID of the folder to be deleted", "description": "Name of folder to delete",
"required": true, "required": true,
"type": "string", "type": "string",
"in": "path" "in": "path"
@@ -409,13 +416,18 @@ export const deleteFolder = async (req: Request, res: Response) => {
"properties": { "properties": {
"workspaceId": { "workspaceId": {
"type": "string", "type": "string",
"description": "ID of the workspace where the folder is located", "description": "ID of the workspace where to delete folder",
"example": "someWorkspaceId" "example": "someWorkspaceId"
}, },
"environment": { "environment": {
"type": "string", "type": "string",
"description": "Environment where the folder is located", "description": "Slug of environment where to delete folder",
"example": "production" "example": "production"
},
"directory": {
"type": "string",
"description": "Path where to delete folder like / or /foo/bar. Default is /",
"example": "/foo/bar"
} }
}, },
"required": ["workspaceId", "environment"] "required": ["workspaceId", "environment"]
@@ -540,43 +552,37 @@ export const deleteFolder = async (req: Request, res: Response) => {
/** /**
* Get folders for workspace with id [workspaceId] and environment [environment] * Get folders for workspace with id [workspaceId] and environment [environment]
* considering [parentFolderId] and [parentFolderPath] * considering directory/path [directory]
* @param req * @param req
* @param res * @param res
* @returns * @returns
*/ */
export const getFolders = async (req: Request, res: Response) => { export const getFolders = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Retrieve folders based on specific conditions' #swagger.summary = 'Get folders'
#swagger.description = 'Fetches folders from the specified workspace and environment, optionally providing either a parentFolderId or a parentFolderPath to narrow down results' #swagger.description = 'Get folders'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
"bearerAuth": []
}] }]
#swagger.parameters['workspaceId'] = { #swagger.parameters['workspaceId'] = {
"description": "ID of the workspace from which the folders are to be fetched", "description": "ID of the workspace where to get folders from",
"required": true, "required": true,
"type": "string", "type": "string",
"in": "query" "in": "query"
} }
#swagger.parameters['environment'] = { #swagger.parameters['environment'] = {
"description": "Environment where the folder is located", "description": "Slug of environment where to get folders from",
"required": true, "required": true,
"type": "string", "type": "string",
"in": "query" "in": "query"
} }
#swagger.parameters['parentFolderId'] = { #swagger.parameters['directory'] = {
"description": "ID of the parent folder", "description": "Path where to get fodlers from like / or /foo/bar. Default is /",
"required": false,
"type": "string",
"in": "query"
}
#swagger.parameters['parentFolderPath'] = {
"description": "Path of the parent folder, like /folder1/folder2",
"required": false, "required": false,
"type": "string", "type": "string",
"in": "query" "in": "query"
@@ -604,23 +610,6 @@ export const getFolders = async (req: Request, res: Response) => {
} }
}, },
"description": "List of folders" "description": "List of folders"
},
"dir": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "parentFolderName"
},
"id": {
"type": "string",
"example": "parentFolderId"
}
}
},
"description": "List of directories"
} }
} }
} }

View File

@@ -38,29 +38,16 @@ export const createWorkspaceEnvironment = async (req: Request, res: Response) =>
#swagger.description = 'Create environment' #swagger.description = 'Create environment'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
}] }]
#swagger.parameters['workspaceId'] = { #swagger.parameters['workspaceId'] = {
"description": "ID of project", "description": "ID of workspace where to create environment",
"required": true, "required": true,
"type": "string" "type": "string",
"in": "path"
} }
/*
#swagger.summary = 'Create environment'
#swagger.description = 'Create environment'
#swagger.security = [{
"apiKeyAuth": []
}]
#swagger.parameters['workspaceId'] = {
"description": "ID of project",
"required": true,
"type": "string"
}
#swagger.requestBody = { #swagger.requestBody = {
content: { content: {
"application/json": { "application/json": {
@@ -69,12 +56,12 @@ export const createWorkspaceEnvironment = async (req: Request, res: Response) =>
"properties": { "properties": {
"environmentName": { "environmentName": {
"type": "string", "type": "string",
"description": "Name of the environment", "description": "Name of the environment to create",
"example": "development" "example": "development"
}, },
"environmentSlug": { "environmentSlug": {
"type": "string", "type": "string",
"description": "Slug of the environment", "description": "Slug of environment to create",
"example": "dev-environment" "example": "dev-environment"
} }
}, },
@@ -83,40 +70,6 @@ export const createWorkspaceEnvironment = async (req: Request, res: Response) =>
} }
} }
} }
#swagger.responses[200] = {
content: {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Successfully created new environment"
},
"workspace": {
"type": "string",
"example": "someWorkspaceId"
},
"environment": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "someEnvironmentName"
},
"slug": {
"type": "string",
"example": "someEnvironmentSlug"
}
}
}
},
"description": "Response after creating a new environment"
}
}
}
}
*/ */
const { const {
params: { workspaceId }, params: { workspaceId },
@@ -246,15 +199,19 @@ export const reorderWorkspaceEnvironments = async (req: Request, res: Response)
*/ */
export const renameWorkspaceEnvironment = async (req: Request, res: Response) => { export const renameWorkspaceEnvironment = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Rename workspace environment' #swagger.summary = 'Update environment'
#swagger.description = 'Rename a specific environment within a workspace' #swagger.description = 'Update environment'
#swagger.security = [{
"apiKeyAuth": [],
}]
#swagger.parameters['workspaceId'] = { #swagger.parameters['workspaceId'] = {
"description": "ID of the workspace", "description": "ID of workspace where to update environment",
"required": true, "required": true,
"type": "string", "type": "string",
"in": "path" "in": "path"
} }
#swagger.requestBody = { #swagger.requestBody = {
content: { content: {
@@ -264,17 +221,17 @@ export const renameWorkspaceEnvironment = async (req: Request, res: Response) =>
"properties": { "properties": {
"environmentName": { "environmentName": {
"type": "string", "type": "string",
"description": "New name for the environment", "description": "Name of environment to update to",
"example": "Staging-Renamed" "example": "Staging-Renamed"
}, },
"environmentSlug": { "environmentSlug": {
"type": "string", "type": "string",
"description": "New slug for the environment", "description": "Slug of environment to update to",
"example": "staging-renamed" "example": "staging-renamed"
}, },
"oldEnvironmentSlug": { "oldEnvironmentSlug": {
"type": "string", "type": "string",
"description": "Current slug of the environment to rename", "description": "Current slug of environment",
"example": "staging-old" "example": "staging-old"
} }
}, },
@@ -447,19 +404,20 @@ export const renameWorkspaceEnvironment = async (req: Request, res: Response) =>
*/ */
export const deleteWorkspaceEnvironment = async (req: Request, res: Response) => { export const deleteWorkspaceEnvironment = async (req: Request, res: Response) => {
/* /*
#swagger.summary = 'Delete workspace environment' #swagger.summary = 'Delete environment'
#swagger.description = 'Delete a specific environment from a workspace' #swagger.description = 'Delete environment'
#swagger.security = [{ #swagger.security = [{
"apiKeyAuth": [] "apiKeyAuth": [],
"bearerAuth": []
}] }]
#swagger.parameters['workspaceId'] = { #swagger.parameters['workspaceId'] = {
"description": "ID of the workspace", "description": "ID of workspace where to delete environment",
"required": true, "required": true,
"type": "string", "type": "string",
"in": "path" "in": "path"
} }
#swagger.requestBody = { #swagger.requestBody = {
content: { content: {
@@ -469,8 +427,8 @@ export const deleteWorkspaceEnvironment = async (req: Request, res: Response) =>
"properties": { "properties": {
"environmentSlug": { "environmentSlug": {
"type": "string", "type": "string",
"description": "Slug of the environment to delete", "description": "Slug of environment to delete",
"example": "dev-environment" "example": "dev"
} }
}, },
"required": ["environmentSlug"] "required": ["environmentSlug"]

View File

@@ -8,7 +8,7 @@ import { encryptSymmetric128BitHexKeyUTF8 } from "../../utils/crypto";
import { getAllImportedSecrets } from "../../services/SecretImportService"; import { getAllImportedSecrets } from "../../services/SecretImportService";
import { Folder, IMembership, IServiceTokenData, IServiceTokenDataV3 } from "../../models"; import { Folder, IMembership, IServiceTokenData, IServiceTokenDataV3 } from "../../models";
import { Permission } from "../../models/serviceTokenDataV3"; import { Permission } from "../../models/serviceTokenDataV3";
import { getFolderByPath, getFolderWithPathFromId } from "../../services/FolderService"; import { getFolderByPath } from "../../services/FolderService";
import { BadRequestError } from "../../utils/errors"; import { BadRequestError } from "../../utils/errors";
import { validateRequest } from "../../helpers/validation"; import { validateRequest } from "../../helpers/validation";
import * as reqValidator from "../../validation/secrets"; import * as reqValidator from "../../validation/secrets";
@@ -135,6 +135,43 @@ const checkSecretsPermission = async ({
* @param res * @param res
*/ */
export const getSecretsRaw = async (req: Request, res: Response) => { export const getSecretsRaw = async (req: Request, res: Response) => {
/*
#swagger.summary = 'List secrets'
#swagger.description = 'List secrets'
#swagger.security = [{
"apiKeyAuth": [],
"bearerAuth": []
}]
#swagger.parameters['workspaceId'] = {
"description": "ID of workspace where to get secrets from",
"required": true,
"type": "string",
"in": "query"
}
#swagger.parameters['environment'] = {
"description": "Slug of environment where to get secrets from",
"required": true,
"type": "string",
"in": "query"
}
#swagger.parameters['secretPath'] = {
"description": "Path where to update secret like / or /foo/bar. Default is /",
"required": false,
"type": "string",
"in": "query"
}
#swagger.parameters['include_imports'] = {
"description": "Whether or not to include imported secrets. Default is false",
"required": false,
"type": "boolean",
"in": "query"
}
*/
const validatedData = await validateRequest(reqValidator.GetSecretsRawV3, req); const validatedData = await validateRequest(reqValidator.GetSecretsRawV3, req);
let { let {
query: { secretPath, environment, workspaceId } query: { secretPath, environment, workspaceId }
@@ -226,6 +263,57 @@ export const getSecretsRaw = async (req: Request, res: Response) => {
* @param res * @param res
*/ */
export const getSecretByNameRaw = async (req: Request, res: Response) => { export const getSecretByNameRaw = async (req: Request, res: Response) => {
/*
#swagger.summary = 'Get secret'
#swagger.description = 'Get secret'
#swagger.security = [{
"apiKeyAuth": [],
"bearerAuth": []
}]
#swagger.parameters['secretName'] = {
"description": "Name of secret to get",
"required": true,
"type": "string",
"in": "path"
}
#swagger.parameters['workspaceId'] = {
"description": "ID of workspace where to get secret",
"required": true,
"type": "string",
"in": "query"
}
#swagger.parameters['environment'] = {
"description": "Slug of environment where to get secret",
"required": true,
"type": "string",
"in": "query"
}
#swagger.parameters['secretPath'] = {
"description": "Path where to update secret like / or /foo/bar. Default is /",
"required": false,
"type": "string",
"in": "query"
}
#swagger.parameters['type'] = {
"description": "Type of secret to get; either shared or personal. Default is shared.",
"required": true,
"type": "string",
"in": "query"
}
#swagger.parameters['include_imports'] = {
"description": "Whether or not to include imported secrets. Default is false",
"required": false,
"type": "boolean",
"in": "query"
}
*/
const { const {
query: { secretPath, environment, workspaceId, type, include_imports }, query: { secretPath, environment, workspaceId, type, include_imports },
params: { secretName } params: { secretName }
@@ -267,12 +355,76 @@ export const getSecretByNameRaw = async (req: Request, res: Response) => {
* @param res * @param res
*/ */
export const createSecretRaw = async (req: Request, res: Response) => { export const createSecretRaw = async (req: Request, res: Response) => {
/*
#swagger.summary = 'Create secret'
#swagger.description = 'Create secret'
#swagger.security = [{
"apiKeyAuth": [],
"bearerAuth": []
}]
#swagger.parameters['secretName'] = {
"description": "Name of secret to create",
"required": true,
"type": "string",
"in": "path"
}
#swagger.requestBody = {
content: {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string",
"description": "ID of the workspace where to create secret",
"example": "someWorkspaceId"
},
"environment": {
"type": "string",
"description": "Slug of environment where to create secret",
"example": "dev"
},
"secretPath": {
"type": "string",
"description": "Path where to create secret. Default is /",
"example": "/foo/bar"
},
"secretValue": {
"type": "string",
"description": "Value of secret to create",
"example": "Some value"
},
"secretComment": {
"type": "string",
"description": "Comment for secret to create",
"example": "Some comment"
},
"type": {
"type": "string",
"description": "Type of secret to create; either shared or personal. Default is shared.",
"example": "shared"
},
"skipMultilineEncoding": {
"type": "boolean",
"description": "Convert multi line secrets into one line by wrapping",
"example": "true"
},
},
"required": ["workspaceId", "environment", "secretValue"]
}
}
}
}
*/
const { const {
params: { secretName }, params: { secretName },
body: { body: {
secretPath,
environment,
workspaceId, workspaceId,
environment,
secretPath,
type, type,
secretValue, secretValue,
secretComment, secretComment,
@@ -351,9 +503,68 @@ export const createSecretRaw = async (req: Request, res: Response) => {
* @param res * @param res
*/ */
export const updateSecretByNameRaw = async (req: Request, res: Response) => { export const updateSecretByNameRaw = async (req: Request, res: Response) => {
/*
#swagger.summary = 'Update secret'
#swagger.description = 'Update secret'
#swagger.security = [{
"apiKeyAuth": [],
"bearerAuth": []
}]
#swagger.parameters['secretName'] = {
"description": "Name of secret to update",
"required": true,
"type": "string",
"in": "path"
}
#swagger.requestBody = {
content: {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string",
"description": "ID of the workspace where to update secret",
"example": "someWorkspaceId"
},
"environment": {
"type": "string",
"description": "Slug of environment where to update secret",
"example": "dev"
},
"secretPath": {
"type": "string",
"description": "Path where to update secret like / or /foo/bar. Default is /",
"example": "/foo/bar"
},
"secretValue": {
"type": "string",
"description": "Value of secret to update to",
"example": "Some value"
},
"type": {
"type": "string",
"description": "Type of secret to update; either shared or personal. Default is shared.",
"example": "shared"
},
"skipMultilineEncoding": {
"type": "boolean",
"description": "Convert multi line secrets into one line by wrapping",
"example": "true"
},
},
"required": ["workspaceId", "environment", "secretValue"]
}
}
}
}
*/
const { const {
params: { secretName }, params: { secretName },
body: { secretValue, environment, secretPath, type, workspaceId, skipMultilineEncoding } body: { workspaceId, environment, secretValue, secretPath, type, skipMultilineEncoding }
} = await validateRequest(reqValidator.UpdateSecretByNameRawV3, req); } = await validateRequest(reqValidator.UpdateSecretByNameRawV3, req);
await checkSecretsPermission({ await checkSecretsPermission({
@@ -408,6 +619,55 @@ export const updateSecretByNameRaw = async (req: Request, res: Response) => {
* @param res * @param res
*/ */
export const deleteSecretByNameRaw = async (req: Request, res: Response) => { export const deleteSecretByNameRaw = async (req: Request, res: Response) => {
/*
#swagger.summary = 'Delete secret'
#swagger.description = 'Delete secret'
#swagger.security = [{
"apiKeyAuth": [],
"bearerAuth": []
}]
#swagger.parameters['secretName'] = {
"description": "Name of secret to delete",
"required": true,
"type": "string",
"in": "path"
}
#swagger.requestBody = {
content: {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string",
"description": "ID of workspace where to delete secret",
"example": "someWorkspaceId"
},
"environment": {
"type": "string",
"description": "Slug of Environment where to delete secret",
"example": "dev"
},
"secretPath": {
"type": "string",
"description": "Path where to delete secret. Default is /",
"example": "/foo/bar"
},
"type": {
"type": "string",
"description": "Type of secret to delete; either shared or personal. Default is shared",
"example": "shared"
}
},
"required": ["workspaceId", "environment"]
}
}
}
}
*/
const { const {
params: { secretName }, params: { secretName },
body: { environment, secretPath, type, workspaceId } body: { environment, secretPath, type, workspaceId }
@@ -462,7 +722,7 @@ export const getSecrets = async (req: Request, res: Response) => {
query: { environment, workspaceId, include_imports: includeImports } query: { environment, workspaceId, include_imports: includeImports }
} = validatedData; } = validatedData;
let { const {
query: { secretPath } query: { secretPath }
} = validatedData; } = validatedData;

View File

@@ -30,13 +30,13 @@ const generateOpenAPISpec = async () => {
type: "http", type: "http",
scheme: "bearer", scheme: "bearer",
bearerFormat: "JWT", bearerFormat: "JWT",
description: "This security definition uses the HTTP 'bearer' scheme, which allows the client to authenticate using a JSON Web Token (JWT) that is passed in the Authorization header of the request.", description: "A service token in Infisical",
}, },
apiKeyAuth: { apiKeyAuth: {
type: "apiKey", type: "apiKey",
in: "header", in: "header",
name: "X-API-Key", name: "X-API-Key",
description: 'This security definition uses an API key, which is passed in the header of the request as the value of the "X-API-Key" header. The client must provide a valid key in order to access the API.', description: "An API Key in Infisical",
}, },
}, },
definitions: { definitions: {

View File

@@ -1,4 +0,0 @@
---
title: "List"
openapi: "GET /api/v2/workspace/{workspaceId}/environments"
---

View File

@@ -1,4 +1,4 @@
--- ---
title: "Delete" title: "Delete"
openapi: "DELETE /api/v1/folders/{folderId}" openapi: "DELETE /api/v1/folders/{folderName}"
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: "Update" title: "Update"
openapi: "PATCH /api/v1/folders/{folderId}" openapi: "PATCH /api/v1/folders/{folderName}"
--- ---

View File

@@ -1,10 +1,8 @@
--- ---
title: "Create" title: "Create"
openapi: "POST /api/v3/secrets/{secretName}" openapi: "POST /api/v3/secrets/raw/{secretName}"
--- ---
<Tip> <Tip>
Using this route requires understanding Infisical's system and cryptography. This endpoint requires you to disable end-to-end encryption. For more information, you should consult this [note](https://infisical.com/docs/api-reference/overview/examples/note).
You should consult the [examples](https://infisical.com/docs/api-reference/overview/examples/note) for how to use
this endpoint.
</Tip> </Tip>

View File

@@ -1,4 +1,8 @@
--- ---
title: "Delete" title: "Delete"
openapi: "DELETE /api/v3/secrets/{secretName}" openapi: "DELETE /api/v3/secrets/raw/{secretName}"
--- ---
<Tip>
This endpoint requires you to disable end-to-end encryption. For more information, you should consult this [note](https://infisical.com/docs/api-reference/overview/examples/note).
</Tip>

View File

@@ -1,11 +1,8 @@
--- ---
title: "List" title: "List"
openapi: "GET /api/v3/secrets/" openapi: "GET /api/v3/secrets/raw"
--- ---
<Tip> <Tip>
Using this route requires understanding Infisical's system and cryptography. This endpoint requires you to disable end-to-end encryption. For more information, you should consult this [note](https://infisical.com/docs/api-reference/overview/examples/note).
You should consult the [examples](https://infisical.com/docs/api-reference/overview/examples/note) for how to use </Tip>
this endpoint.
</Tip>

View File

@@ -1,10 +1,8 @@
--- ---
title: "Retrieve" title: "Retrieve"
openapi: "GET /api/v3/secrets/{secretName}" openapi: "GET /api/v3/secrets/raw/{secretName}"
--- ---
<Tip> <Tip>
Using this route requires understanding Infisical's system and cryptography. This endpoint requires you to disable end-to-end encryption. For more information, you should consult this [note](https://infisical.com/docs/api-reference/overview/examples/note).
You should consult the [examples](https://infisical.com/docs/api-reference/overview/examples/note) for how to use </Tip>
this endpoint.
</Tip>

View File

@@ -1,4 +0,0 @@
---
title: "Roll Back to Version"
openapi: "POST /api/v1/secret/{secretId}/secret-versions/rollback"
---

View File

@@ -1,11 +1,8 @@
--- ---
title: "Update" title: "Update"
openapi: "PATCH /api/v3/secrets/{secretName}" openapi: "PATCH /api/v3/secrets/raw/{secretName}"
--- ---
<Tip> <Tip>
Using this route requires understanding Infisical's system and cryptography. This endpoint requires you to disable end-to-end encryption. For more information, you should consult this [note](https://infisical.com/docs/api-reference/overview/examples/note).
You should consult the [examples](https://infisical.com/docs/api-reference/overview/examples/note) for how to use </Tip>
this endpoint.
</Tip>

View File

@@ -1,4 +0,0 @@
---
title: "Get Versions"
openapi: "GET /api/v1/secret/{secretId}/secret-versions"
---

View File

@@ -1,4 +0,0 @@
---
title: "Get Logs"
openapi: "GET /api/v1/workspace/{workspaceId}/logs"
---

View File

@@ -330,7 +330,6 @@
"api-reference/endpoints/workspaces/update-membership", "api-reference/endpoints/workspaces/update-membership",
"api-reference/endpoints/workspaces/delete-membership", "api-reference/endpoints/workspaces/delete-membership",
"api-reference/endpoints/workspaces/workspace-key", "api-reference/endpoints/workspaces/workspace-key",
"api-reference/endpoints/workspaces/logs",
"api-reference/endpoints/workspaces/secret-snapshots", "api-reference/endpoints/workspaces/secret-snapshots",
"api-reference/endpoints/workspaces/rollback-snapshot" "api-reference/endpoints/workspaces/rollback-snapshot"
] ]
@@ -338,7 +337,6 @@
{ {
"group": "Environments", "group": "Environments",
"pages": [ "pages": [
"api-reference/endpoints/environments/list",
"api-reference/endpoints/environments/create", "api-reference/endpoints/environments/create",
"api-reference/endpoints/environments/update", "api-reference/endpoints/environments/update",
"api-reference/endpoints/environments/delete" "api-reference/endpoints/environments/delete"

File diff suppressed because it is too large Load Diff