Edits history of script submission #18642 for ' Link service (render)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Render = {
    	apiKey: string
    }
    /**
     * Link service
     * Link a particular service to a particular environment group.
    
    The linked service will have access to the environment variables and secret files in the group.
    
     */
    export async function main(auth: Render, envGroupId: string, serviceId: string) {
    	const url = new URL(`https://api.render.com/v1/env-groups/${envGroupId}/services/${serviceId}`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago