curl --request PUT \
--url https://api.opal.dev/v1/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"query": {
"nodeFilters": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": true,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
}
}
'import requests
url = "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload = {
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"query": {
"nodeFilters": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": True,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
}
}
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({
name: 'Platform Engineering',
description: 'This access rule represents all platform engineers in the company.',
admin_owner_id: '7c86c85d-0651-43e2-a748-d69d658418e8',
status: 'ACTIVE',
query: {
nodeFilters: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
accessFilters: {
isAccessibleBy: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
hasAccessTo: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
directOnly: true,
allOf: '<array>',
anyOf: '<array>',
not: {}
}
}
})
};
fetch('https://api.opal.dev/v1/access-rules/{access_rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opal.dev/v1/access-rules/{access_rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Platform Engineering',
'description' => 'This access rule represents all platform engineers in the company.',
'admin_owner_id' => '7c86c85d-0651-43e2-a748-d69d658418e8',
'status' => 'ACTIVE',
'query' => [
'nodeFilters' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'accessFilters' => [
'isAccessibleBy' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'hasAccessTo' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'directOnly' => true,
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.opal.dev/v1/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/access-rules/{access_rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"access_rule_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
},
"unless": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
},
"query": {
"nodeFilters": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": true,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
},
"uses_opal_query": false
}Put access rules
Updates the access rule config for the given group_id.
curl --request PUT \
--url https://api.opal.dev/v1/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"query": {
"nodeFilters": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [],
"entityItemTypes": [
"OPAL_ROLE"
],
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": true,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
}
}
'import requests
url = "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload = {
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"query": {
"nodeFilters": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [],
"entityItemTypes": ["OPAL_ROLE"],
"hrIdpStatus": {
"statuses": ["ACTIVE"],
"not": True
},
"userTitle": {
"strings": ["Software Engineer", "Staff Engineer"],
"unset": True,
"not": True
},
"userTeam": {
"strings": ["Platform", "Infrastructure"],
"unset": True,
"not": True
},
"userManager": {
"userIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"unset": True,
"not": True
},
"entityIDs": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"importedFromApp": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"roleRemoteIds": ["<string>"],
"roleNames": ["<string>"],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": True,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
}
}
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({
name: 'Platform Engineering',
description: 'This access rule represents all platform engineers in the company.',
admin_owner_id: '7c86c85d-0651-43e2-a748-d69d658418e8',
status: 'ACTIVE',
query: {
nodeFilters: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
accessFilters: {
isAccessibleBy: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
hasAccessTo: {
entityTypes: [],
entityItemTypes: ['OPAL_ROLE'],
hrIdpStatus: {statuses: ['ACTIVE'], not: true},
userTitle: {strings: ['Software Engineer', 'Staff Engineer'], unset: true, not: true},
userTeam: {strings: ['Platform', 'Infrastructure'], unset: true, not: true},
userManager: {userIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], unset: true, not: true},
entityIDs: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
importedFromApp: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
roleRemoteIds: ['<string>'],
roleNames: ['<string>'],
allOf: '<array>',
anyOf: '<array>',
not: {}
},
directOnly: true,
allOf: '<array>',
anyOf: '<array>',
not: {}
}
}
})
};
fetch('https://api.opal.dev/v1/access-rules/{access_rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.opal.dev/v1/access-rules/{access_rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Platform Engineering',
'description' => 'This access rule represents all platform engineers in the company.',
'admin_owner_id' => '7c86c85d-0651-43e2-a748-d69d658418e8',
'status' => 'ACTIVE',
'query' => [
'nodeFilters' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'accessFilters' => [
'isAccessibleBy' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'hasAccessTo' => [
'entityTypes' => [
],
'entityItemTypes' => [
'OPAL_ROLE'
],
'hrIdpStatus' => [
'statuses' => [
'ACTIVE'
],
'not' => true
],
'userTitle' => [
'strings' => [
'Software Engineer',
'Staff Engineer'
],
'unset' => true,
'not' => true
],
'userTeam' => [
'strings' => [
'Platform',
'Infrastructure'
],
'unset' => true,
'not' => true
],
'userManager' => [
'userIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'unset' => true,
'not' => true
],
'entityIDs' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'importedFromApp' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'roleRemoteIds' => [
'<string>'
],
'roleNames' => [
'<string>'
],
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
],
'directOnly' => true,
'allOf' => '<array>',
'anyOf' => '<array>',
'not' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.opal.dev/v1/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/access-rules/{access_rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"query\": {\n \"nodeFilters\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"accessFilters\": {\n \"isAccessibleBy\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"hasAccessTo\": {\n \"entityTypes\": [],\n \"entityItemTypes\": [\n \"OPAL_ROLE\"\n ],\n \"hrIdpStatus\": {\n \"statuses\": [\n \"ACTIVE\"\n ],\n \"not\": true\n },\n \"userTitle\": {\n \"strings\": [\n \"Software Engineer\",\n \"Staff Engineer\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userTeam\": {\n \"strings\": [\n \"Platform\",\n \"Infrastructure\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"userManager\": {\n \"userIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"unset\": true,\n \"not\": true\n },\n \"entityIDs\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"importedFromApp\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"roleRemoteIds\": [\n \"<string>\"\n ],\n \"roleNames\": [\n \"<string>\"\n ],\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n },\n \"directOnly\": true,\n \"allOf\": \"<array>\",\n \"anyOf\": \"<array>\",\n \"not\": {}\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"access_rule_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
},
"unless": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
},
"query": {
"nodeFilters": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"accessFilters": {
"isAccessibleBy": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"hasAccessTo": {
"entityTypes": [
"RESOURCE"
],
"entityItemTypes": [
"OPAL_ROLE"
],
"entityName": {
"stringMatchType": "CONTAINS",
"string": "engineering"
},
"entityDescription": {
"string": "production",
"not": true
},
"entityTag": {
"key": "team",
"value": "platform",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"entityTagKey": {
"keys": [
"Critical"
]
},
"hrIdpStatus": {
"statuses": [
"ACTIVE"
],
"not": true
},
"entityAdminOwner": {
"ownerIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"not": true
},
"userTitle": {
"strings": [
"Software Engineer",
"Staff Engineer"
],
"unset": true,
"not": true
},
"userTeam": {
"strings": [
"Platform",
"Infrastructure"
],
"unset": true,
"not": true
},
"userManager": {
"userIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"unset": true,
"not": true
},
"entityIDs": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"importedFromApp": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"roleRemoteIds": [
"<string>"
],
"roleNames": [
"<string>"
],
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
},
"directOnly": true,
"allOf": "<array>",
"anyOf": "<array>",
"not": {}
}
},
"uses_opal_query": false
}Authorizations
Body
UpdateAccessRuleInfo Object
Description
The UpdateAccessRuleInfo object is used as an input to the UpdateAccessRule and CreateAccessRule API.
Provide at least one of ruleClauses (tag CNF) or query (Opal Query).
Sending both stores them as AND. PUT replaces the whole condition from
the body: omit a side to clear it. Empty ruleClauses next to query
(as GET returns for query-only rules) is treated as absent.
Response
The updated access rule config for the group.
Access Rule Object
Description
The AccessRule object is used to represent an access rule configuration.
Usage Example
List access rules from the GET /access-rules endpoint, or retrieve a single access rule from the GET /access-rules/{access_rule_id} endpoint.
True when the access rule stores an Opal Query (including hybrids). query is set when the REST dialect can express that filter; it is omitted for filters the API cannot express (e.g. risk, identity detection, agent fields). Rely on this flag, not only on whether query is present.
false
Was this page helpful?