//native
type Segment = {
token: string;
baseUrl: string;
};
/**
* Create Validation in Warehouse
* Validates input settings against a Warehouse.
• When called, this endpoint may generate the `Storage Destination Settings Validation` event in the audit trail.
*/
export async function main(
auth: Segment,
body: { metadataId: string; settings: {} },
) {
const url = new URL(`${auth.baseUrl}/warehouses/validation`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago