//native
/**
* Create a variable
* - Create a variable with the scope defined in the request body.
*/
export async function main(auth: RT.Qovery, body: Body) {
const url = new URL(`https://api.qovery.com/variable`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Token ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* the key of the environment variable
*/
key: string
/**
* the value of the environment variable
*/
value: string
/**
* the path where the file will be mounted (only if type =file)
*/
mount_path?: string
/**
* if true, the variable will be considered as a secret and will not be accessible after its creation. Only your applications will be able to access its value at build and run time.
*/
is_secret: boolean
variable_scope:
| 'APPLICATION'
| 'BUILT_IN'
| 'ENVIRONMENT'
| 'PROJECT'
| 'CONTAINER'
| 'JOB'
| 'HELM'
| 'TERRAFORM'
/**
* based on the selected scope, it contains the ID of the service, environment or project where the variable is attached
*/
variable_parent_id: string
/**
* optional variable description (255 characters maximum)
*/
description?: string
enable_interpolation_in_file?: boolean
[k: string]: unknown
}
Submitted by hugo697 235 days ago