//native
/**
* Edit application
* - To edit the application you must have the admin permission.
- For port edition, if you provide a port id, we will update the corresponding port. If you don't we will create a new one. If you remove a port from the payload, we will delete it.
- For storage edition, if you provide a storage id, we will update the corresponding storage. If you don't we will create a new one. If you remove a storage from the payload, we will delete it.
*/
export async function main(auth: RT.Qovery, applicationId: string, body: Body) {
const url = new URL(`https://api.qovery.com/application/${applicationId}`)
const response = await fetch(url, {
method: 'PUT',
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 type Body = {
storage?: {
id?: string
type: 'FAST_SSD'
/**
* unit is GB
* Minimum size is 4 GB
*
*/
size: number
mount_point: string
[k: string]: unknown
}[]
[k: string]: unknown
} & {
/**
* name is case insensitive
*/
name?: string
/**
* give a description to this application
*/
description?: string
git_repository?: {
/**
* application git repository URL
*/
url: string
/**
* Name of the branch to use. This is optional
* If not specified, then the branch used is the `main` or `master` one
*
*/
branch?: string
/**
* indicates the root path of the application.
*/
root_path?: string
/**
* The git token id on Qovery side
*/
git_token_id?: string
provider: 'BITBUCKET' | 'GITHUB' | 'GITLAB'
[k: string]: unknown
}
/**
* `DOCKER` requires `dockerfile_path`
*
*/
build_mode?: 'DOCKER'
/**
* The path of the associated Dockerfile
*/
dockerfile_path?: string
/**
* unit is millicores (m). 1000m = 1 cpu
*/
cpu?: number
/**
* unit is MB. 1024 MB = 1GB
*/
memory?: number
gpu?: number
/**
* Minimum number of instances running. This resource auto-scale based on the CPU and Memory consumption.
* Note: 0 means that there is no application running.
*
*/
min_running_instances?: number
/**
* Maximum number of instances running. This resource auto-scale based on the CPU and Memory consumption.
* Note: -1 means that there is no limit.
*
*/
max_running_instances?: number
healthchecks: {
readiness_probe?: {
type?: {
tcp?: {
port?: number
host?: string
[k: string]: unknown
}
http?: {
path?: string
scheme?: string
port?: number
[k: string]: unknown
}
exec?: {
command?: string[]
[k: string]: unknown
}
grpc?: {
service?: string
port?: number
[k: string]: unknown
}
[k: string]: unknown
}
initial_delay_seconds?: number
period_seconds?: number
timeout_seconds?: number
success_threshold?: number
failure_threshold?: number
[k: string]: unknown
}
liveness_probe?: {
type?: {
tcp?: {
port?: number
host?: string
[k: string]: unknown
}
http?: {
path?: string
scheme?: string
port?: number
[k: string]: unknown
}
exec?: {
command?: string[]
[k: string]: unknown
}
grpc?: {
service?: string
port?: number
[k: string]: unknown
}
[k: string]: unknown
}
initial_delay_seconds?: number
period_seconds?: number
timeout_seconds?: number
success_threshold?: number
failure_threshold?: number
[k: string]: unknown
}
[k: string]: unknown
}
/**
* Specify if the environment preview option is activated or not for this application.
* If activated, a preview environment will be automatically cloned at each pull request.
* If not specified, it takes the value of the `auto_preview` property from the associated environment.
*
*/
auto_preview?: boolean
ports?: {
id: string
name?: string
/**
* The listening port of your service.
*/
internal_port: number
/**
* The exposed port for your service. This is optional. If not set a default port will be used.
*/
external_port?: number
/**
* Expose the port to the world
*/
publicly_accessible: boolean
/**
* is the default port to use for domain
*/
is_default?: boolean
protocol: 'HTTP' | 'GRPC' | 'TCP' | 'UDP'
/**
* Indicate the path or regex that must match for traffic to be accepted on your service
* i.e: /api/ will only accept http calls that start with /api/
* Only valid for publicly_accessible HTTP or GRPC ports.
*/
public_path?: string
/**
* Indicate the new path that will be used to reach your service after replacement
* i.e: public_path -> /(.*) public_path_rewrite -> /api/$1 will append /api/ on all externaly requested url when reaching the service
* external/use url -> example.com/foobar -> url seen by the service -> example.com/api/foobar
* Only valid for publicly_accessible HTTP or GRPC ports.
*/
public_path_rewrite?: string
[k: string]: unknown
}[]
arguments?: string[]
/**
* optional entrypoint when launching container
*/
entrypoint?: string
/**
* Specify if the application will be automatically updated after receiving a new commit.
*/
auto_deploy?: boolean
annotations_groups?: {
id: string
[k: string]: unknown
}[]
labels_groups?: {
id: string
[k: string]: unknown
}[]
/**
* Icon URI representing the application.
*/
icon_uri?: string
/**
* The target build stage in the Dockerfile to build
*/
docker_target_build_stage?: string
[k: string]: unknown
}
Submitted by hugo697 235 days ago