//native
type Render = {
apiKey: string
}
/**
* Create registry credential
* Create a new registry credential.
*/
export async function main(
auth: Render,
body: {
registry: 'GITHUB' | 'GITLAB' | 'DOCKER' | 'GOOGLE_ARTIFACT' | 'AWS_ECR'
name: string
username: string
authToken: string
ownerId: string
}
) {
const url = new URL(`https://api.render.com/v1/registrycredentials`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
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