//native
type Cockroachdb = {
token: string;
};
/**
* List all PrivateEndpointServices for a cluster
* The internal_dns property from the regions field in the ListClusters response can be used to connect to PrivateEndpointServices.
Can be used by the following roles assigned at the organization, folder or cluster scope:
- CLUSTER_ADMIN
- CLUSTER_OPERATOR_WRITER
*/
export async function main(auth: Cockroachdb, cluster_id: string) {
const url = new URL(
`https://cockroachlabs.cloud/api/v1/clusters/${cluster_id}/networking/private-endpoint-services`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
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