Edits history of script submission #18191 for ' Delete a secret from the environment (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Delete a secret from the environment
     * - To delete a secret you must have the project user permission
    - You can't delete a BUILT_IN secret
    - If you delete a secret having override or alias, the associated override/alias will be deleted as well  operationId: deleteEnvironmentSecret
    
     */
    export async function main(auth: RT.Qovery, environmentId: string, secretId: string) {
    	const url = new URL(`https://api.qovery.com/environment/${environmentId}/secret/${secretId}`)
    
    	const response = await fetch(url, {
    		method: 'DELETE',
    		headers: {
    			Authorization: 'Token ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 235 days ago