Create a new policy¶
POST /api/v1/new-policy
Creates a new MaaSAuthPolicy resource. K8s calls: CREATE /k8s/v1/maasauthpolicy
Authorization¶
Request body¶
Required.
Content type: application/json
Schema: CreatePolicyRequest
Example:
{
"name": "team-alpha-policy",
"modelRefs": [
{
"name": "llama-2-7b-chat",
"namespace": "maas-models"
}
],
"subjects": {
"groups": [
{
"name": "team-alpha"
}
]
},
"meteringMetadata": {
"organizationId": "org-123",
"costCenter": "engineering"
}
}
Responses¶
| Status | Description | Response body |
|---|---|---|
201 Created | Policy created successfully |
|
400 Bad Request | Bad Request. Missing or invalid fields. |
|
401 Unauthorized | Unauthorized | None |
409 Conflict | Conflict. Policy with this name already exists. |
|
500 Internal Server Error | Internal Server Error |
|
Example request¶
curl -X POST "/maas/api/v1/new-policy" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "team-alpha-policy",
"modelRefs": [
{
"name": "llama-2-7b-chat",
"namespace": "maas-models"
}
],
"subjects": {
"groups": [
{
"name": "team-alpha"
}
]
},
"meteringMetadata": {
"organizationId": "org-123",
"costCenter": "engineering"
}
}'
Example response¶
201 Created, application/json