Edits history of script submission #18239 for ' Edit a database (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Edit a database
     * To edit a database  you must have the admin permission
     */
    export async function main(auth: RT.Qovery, databaseId: string, body: Body) {
    	const url = new URL(`https://api.qovery.com/database/${databaseId}`)
    
    	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 interface Body {
    	/**
    	 * name is case-insensitive
    	 */
    	name?: string
    	/**
    	 * give a description to this database
    	 */
    	description?: string
    	version?: string
    	accessibility?: 'PRIVATE' | 'PUBLIC'
    	/**
    	 * unit is millicores (m). 1000m = 1 cpu.
    	 * This field will be ignored for managed DB (instance type will be used instead).
    	 *
    	 */
    	cpu?: number
    	/**
    	 * unit is MB. 1024 MB = 1GB
    	 * This field will be ignored for managed DB (instance type will be used instead).
    	 * Default value is linked to the database type:
    	 * - MANAGED: 100
    	 * - CONTAINER
    	 *   - POSTGRES: 100
    	 *   - REDIS: 100
    	 *   - MYSQL: 512
    	 *   - MONGODB: 256
    	 *
    	 */
    	memory?: number
    	/**
    	 * unit is GB
    	 */
    	storage?: number
    	/**
    	 * Database instance type to be used for this database. The list of values can be retrieved via the endpoint /{CloudProvider}/managedDatabase/instanceType/{region}/{dbType}. This field SHOULD NOT be set for container DB.
    	 */
    	instance_type?: string
    	annotations_groups?: {
    		id: string
    		[k: string]: unknown
    	}[]
    	labels_groups?: {
    		id: string
    		[k: string]: unknown
    	}[]
    	/**
    	 * Icon URI representing the database.
    	 */
    	icon_uri?: string
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago