Skip to content

Commit

Permalink
chore(api): Remove api/x/plan/resources endpoint (#1471)
Browse files Browse the repository at this point in the history
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
  • Loading branch information
oguzhand95 committed Feb 20, 2023
1 parent e5dbcb5 commit 5fa9390
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 359 deletions.
326 changes: 162 additions & 164 deletions api/genpb/cerbos/svc/v1/svc.pb.go

Large diffs are not rendered by default.

85 changes: 0 additions & 85 deletions api/genpb/cerbos/svc/v1/svc.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions api/public/cerbos/svc/v1/svc.proto
Expand Up @@ -85,10 +85,6 @@ service CerbosService {
option (google.api.http) = {
post: "/api/plan/resources",
body: "*"
additional_bindings: {
post: "/api/x/plan/resources",
body: "*"
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Plan resources"
Expand Down
70 changes: 0 additions & 70 deletions hack/dev/plan.hurl
Expand Up @@ -12,20 +12,6 @@ jsonpath "$.filter" != null
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.status \"PENDING_APPROVAL\")"


# Plan resources request 1 (deprecated endpoint)
POST {{protocol}}://{{host}}:{{port}}/api/x/plan/resources
Content-Type: application/json
file,requests/plan_resources/req1.json;
HTTP/* 200
[Asserts]
header "Content-Type" == "application/json"
jsonpath "$.action" == "approve"
jsonpath "$.resourceKind" == "leave_request"
jsonpath "$.policyVersion" == "20210210"
jsonpath "$.filter" != null
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.status \"PENDING_APPROVAL\")"


# Plan resources request 2
POST {{protocol}}://{{host}}:{{port}}/api/plan/resources
Content-Type: application/json
Expand All @@ -40,20 +26,6 @@ jsonpath "$.filter.kind" == "KIND_ALWAYS_ALLOWED"
jsonpath "$.meta.filterDebug" == "(true)"


# Plan resources request 2 (deprecated endpoint)
POST {{protocol}}://{{host}}:{{port}}/api/x/plan/resources
Content-Type: application/json
file,requests/plan_resources/req2.json;
HTTP/* 200
[Asserts]
header "Content-Type" == "application/json"
jsonpath "$.action" == "defer"
jsonpath "$.resourceKind" == "leave_request"
jsonpath "$.policyVersion" == "20210210"
jsonpath "$.filter.kind" == "KIND_ALWAYS_ALLOWED"
jsonpath "$.meta.filterDebug" == "(true)"


# Plan resources request 3
POST {{protocol}}://{{host}}:{{port}}/api/plan/resources
Content-Type: application/json
Expand All @@ -68,20 +40,6 @@ jsonpath "$.filter.kind" == "KIND_CONDITIONAL"
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.owner \"1\")"


# Plan resources request 3 (deprecated endpoint)
POST {{protocol}}://{{host}}:{{port}}/api/x/plan/resources
Content-Type: application/json
file,requests/plan_resources/req3.json;
HTTP/* 200
[Asserts]
header "Content-Type" == "application/json"
jsonpath "$.action" == "view-as-vip"
jsonpath "$.resourceKind" == "album:object"
jsonpath "$.policyVersion" == "default"
jsonpath "$.filter.kind" == "KIND_CONDITIONAL"
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.owner \"1\")"


# Plan resources request 4
POST {{protocol}}://{{host}}:{{port}}/api/plan/resources
Content-Type: application/json
Expand All @@ -96,20 +54,6 @@ jsonpath "$.filter.kind" == "KIND_ALWAYS_DENIED"
jsonpath "$.meta.filterDebug" == "NO_MATCH"


# Plan resources request 4 (deprecated endpoint)
POST {{protocol}}://{{host}}:{{port}}/api/x/plan/resources
Content-Type: application/json
file,requests/plan_resources/req4.json;
HTTP/* 200
[Asserts]
header "Content-Type" == "application/json"
jsonpath "$.action" == "view"
jsonpath "$.resourceKind" == "album:object"
jsonpath "$.policyVersion" == "nonexistent"
jsonpath "$.filter.kind" == "KIND_ALWAYS_DENIED"
jsonpath "$.meta.filterDebug" == "NO_MATCH"


# Plan resources request 5 (scoped policies)
POST {{protocol}}://{{host}}:{{port}}/api/plan/resources
Content-Type: application/json
Expand All @@ -122,17 +66,3 @@ jsonpath "$.resourceKind" == "leave_request"
jsonpath "$.filter.kind" == "KIND_CONDITIONAL"
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.owner \"john\")"
jsonpath "$.meta.matchedScope" == "acme.hr.uk"


# Plan resources request 5 (scoped policies, deprecated endpoint)
POST {{protocol}}://{{host}}:{{port}}/api/x/plan/resources
Content-Type: application/json
file,requests/plan_resources/req5.json;
HTTP/* 200
[Asserts]
header "Content-Type" == "application/json"
jsonpath "$.action" == "delete"
jsonpath "$.resourceKind" == "leave_request"
jsonpath "$.filter.kind" == "KIND_CONDITIONAL"
jsonpath "$.meta.filterDebug" == "(eq request.resource.attr.owner \"john\")"
jsonpath "$.meta.matchedScope" == "acme.hr.uk"
1 change: 0 additions & 1 deletion internal/server/tests.go
Expand Up @@ -323,7 +323,6 @@ func (tr *TestRunner) checkCORS(c *http.Client, hostAddr string) func(*testing.T
"/admin/policy",
"/admin/schema",
"/admin/store",
"/api/x/plan/resources",
"/api/plan/resources",
}

Expand Down
35 changes: 0 additions & 35 deletions schema/openapiv2/cerbos/svc/v1/svc.swagger.json
Expand Up @@ -694,41 +694,6 @@
"CerbosService"
]
}
},
"/api/x/plan/resources": {
"post": {
"summary": "Plan resources",
"description": "Produce a query plan with conditions that must be satisfied for accessing a set of instances of a resource",
"operationId": "CerbosService_PlanResources2",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1PlanResourcesResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"description": "PDP Resources Query Plan Request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1PlanResourcesRequest"
}
}
],
"tags": [
"CerbosService"
]
}
}
},
"definitions": {
Expand Down

0 comments on commit 5fa9390

Please sign in to comment.