Edits history of script submission #18221 for ' Deploy a cluster (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Deploy a cluster
     * allows to deploy a cluster
     */
    export async function main(
    	auth: RT.Qovery,
    	organizationId: string,
    	clusterId: string,
    	dry_run?: string | undefined
    ) {
    	const url = new URL(
    		`https://api.qovery.com/organization/${organizationId}/cluster/${clusterId}/deploy`
    	)
    	for (const [k, v] of [['dry_run', dry_run]]) {
    		if (v !== undefined && v !== '') {
    			url.searchParams.append(k, v)
    		}
    	}
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: 'Token ' + 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