import requests
url = "https://platform.ankra.app/api/v1/org/cluster-access-policy"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/cluster-access-policy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/cluster-access-policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"policy": {
"creator_grant_role": "none",
"max_grant_role": "view",
"elevated_max_ttl_seconds": 15768030,
"require_reason_from_role": "view",
"is_configured": true
},
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_name": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Set Cluster Access Policy
Set the organisation cluster access policy. creator_grant_role none seeds no grant for the creator; a creator role above max_grant_role is refused, and so is a creator role above view while elevated_max_ttl_seconds is set (sent or stored), because the creator’s grant is standing and would be over policy as soon as it is seeded. A lowered ceiling leaves manual and creator grants above it in place, but they cannot be re-timed; grants that come from organisation roles are lowered to the new ceiling on the next role sync (about a minute), each with an audit row and one organisation notification per sync. New grants above the ceiling answer 403 cluster_access_policy_violation. elevated_max_ttl_seconds and require_reason_from_role are optional: an omitted bound keeps its stored value and null clears it; new and re-timed grants outside them answer 403 cluster_access_grant_expiry_required, cluster_access_grant_lifetime_exceeded or cluster_access_grant_reason_required. Requires kube_access.policy, which is human-only: an API token must name it in its scopes, and an unscoped or wildcard token answers 403 permission_denied. organisation_id and organisation_name name the organisation written.
import requests
url = "https://platform.ankra.app/api/v1/org/cluster-access-policy"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/cluster-access-policy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/cluster-access-policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"policy": {
"creator_grant_role": "none",
"max_grant_role": "view",
"elevated_max_ttl_seconds": 15768030,
"require_reason_from_role": "view",
"is_configured": true
},
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_name": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
none, view, edit, admin, cluster-admin view, edit, admin, cluster-admin The longest a grant above view may last, in seconds: such a grant must expire, and no later than this from when it is created or re-timed. It is also the window a kube_access.elevate holder may give itself (4 hours when null). null clears the bound; omitting the field keeps the stored value.
60 <= x <= 31536000The lowest role whose grants must carry a reason. null clears the bound; omitting the field keeps the stored value.
view, edit, admin, cluster-admin Response
Successful Response
Show child attributes
Show child attributes
The organisation this policy belongs to: the one the request selected (a token's own unless X-Ankra-Organisation-Id names another, or the session's current organisation).
That organisation's name; null for an organisation without one.