0

Create a secret alias at the job level

by
Published Oct 17, 2025

- Allows you to add an alias at job level on an existing secret having higher scope, in order to customize its key.

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create a secret alias at the job level
4
 * - Allows you to add an alias at job level on an existing secret having higher scope, in order to customize its key.
5
 */
6
export async function main(
7
	auth: RT.Qovery,
8
	jobId: string,
9
	secretId: string,
10
	body: EnvironmentVariableAliasRequest
11
) {
12
	const url = new URL(`https://api.qovery.com/job/${jobId}/secret/${secretId}/alias`)
13

14
	const response = await fetch(url, {
15
		method: 'POST',
16
		headers: {
17
			'Content-Type': 'application/json',
18
			Authorization: 'Token ' + auth.apiKey
19
		},
20
		body: JSON.stringify(body)
21
	})
22
	if (!response.ok) {
23
		const text = await response.text()
24
		throw new Error(`${response.status} ${text}`)
25
	}
26
	return await response.json()
27
}
28

29
/* eslint-disable */
30
/**
31
 * This file was automatically generated by json-schema-to-typescript.
32
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
33
 * and run json-schema-to-typescript to regenerate this file.
34
 */
35

36
export interface EnvironmentVariableAliasRequest {
37
	key: string
38
	/**
39
	 * optional variable description (255 characters maximum)
40
	 */
41
	description?: string
42
	enable_interpolation_in_file?: boolean
43
	[k: string]: unknown
44
}
45