Python
from openlayer import Openlayer
client = Openlayer()
stats = client.governance.rule_stats.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
framework_id="5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
)
print(stats.rule_results)import Openlayer from 'openlayer';
const client = new Openlayer();
const ruleStats = await client.governance.ruleStats.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
frameworkId: '5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b',
});
console.log(ruleStats);
package main
import (
"context"
"fmt"
"github.com/openlayer-ai/openlayer-go"
)
client := openlayer.NewClient()
stats, err := client.Governance.RuleStats.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
openlayer.GovernanceRuleStatGetParams{
FrameworkID: openlayer.F("5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", stats.Rules)
import com.openlayer.api.client.OpenlayerClient;
import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;
import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams;
import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse;
OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();
RuleStatRetrieveParams params = RuleStatRetrieveParams.builder()
.workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.frameworkId("5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b")
.build();
RuleStatRetrieveResponse stats = client.governance().ruleStats().retrieve(params);
require "openlayer"
openlayer = Openlayer::Client.new(api_key: ENV["OPENLAYER_API_KEY"])
rule_stats = openlayer.governance.rule_stats.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
framework_id: "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b"
)
puts(rule_stats)
curl --request GET \
--url 'https://api.openlayer.com/v1/workspaces/3fa85f64-5717-4562-b3fc-2c963f66afa6/rule-stats?frameworkId=9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70' \
--header 'Authorization: Bearer <token>'
{
"rules": {
"total": 1,
"byType": {
"platform": 1,
"evidence": 1
},
"byScope": {
"project": 1,
"workspace": 1
}
},
"ruleResults": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1,
"byRuleType": {
"platform": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
},
"evidence": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
}
},
"byRuleScope": {
"project": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
},
"workspace": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
}
}
}
}{
"code": 123,
"error": "<string>"
}Governance
Retrieve workspace compliance statistics
Get compliance statistics for a workspace.
Python
from openlayer import Openlayer
client = Openlayer()
stats = client.governance.rule_stats.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
framework_id="5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
)
print(stats.rule_results)import Openlayer from 'openlayer';
const client = new Openlayer();
const ruleStats = await client.governance.ruleStats.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
frameworkId: '5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b',
});
console.log(ruleStats);
package main
import (
"context"
"fmt"
"github.com/openlayer-ai/openlayer-go"
)
client := openlayer.NewClient()
stats, err := client.Governance.RuleStats.Get(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
openlayer.GovernanceRuleStatGetParams{
FrameworkID: openlayer.F("5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", stats.Rules)
import com.openlayer.api.client.OpenlayerClient;
import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;
import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveParams;
import com.openlayer.api.models.governance.rulestats.RuleStatRetrieveResponse;
OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();
RuleStatRetrieveParams params = RuleStatRetrieveParams.builder()
.workspaceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.frameworkId("5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b")
.build();
RuleStatRetrieveResponse stats = client.governance().ruleStats().retrieve(params);
require "openlayer"
openlayer = Openlayer::Client.new(api_key: ENV["OPENLAYER_API_KEY"])
rule_stats = openlayer.governance.rule_stats.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
framework_id: "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b"
)
puts(rule_stats)
curl --request GET \
--url 'https://api.openlayer.com/v1/workspaces/3fa85f64-5717-4562-b3fc-2c963f66afa6/rule-stats?frameworkId=9f1b3c2d-4e5a-4f60-8a71-2b3c4d5e6f70' \
--header 'Authorization: Bearer <token>'
{
"rules": {
"total": 1,
"byType": {
"platform": 1,
"evidence": 1
},
"byScope": {
"project": 1,
"workspace": 1
}
},
"ruleResults": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1,
"byRuleType": {
"platform": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
},
"evidence": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
}
},
"byRuleScope": {
"project": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
},
"workspace": {
"total": 1,
"totalPassing": 1,
"totalFailing": 1,
"totalSkipped": 1,
"totalRunning": 1,
"totalError": 1,
"totalPending": 1,
"totalDueSoon": 1
}
}
}
}{
"code": 123,
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your workspace API key. See Find your API key for more information.
Path Parameters
The workspace id.
Query Parameters
Only include items belonging to this framework.
Only include items that apply to this project.
Response
Status OK.
Counts of rules and their results by status. Narrowed by the request's filters, so frameworkId gives one framework's compliance and projectId gives one project's.
Was this page helpful?