//native
/**
* Enable spike protection
* Enables Spike Protection feature for some of the projects within the organization.
*/
export async function main(auth: RT.Sentry, body: Body) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/spike-protections/`
)
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.text()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Django Rest Framework serializer for incoming Spike Protection API payloads
*/
export interface Body {
/**
* Slugs of projects to enable Spike Protection for. Set to `$all` to enable Spike Protection for all the projects in the organization.
*/
projects: string[]
[k: string]: unknown
}
Submitted by hugo697 235 days ago