Skip to content

Update an existing policy

PUT /api/v1/update-policy/{name}

PUT /maas/api/v1/update-policy/{name}

Updates an existing MaaSAuthPolicy resource. K8s calls: PUT /k8s/v1/maasauthpolicy/:name

Authorization

Parameters

Name In Type Required Description
name path string Yes

Name of the MaaSAuthPolicy to update

Request body

Required.

Content type: application/json

Schema: UpdatePolicyRequest

Example:

{
  "modelRefs": [
    {
      "name": "llama-2-7b-chat",
      "namespace": "maas-models"
    },
    {
      "name": "mistral-7b-instruct",
      "namespace": "maas-models"
    }
  ],
  "subjects": {
    "groups": [
      {
        "name": "team-alpha"
      },
      {
        "name": "beta-testers"
      }
    ]
  },
  "meteringMetadata": {
    "organizationId": "org-123",
    "costCenter": "engineering-v2"
  }
}

Responses

Status Description Response body
200 OK

Policy updated successfully

MaaSAuthPolicy

application/json

400 Bad Request

Bad Request. Invalid update specification.

ErrorResponse

application/json

401 Unauthorized

Unauthorized

None
404 Not Found

Policy not found

ErrorResponse

application/json

500 Internal Server Error

Internal Server Error

ErrorResponse

application/json

Example request

curl -X PUT "/maas/api/v1/update-policy/{name}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "modelRefs": [
    {
      "name": "llama-2-7b-chat",
      "namespace": "maas-models"
    },
    {
      "name": "mistral-7b-instruct",
      "namespace": "maas-models"
    }
  ],
  "subjects": {
    "groups": [
      {
        "name": "team-alpha"
      },
      {
        "name": "beta-testers"
      }
    ]
  },
  "meteringMetadata": {
    "organizationId": "org-123",
    "costCenter": "engineering-v2"
  }
}'

Example response

200 OK, application/json

{
  "name": "team-alpha-policy",
  "namespace": "maas-system",
  "phase": "Active",
  "modelRefs": [
    {
      "name": "llama-2-7b-chat",
      "namespace": "maas-models"
    },
    {
      "name": "mistral-7b-instruct",
      "namespace": "maas-models"
    }
  ],
  "subjects": {
    "groups": [
      {
        "name": "team-alpha"
      },
      {
        "name": "beta-testers"
      }
    ]
  },
  "meteringMetadata": {
    "organizationId": "org-123",
    "costCenter": "engineering-v2"
  }
}