diff --git a/aruna/api/google b/aruna/api/google index 804400c5..5d285a64 160000 --- a/aruna/api/google +++ b/aruna/api/google @@ -1 +1 @@ -Subproject commit 804400c54989a1a7431c04ccc33b3e0595232004 +Subproject commit 5d285a6449c121ece5ee29305f4856464648fa96 diff --git a/aruna/api/hooks/services/v1/hooks_service.proto b/aruna/api/hooks/services/v1/hooks_service.proto new file mode 100644 index 00000000..16a4ca06 --- /dev/null +++ b/aruna/api/hooks/services/v1/hooks_service.proto @@ -0,0 +1,106 @@ +syntax = "proto3"; + +package aruna.api.hooks.services.v1; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_outer_classname = "HooksService"; + +import "aruna/api/storage/models/v1/models.proto"; + +// HooksService +// +// Status: ALPHA +// +// A service that enables automatic Hook scheduling +service HooksService { + rpc CreateHook(CreateHookRequest) returns (CreateHookResponse) {} + rpc ListHooks(ListHooksRequest) returns (ListHooksResponse) {} + rpc DeleteHook(DeleteHookRequest) returns (DeleteHookResponse) {} + rpc HookCallback(HookCallbackRequest) returns (HookCallbackResponse) {} +} + +enum TriggerType { + TRIGGER_TYPE_UNSPECIFIED = 0; + TRIGGER_TYPE_HOOK_ADDED = 1; +} + +message Trigger { + TriggerType trigger_type = 1; + string key = 2; + string value = 3; +} + +message ExternalHook { + string url = 1; + Credentials credentials = 2; + string json_template = 3; +} + +enum InternalAction { + INTERNAL_ACTION_UNSPECIFIED = 0; + INTERNAL_ACTION_ADD_LABEL = 1; + INTERNAL_ACTION_ADD_HOOK = 2; + INTERNAL_ACTION_CREATE_READ_REFERENCE = 3; + INTERNAL_ACTION_CREATE_WRITE_REFERENCE = 4; +} + +message InternalHook { + InternalAction internal_action = 1; + // Either key or target ID + string target_id = 2; + // Optional value + string value = 3; +} + +message Hook { + oneof hook_type { + ExternalHook external_hook = 1; + InternalHook internal_hook = 2; + } +} + +// Will be updated with additional credential types +message Credentials { + string token = 1; +} + +message CreateHookRequest { + Trigger trigger = 1; + Hook hook = 2; + uint64 timeout = 3; + string project_id = 4; +} +message CreateHookResponse { + string hook_id = 1; +} + +message DeleteHookRequest { + string hook_id = 1; +} + +message DeleteHookResponse {} + +message HookCallbackRequest { + bool success = 1; + repeated aruna.api.storage.models.v1.KeyValue labels = 2; + repeated aruna.api.storage.models.v1.KeyValue hooks = 3; +} + +message HookCallbackResponse{} + +message ListHooksRequest{ + string project_id = 1; +} + + +message HookInfo { + string hook_id = 1; + Hook hook = 2; + Trigger trigger = 3; + uint64 timeout = 4; +} + +message ListHooksResponse{ + repeated HookInfo infos = 1; +} \ No newline at end of file diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v1/collection_service.proto index 296d8eee..505ee1be 100644 --- a/aruna/api/storage/services/v1/collection_service.proto +++ b/aruna/api/storage/services/v1/collection_service.proto @@ -109,8 +109,101 @@ service CollectionService { } } + +// WorkspaceService +// +// Service to manage "special" anonymous collections / workspaces +service WorkspaceService { + // CreateWorkspace + // + // Status: ALPHA + // + // A new request to create a personal anonymous workspace + rpc CreateWorkspace(CreateWorkspaceRequest) + returns (CreateWorkspaceResponse) { + option (google.api.http) = { + post : "/v1/workspace" + body : "*" + }; + } + + + // DeleteWorkspace + // + // Status: ALPHA + // + // Delete a workspace + rpc DeleteWorkspace(DeleteWorkspaceRequest) + returns (DeleteWorkspaceResponse) { + option (google.api.http) = { + delete : "/v1/workspace/{workspace_id}" + body : "*" + }; + } + + // DeleteWorkspace + // + // Status: ALPHA + // + // Claims an anonymous workspace, and transfers the owner to a regular user account. + rpc ClaimWorkspace(ClaimWorkspaceRequest) + returns (ClaimWorkspaceResponse) { + option (google.api.http) = { + post : "/v1/workspace/{workspace_id}/claim" + body : "*" + }; + } + + // MoveWorkspaceData + // + // Status: ALPHA + // + // Claims an anonymous workspace + rpc MoveWorkspaceData(MoveWorkspaceDataRequest) + returns (MoveWorkspaceDataResponse) { + option (google.api.http) = { + post : "/v1/workspace/{workspace_id}/move/{collection_id}" + body : "*" + }; + } +} + // Models: +message CreateWorkspaceRequest { + string project_name = 1; +} + +message CreateWorkspaceResponse{ + string workspace_id = 1; + string token = 2; + string access_key = 3; + string secret_key = 4; +} + +message DeleteWorkspaceRequest { + string workspace_id = 1; +} + +message DeleteWorkspaceResponse {} + +message ClaimWorkspaceRequest { + // This can only be called by an registered user, + // that is in possesion of the workspace_id and workspace token + // It will remove the service account and claim all references "as" the user. + string workspace_id = 1; + string token = 2; +} + +message ClaimWorkspaceResponse {} + +message MoveWorkspaceDataRequest { + string workspace_id = 1; + string collection_id = 2; +} + +message MoveWorkspaceDataResponse {} + message CreateNewCollectionRequest { // Collection name string name = 1; diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v1/object_service.proto index b775b7eb..8764b8c5 100644 --- a/aruna/api/storage/services/v1/object_service.proto +++ b/aruna/api/storage/services/v1/object_service.proto @@ -342,11 +342,11 @@ service ObjectService { }; } - // GetObjectsByPath + // GetProjectCollectionIdsByPath // // Status: BETA // - // Gets a specific object by object_path + // Gets a specific project and collection_id by object_path // !! Paths are collection specific !! rpc GetProjectCollectionIdsByPath(GetProjectCollectionIdsByPathRequest) returns (GetProjectCollectionIdsByPathResponse) { option (google.api.http) = { @@ -354,6 +354,19 @@ service ObjectService { }; } + // GetObjectsAsListV2 + // + // Status: ALPHA + // + // Gets a list of objects represented similar to a S3 ListObjectsV2 request + // !! Paths are collection specific !! + rpc GetObjectsAsListV2(GetObjectsAsListV2Request) returns (GetObjectsAsListV2Response) { + option (google.api.http) = { + get : "/v1/path/objects/listv2" + }; + } + + } // Models @@ -795,3 +808,30 @@ message GetObjectsByPathResponse { repeated storage.models.v1.Object object = 3; } + +message GetObjectsAsListV2Request { + // Required + string bucket = 1; + optional string continuation_token = 2; + optional string delimiter = 3; + optional uint32 max_keys = 4; + optional string prefix = 5; + optional string start_after = 6; +} + +message CommonPrefix { + string prefix = 1; +} + +message GetObjectsAsListV2Response { + string name = 1; + bool is_truncated = 2; + uint32 max_keys = 4; + uint32 key_count = 5; + repeated storage.models.v1.Object contents = 6; + repeated CommonPrefix prefixes = 7; + optional string next_continuation_token = 8; +} + + + diff --git a/tests/build.rs b/tests/build.rs index 43f61b88..2423281a 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -46,6 +46,18 @@ fn compile_services() -> Result<(), Box> { protos.push(rel_path); } + let service_entries = fs::read_dir("aruna/api/hooks/services/v1/")?; + + for entry in service_entries { + let dir = entry?; + let rel_path = format!( + "{}{}", + "aruna/api/hooks/services/v1/", + dir.file_name().to_str().unwrap().to_string() + ); + protos.push(rel_path); + } + let service_entries = fs::read_dir("aruna/api/internal/v1/")?; for entry in service_entries {