//native
type Render = {
apiKey: string
}
/**
* Update service
* Update the service with the provided ID.
*/
export async function main(
auth: Render,
serviceId: string,
body: {
autoDeploy?: 'yes' | 'no'
repo?: string
branch?: string
image?: {
ownerId: string
registryCredentialId?: string
imagePath: string
}
name?: string
buildFilter?: { paths: string[]; ignoredPaths: string[] }
rootDir?: string
serviceDetails?:
| {
buildCommand?: string
publishPath?: string
pullRequestPreviewsEnabled?: 'yes' | 'no'
previews?: { generation?: 'off' | 'manual' | 'automatic' }
renderSubdomainPolicy?: 'enabled' | 'disabled'
}
| {
envSpecificDetails?:
| {
dockerCommand?: string
dockerContext?: string
dockerfilePath?: string
registryCredentialId?: string
}
| { buildCommand?: string; startCommand?: string }
healthCheckPath?: string
maintenanceMode?: { enabled: false | true; uri: string }
plan?: 'starter' | 'standard' | 'pro' | 'pro_plus' | 'pro_max' | 'pro_ultra'
preDeployCommand?: string
pullRequestPreviewsEnabled?: 'yes' | 'no'
previews?: { generation?: 'off' | 'manual' | 'automatic' }
runtime?: 'docker' | 'elixir' | 'go' | 'node' | 'python' | 'ruby' | 'rust' | 'image'
maxShutdownDelaySeconds?: number
renderSubdomainPolicy?: 'enabled' | 'disabled'
}
| {
envSpecificDetails?:
| {
dockerCommand?: string
dockerContext?: string
dockerfilePath?: string
registryCredentialId?: string
}
| { buildCommand?: string; startCommand?: string }
plan?: 'starter' | 'standard' | 'pro' | 'pro_plus' | 'pro_max' | 'pro_ultra'
preDeployCommand?: string
pullRequestPreviewsEnabled?: 'yes' | 'no'
previews?: { generation?: 'off' | 'manual' | 'automatic' }
runtime?: 'docker' | 'elixir' | 'go' | 'node' | 'python' | 'ruby' | 'rust' | 'image'
maxShutdownDelaySeconds?: number
}
| {
envSpecificDetails?:
| {
dockerCommand?: string
dockerContext?: string
dockerfilePath?: string
registryCredentialId?: string
}
| { buildCommand?: string; startCommand?: string }
plan?: 'starter' | 'standard' | 'pro' | 'pro_plus' | 'pro_max' | 'pro_ultra'
schedule?: string
runtime?: 'docker' | 'elixir' | 'go' | 'node' | 'python' | 'ruby' | 'rust' | 'image'
}
}
) {
const url = new URL(`https://api.render.com/v1/services/${serviceId}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago