Skip to content

Commit

Permalink
merge: Merge pull request #77 from ArunaStorage/features-workspaces-l…
Browse files Browse the repository at this point in the history
…ist-object-hooks

[feature] Features: workspaces, list object v2, hooks
  • Loading branch information
St4NNi authored Jun 21, 2023
2 parents 52d20e9 + 4677e34 commit 207f0e9
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aruna/api/google
Submodule google updated 919 files
106 changes: 106 additions & 0 deletions aruna/api/hooks/services/v1/hooks_service.proto
Original file line number Diff line number Diff line change
@@ -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;
}
93 changes: 93 additions & 0 deletions aruna/api/storage/services/v1/collection_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
44 changes: 42 additions & 2 deletions aruna/api/storage/services/v1/object_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -342,18 +342,31 @@ 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) = {
get : "/v1/path/collection/{path=**}"
};
}

// 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
Expand Down Expand Up @@ -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;
}



12 changes: 12 additions & 0 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ fn compile_services() -> Result<(), Box<dyn std::error::Error>> {
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 {
Expand Down

0 comments on commit 207f0e9

Please sign in to comment.