2021-02-01 23:23:12 +01:00
|
|
|
@0xe89d197dcef9c49b;
|
|
|
|
|
|
|
|
using CSharp = import "programming_language/csharp.capnp";
|
|
|
|
$CSharp.namespace("FabAccessAPI.Schema");
|
|
|
|
|
2022-11-01 11:54:01 +01:00
|
|
|
using import "resource.capnp".Resource;
|
2024-04-15 16:28:23 +02:00
|
|
|
using import "resource.capnp".RestoredResource;
|
2023-11-23 12:36:28 +01:00
|
|
|
using import "claim.capnp".Claim;
|
2024-04-16 15:03:10 +02:00
|
|
|
using import "utils.capnp".SturdyRef;
|
|
|
|
using import "utils.capnp".Fallible;
|
2024-05-06 14:26:32 +02:00
|
|
|
using import "projects.capnp".Project;
|
|
|
|
using import "auth.capnp".Authentication;
|
2021-02-01 23:23:12 +01:00
|
|
|
|
2022-10-31 15:19:56 +01:00
|
|
|
interface Resources {
|
2024-04-15 16:28:23 +02:00
|
|
|
restore @0 () -> ( resources :List(RestoredResource) );
|
2023-11-23 12:36:28 +01:00
|
|
|
# Returns the list of valid claims the session owner of this `Resources` currently has.
|
2022-10-31 15:19:56 +01:00
|
|
|
|
|
|
|
list @1 () -> ( resources :List(Resource) );
|
2024-03-30 19:20:42 +01:00
|
|
|
# Returns all resources that the user can currently disclose.
|
2022-10-31 15:19:56 +01:00
|
|
|
|
2024-05-07 13:25:42 +02:00
|
|
|
getByName @2 ( name :Text ) -> Fallible(Resource, GetError);
|
2024-03-30 19:20:42 +01:00
|
|
|
# Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource.
|
2022-10-31 15:19:56 +01:00
|
|
|
|
2024-05-07 13:25:42 +02:00
|
|
|
getByUrn @3 ( urn :Text ) -> Fallible(Resource, GetError);
|
2024-03-30 19:20:42 +01:00
|
|
|
# Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource.
|
|
|
|
|
2024-05-07 13:25:42 +02:00
|
|
|
getByUrl @4 ( url :Text ) -> Fallible(Resource, GetError);
|
2024-03-30 19:20:42 +01:00
|
|
|
# Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource.
|
2024-04-15 16:28:23 +02:00
|
|
|
|
2024-05-07 13:25:42 +02:00
|
|
|
struct GetError {
|
|
|
|
notFound @0 :Void;
|
|
|
|
}
|
|
|
|
|
2024-05-06 14:26:32 +02:00
|
|
|
acceptToken @5 ( token :SturdyRef, project :Project ) -> Fallible(Claim, AcceptTokenError);
|
|
|
|
|
|
|
|
acceptTokenSubstituteUser @7 ( token :SturdyRef, project :Project )
|
|
|
|
-> Fallible(Authentication(Claim), AcceptTokenError);
|
2024-04-16 15:03:10 +02:00
|
|
|
|
2024-04-16 15:54:47 +02:00
|
|
|
setAlias @6 ( original_resource_id :Text ) -> ( alias_id :Text );
|
|
|
|
# Replace any set alias for the given resource id with a newly generated
|
|
|
|
# random id. The new ID is returned as `alias_id`.
|
|
|
|
|
2024-04-16 15:03:10 +02:00
|
|
|
struct AcceptTokenError {
|
|
|
|
permissionDenied @0 :Void;
|
|
|
|
}
|
2021-08-29 12:18:24 +02:00
|
|
|
}
|