0

Update enterprise connection

by
Published Oct 17, 2025
Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update enterprise connection
4
 *
5
 */
6
export async function main(
7
	auth: RT.Qovery,
8
	organizationId: string,
9
	connectionName: string,
10
	body: EnterpriseConnectionDto
11
) {
12
	const url = new URL(
13
		`https://api.qovery.com/organization/${organizationId}/enterpriseconnection/${connectionName}`
14
	)
15

16
	const response = await fetch(url, {
17
		method: 'PUT',
18
		headers: {
19
			'Content-Type': 'application/json',
20
			Authorization: 'Token ' + auth.apiKey
21
		},
22
		body: JSON.stringify(body)
23
	})
24
	if (!response.ok) {
25
		const text = await response.text()
26
		throw new Error(`${response.status} ${text}`)
27
	}
28
	return await response.json()
29
}
30

31
/* eslint-disable */
32
/**
33
 * This file was automatically generated by json-schema-to-typescript.
34
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
35
 * and run json-schema-to-typescript to regenerate this file.
36
 */
37

38
export interface EnterpriseConnectionDto {
39
	/**
40
	 * The connection name
41
	 */
42
	connection_name: string
43
	/**
44
	 * The purpose of this default role is to be associated to your users if:
45
	 * - you choose to not expose your IDPs groups to the SAML / OIDC connection
46
	 * - no associated group is found in your `group_mappings` defined
47
	 *
48
	 * You can define either a Qovery provided role (i.e `viewer`) or one of your custom role`s uuid.
49
	 *
50
	 */
51
	default_role: string
52
	/**
53
	 * * if `true`, roles will be synchronized at each user login according to your `group_mappings` configuration based on your IDP groups
54
	 * * if `false`, no synchronization is done for your users and `group_mappings` configuration will be ignored
55
	 *
56
	 */
57
	enforce_group_sync: boolean
58
	/**
59
	 * This will allow to create mapping rules based on your IDP group names.
60
	 * It's a dictionnary having:
61
	 * - key: either a Qovery provided role (i.e `viewer`) or one of your custom role`s uuid
62
	 * - value: an array of your IDP group names
63
	 *
64
	 * Example: "I want to associate the Qovery role `devops` to my IDP groups ['Administrators', 'DevSecOps']"
65
	 *
66
	 */
67
	group_mappings: {
68
		[k: string]: string[]
69
	}
70
	[k: string]: unknown
71
}
72