From ac1893c8a60e12fd3a91db6d062420d3898c497e Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:37:40 +0200 Subject: [PATCH 01/51] feat: Remove internal proxy service --- aruna/api/internal/v1/proxy.proto | 157 ------------------------------ 1 file changed, 157 deletions(-) delete mode 100644 aruna/api/internal/v1/proxy.proto diff --git a/aruna/api/internal/v1/proxy.proto b/aruna/api/internal/v1/proxy.proto deleted file mode 100644 index 867d6968..00000000 --- a/aruna/api/internal/v1/proxy.proto +++ /dev/null @@ -1,157 +0,0 @@ -syntax = "proto3"; - -package aruna.api.internal.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/internal/v1"; -import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/storage/services/v1/object_service.proto"; -import "google/api/visibility.proto"; - -// Definition for the internal API that is used to communicate with all internal -// components. -// -// All uploads should follow this procedure: -// 1. Init a new upload. -// 2. Create a Upload Presigned URL (The URL should contain a specifier for the -// upload and part id) -// 3. Use the presigned URL to upload individual parts, 1-x times. -// 4. When all parts are uploaded, call FinishPresignedUpload to complete the -// upload and provide the parts list. - -service InternalProxyService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc InitMultipartUpload(InitMultipartUploadRequest) - returns (InitMultipartUploadResponse) {} - rpc FinishMultipartUpload(FinishMultipartUploadRequest) - returns (FinishMultipartUploadResponse) {} - rpc DeleteObject(DeleteObjectRequest) returns (DeleteObjectResponse) {} -} - -// This service enables a "return" channel for dataproxy to aruna server communication -// Mainly used to notify the backend of validation / move events after the upload of new files -service InternalProxyNotifierService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc GetOrCreateObjectByPath(GetOrCreateObjectByPathRequest) returns (GetOrCreateObjectByPathResponse) {} - rpc FinalizeObject(FinalizeObjectRequest) returns (FinalizeObjectResponse) {} - rpc GetOrCreateEncryptionKey(GetOrCreateEncryptionKeyRequest) returns (GetOrCreateEncryptionKeyResponse) {} - rpc GetObjectLocation(GetObjectLocationRequest) returns (GetObjectLocationResponse) {} - rpc GetCollectionByBucket(GetCollectionByBucketRequest) returns (GetCollectionByBucketResponse) {} -} - -// Enum to support multiple target Locations. -enum LocationType { - LOCATION_TYPE_UNSPECIFIED = 0; - LOCATION_TYPE_S3 = 1; - LOCATION_TYPE_FILE = 2; -} - -// Locations is the path to the requested data. -message Location { - LocationType type = 1; - string bucket = 2; // This is the bucket name for S3. This is the folder name - // for local file. - string path = - 3; // This is the key name for S3. This is the file name for local file. - string endpoint_id = 4; - bool is_compressed = 5; - bool is_encrypted = 6; - string encryption_key = 7; -} - -// Etag / Part combination to finish a presigned multipart upload. -message PartETag { - int64 part_number = 1; - string etag = 2; -} - -message InitMultipartUploadRequest { - string path = 1; - string object_id = 2; - string collection_id = 3; -} - -message InitMultipartUploadResponse { string upload_id = 1; } - -message FinishMultipartUploadRequest { - string upload_id = 1; - string path = 2; - string object_id = 3; - string collection_id = 4; - repeated PartETag part_etags = 5; -} - -message FinishMultipartUploadResponse {} - -message DeleteObjectRequest { - Location location = 1; -} - -message DeleteObjectResponse {} - -message FinalizeObjectRequest { - string object_id = 1; // This should be stored temporarily - string collection_id = 2; // This should be stored temporarily - Location location = 3; // This will be the final location of the object - repeated aruna.api.storage.models.v1.Hash hashes = 4; - int64 content_length = 5; -} - -message FinalizeObjectResponse {} - -message GetOrCreateEncryptionKeyRequest { - string path = 1; - string hash = 2; - string endpoint_id = 3; -} - -message GetOrCreateEncryptionKeyResponse { - string encryption_key = 1; - bool created = 2; -} - -message GetOrCreateObjectByPathRequest { - string path = 1; - string access_key = 2; // Validate if the user has correct permissions - aruna.api.storage.services.v1.StageObject object = 3; // Will only be used if no staging object exists - bool get_only = 4; // Should this only get the object NOT create -> fail - string endpoint_id = 5; -} - -message GetOrCreateObjectByPathResponse { - string object_id = 1; - string collection_id = 2; - aruna.api.storage.models.v1.DataClass dataclass = 3; - repeated aruna.api.storage.models.v1.Hash hashes = 4; - int64 revision_number = 5; - bool created = 6; -} - - -message GetObjectLocationRequest { - string path = 1; - string revision_id = 2; - string access_key = 3; - string endpoint_id = 4; -} - -message CORSConfig { - repeated string allowed_methods = 1; - repeated string allowed_origins = 2; - repeated string allowed_headers = 3; -} - -message GetObjectLocationResponse { - aruna.api.storage.models.v1.Object object = 1; - Location location = 2; - repeated CORSConfig cors_configurations = 3; -} - -message GetCollectionByBucketRequest { - string bucket = 1; - string access_key = 2; -} - -message GetCollectionByBucketResponse { - string project_id = 1; - string collection_id = 2; -} - From bdeb211a0091498f0de91ef67877fffff63cf5c4 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:38:18 +0200 Subject: [PATCH 02/51] feat: Remove internal notification service --- aruna/api/internal/v1/notification.proto | 139 ----------------------- 1 file changed, 139 deletions(-) delete mode 100644 aruna/api/internal/v1/notification.proto diff --git a/aruna/api/internal/v1/notification.proto b/aruna/api/internal/v1/notification.proto deleted file mode 100644 index dbb6713e..00000000 --- a/aruna/api/internal/v1/notification.proto +++ /dev/null @@ -1,139 +0,0 @@ -syntax = "proto3"; - -package aruna.api.internal.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/internal/v1"; - -import "google/api/visibility.proto"; -import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/notification/services/v1/notification_service.proto"; - -// Service hosted by the notification service application -// the API server emits events to the notification service -// Server --> Notification System -service InternalEventEmitterService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc EmitEvent(EmitEventRequest) returns (EmitEventResponse) {} -} - -// Service that allows the notification service to issue requests -// to the server application -// Notification System --> Server -service InternalEventService { - option (google.api.api_visibility).restriction = "INTERNAL"; - - rpc CreateStreamGroup(CreateStreamGroupRequest) returns (CreateStreamGroupResponse) {} - rpc GetStreamGroup(GetStreamGroupRequest) returns (GetStreamGroupResponse) {} - rpc DeleteStreamGroup(DeleteStreamGroupRequest) returns (DeleteStreamGroupResponse) {} - rpc GetSharedRevision(GetSharedRevisionRequest) returns (GetSharedRevisionResponse) {} -} - -// ------------ InternalEventEmitterService ------------------------- - -message EmittedResource { - oneof resource { - ProjectResource project = 1; - CollectionResource collection = 2; - ObjectResource object = 3; - ObjectGroupResource object_group = 4; - } -} - -message ProjectResource { - string project_id = 1; -} - -message CollectionResource { - string project_id = 1; - string collection_id = 2; -} - -message ObjectResource { - string project_id = 1; - string collection_id = 2; - string shared_object_id = 3; - string object_id = 4; -} - -message ObjectGroupResource { - string project_id = 1; - string collection_id = 2; - string shared_object_group_id = 3; - string object_group_id = 4; -} - -message EmitEventRequest{ - // The resource Type e.g. Collection / Object etc. - aruna.api.storage.models.v1.ResourceType event_resource = 1; - // The resource ID - string resource_id = 2; - // Event type (CRUD) - notification.services.v1.EventType event_type = 3; - // All relations of the resource, only parents are shown - repeated EmittedResource resources = 4; -} - -message EmitEventResponse{} - - -// ------------ InternalEventService ------------------------- - -message StreamGroup { - // Stream group ID - string id = 1; - // Event this streamgroup is listening for - notification.services.v1.EventType event_type = 2; - // Type of the resource (Collection, Object etc.) - aruna.api.storage.models.v1.ResourceType resource_type = 3; - // Resource ID - string resource_id = 4; - // Should all "sub" resources be included - bool notify_on_sub_resource = 5; -} - -message CreateStreamGroupRequest { - // Authorization for the user who wants to create this stream group - string token = 1; - // Event type - notification.services.v1.EventType event_type = 2; - // Type of the resource (Collection, Object etc.) - aruna.api.storage.models.v1.ResourceType resource_type = 3; - // Resource ID - string resource_id = 4; - // Should all "sub" resources be included - bool notify_on_sub_resource = 5; - // Subject derived from a resource hierarchy - string subject = 6; -} - -message CreateStreamGroupResponse { - // The stream_group - StreamGroup stream_group = 1; -} -message GetStreamGroupRequest { - // User token - string token = 1; - // Stream group ID - string stream_group_id = 2; -} -message GetStreamGroupResponse { - // Stream group - StreamGroup stream_group = 1; -} -message DeleteStreamGroupRequest { - // User token - string token = 1; - // Stream group ID - string stream_group_id = 2; -} -message DeleteStreamGroupResponse {} - -message GetSharedRevisionRequest { - // Resource Type (ObjectGroup or Object) - aruna.api.storage.models.v1.ResourceType resource_type = 1; - // Resource ID - string resource_id = 2; -} -message GetSharedRevisionResponse { - // Shared revision ID - string shared_revision_id = 1; -} \ No newline at end of file From 0e98b956abfe8303b99ddc3c81466d6fb9d17470 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:38:38 +0200 Subject: [PATCH 03/51] feat: Remove internal bundler service --- aruna/api/internal/v1/bundler.proto | 63 ----------------------------- 1 file changed, 63 deletions(-) delete mode 100644 aruna/api/internal/v1/bundler.proto diff --git a/aruna/api/internal/v1/bundler.proto b/aruna/api/internal/v1/bundler.proto deleted file mode 100644 index 1ab1706e..00000000 --- a/aruna/api/internal/v1/bundler.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; - -package aruna.api.internal.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/internal/v1"; - -import "google/api/visibility.proto"; -import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/internal/v1/proxy.proto"; - - - -service InternalBundlerService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc PrepareBundle(PrepareBundleRequest) returns (PrepareBundleResponse) {} - rpc EnableBundle(EnableBundleRequest) returns (EnableBundleResponse) {} - rpc InvalidateBundle(InvalidateBundleRequest) returns (InvalidateBundleResponse) {} -} - -service InternalBundlerBackchannelService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc GetBundles(GetBundlesRequest) returns (GetBundlesResponse) {} -} - - -message PrepareBundleRequest { - string bundle_id = 1; -} - -message PrepareBundleResponse {} - - -message ObjectRef { - aruna.api.internal.v1.Location object_location = 1; - aruna.api.storage.models.v1.Object object_info = 2; - string sub_path = 3; -} - -message Bundle { - string bundle_id = 1; - repeated ObjectRef object_refs = 2; - google.protobuf.Timestamp expires_at = 3; -} - -message EnableBundleRequest{ - Bundle bundle = 1; -} - -message EnableBundleResponse{} - -message GetBundlesRequest { - string endpoint_id = 1; -} - -message GetBundlesResponse { - repeated Bundle bundles = 1; -} - -message InvalidateBundleRequest { - string bundle_id = 1; -} - -message InvalidateBundleResponse {} \ No newline at end of file From ec1ab42a6698973326ee32064154b2d324e17f3a Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:39:04 +0200 Subject: [PATCH 04/51] feat: Remove internal authorize service --- aruna/api/internal/v1/authorize.proto | 67 --------------------------- 1 file changed, 67 deletions(-) delete mode 100644 aruna/api/internal/v1/authorize.proto diff --git a/aruna/api/internal/v1/authorize.proto b/aruna/api/internal/v1/authorize.proto deleted file mode 100644 index 7a91daf7..00000000 --- a/aruna/api/internal/v1/authorize.proto +++ /dev/null @@ -1,67 +0,0 @@ -syntax = "proto3"; - -package aruna.api.internal.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/internal/v1"; - -import "google/api/visibility.proto"; -import "aruna/api/storage/models/v1/models.proto"; - -service InternalAuthorizeService { - option (google.api.api_visibility).restriction = "INTERNAL"; - rpc Authorize(AuthorizeRequest) returns (AuthorizeResponse) {} - rpc GetSecret(GetSecretRequest) returns (GetSecretResponse) {} - rpc GetTokenFromSecret(GetTokenFromSecretRequest) returns (GetTokenFromSecretResponse) {} -} - -message Authorization { - // Should include the APItoken - string secretkey = 1; - // Is the API-Token ID - string accesskey = 2; -} - -enum IdType { - ID_TYPE_UNSPECIFIED = 0; - ID_TYPE_UUID = 1; - ID_TYPE_PATH = 2; -} - -message Identifier { - string name = 1; - IdType idtype = 2; -} - -message AuthorizeRequest{ - // The resource type - aruna.api.storage.models.v1.ResourceType resource = 1; - // Id of the resource (PATH / OBJECT UUID) - Identifier identifier = 2; - // Which action should be performed (CRUD) - aruna.api.storage.models.v1.ResourceAction resource_action = 3; - // Authorization - Authorization authorization = 4; -} - -message AuthorizeResponse { - // Ok -> Authorization granted, empty or not ok -> dismiss - bool ok = 1; -} - -message GetSecretRequest { - string accesskey = 1; -} - -message GetSecretResponse { - Authorization authorization = 1; -} - - -message GetTokenFromSecretRequest { - Authorization authorization = 1; -} - -message GetTokenFromSecretResponse { - string token = 1; -} - - From a263399de12b6f0ebeadefd454d44e3ba03b34b4 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:40:08 +0200 Subject: [PATCH 05/51] feat: Remove bundler service -> will be part of object --- .../bundler/services/v1/bundler_service.proto | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 aruna/api/bundler/services/v1/bundler_service.proto diff --git a/aruna/api/bundler/services/v1/bundler_service.proto b/aruna/api/bundler/services/v1/bundler_service.proto deleted file mode 100644 index ae75bb63..00000000 --- a/aruna/api/bundler/services/v1/bundler_service.proto +++ /dev/null @@ -1,60 +0,0 @@ -syntax = "proto3"; - -package aruna.api.bundler.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 = "BundlerService"; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -// BundlerService -// -// Status: ALPHA -// -// A service that enables bundled downloads -service BundlerService { - rpc CreateBundle(CreateBundleRequest) returns (CreateBundleResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/bundle" - body : "*" - }; - } - rpc DeleteBundle(DeleteBundleRequest) returns (DeleteBundleResponse) { - option (google.api.http) = { - delete : "/v1/collection/{collection_id}/bundle/{bundle_id}" - body : "*" - }; - } -} - -// An resourcetype used to identify generic authorizations -enum ArchiveType { - ARCHIVE_TYPE_UNSPECIFIED = 0; - ARCHIVE_TYPE_TAR_GZ = 1; - ARCHIVE_TYPE_ZIP = 2; - ARCHIVE_TYPE_TAR_ZST = 3; -} - -message CreateBundleRequest { - string collection_id = 1; - repeated string object_ids = 2; - string filename = 3; - ArchiveType archive_type = 4; - google.protobuf.Timestamp expires_at = 5; - // Optional endpoint_id - string endpoint_id = 6; -} - -message CreateBundleResponse { - string bundle_id = 1; - string url = 2; -} - -message DeleteBundleRequest { - string collection_id = 1; - string bundle_id = 2; -} - -message DeleteBundleResponse {} \ No newline at end of file From b6815e600ab95fbd152185732c75cf4011629a16 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:41:38 +0200 Subject: [PATCH 06/51] feat: Remove objectgroups --- .../services/v1/objectgroup_service.proto | 295 ------------------ 1 file changed, 295 deletions(-) delete mode 100644 aruna/api/storage/services/v1/objectgroup_service.proto diff --git a/aruna/api/storage/services/v1/objectgroup_service.proto b/aruna/api/storage/services/v1/objectgroup_service.proto deleted file mode 100644 index 29ad48dd..00000000 --- a/aruna/api/storage/services/v1/objectgroup_service.proto +++ /dev/null @@ -1,295 +0,0 @@ -syntax = "proto3"; - -package aruna.api.storage.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 = "ObjectGroupService"; - -import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/storage/models/v1/query.proto"; - -import "google/api/annotations.proto"; - - -// ObjectService -// -// Contains all methods that get/create or update Objects and associated resource -service ObjectGroupService { - - // CreateObjectGroup - // - // Status: STABLE - // - // This creates a new ObjectGroup in the collection - rpc CreateObjectGroup(CreateObjectGroupRequest) - returns (CreateObjectGroupResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/group" - body : "*" - }; - } - - // UpdateObjectGroup - // - // Status: STABLE - // - // This creates an updated ObjectGroup - // ObjectGroups are immutable - // Updating an ObjectGroup will create a new Revision of the ObjectGroup - rpc UpdateObjectGroup(UpdateObjectGroupRequest) - returns (UpdateObjectGroupResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/group/{group_id}" - body : "*" - }; - } - - // GetObjectGroupById - // - // Status: STABLE - // - // This gets a specific ObjectGroup by ID - // By default the latest revision is always returned, older revisions need to - // be specified separately - rpc GetObjectGroupById(GetObjectGroupByIdRequest) - returns (GetObjectGroupByIdResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/group/{group_id}" - }; - } - - // GetObjectGroupsFromObject - // - // Status: STABLE - // - // This gets all ObjectGroups associated to a specific - // Object Objects can be part of multiple ObjectGroups at once - rpc GetObjectGroupsFromObject(GetObjectGroupsFromObjectRequest) - returns (GetObjectGroupsFromObjectResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/groups" - }; - } - - // GetObjectGroups - // - // Status: STABLE - // - // This is a request that returns a (paginated) list of - // ObjectGroups that contain a specific set of labels. - rpc GetObjectGroups(GetObjectGroupsRequest) - returns (GetObjectGroupsResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/groups" - }; - } - - // GetObjectGroupHistory - // - // Status: BETA - // - // This requests a full history with all objectgroups - // that are part of this objectgroups history - rpc GetObjectGroupHistory(GetObjectGroupHistoryRequest) - returns (GetObjectGroupHistoryResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/group/{group_id}/history" - }; - } - - // GetObjectGroupObjects - // - // Status: STABLE - // - // Requests a list of paginated objects associated with this - // specific objectgroup - rpc GetObjectGroupObjects(GetObjectGroupObjectsRequest) - returns (GetObjectGroupObjectsResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/group/{group_id}/objects" - }; - } - // DeleteObjectGroup - // - // Status: STABLE - // - // This is a request that deletes a specified ObjectGroup - // This does not delete the associated Objects - rpc DeleteObjectGroup(DeleteObjectGroupRequest) - returns (DeleteObjectGroupResponse) { - option (google.api.http) = { - delete : "/v1/collection/{collection_id}/group/{group_id}" - }; - } - // AddLabelsToObjectGroup - // - // Status: STABLE - // - // This is a specific request to add new label(s) - // to an existing object_group, in contrast to UpdateObjectGroup - // this will not create a new revision for the specific object_group - // Instead it will directly add the specified label(s) to the object_group - rpc AddLabelsToObjectGroup(AddLabelsToObjectGroupRequest) - returns (AddLabelsToObjectGroupResponse) { - option (google.api.http) = { - patch : "/v1/collection/{collection_id}/group/{group_id}/add_labels" - body : "*" - }; - } -} -// Models -// This section contains the models for each individual Request and -// corresponding Response - -message CreateObjectGroupRequest { - // ObjectGroup name - string name = 1; - // Description for group - string description = 2; - // Collection Id - string collection_id = 3; - // This is the reference to the Objects that should be added to the group - repeated string object_ids = 4; - // This is a reference to the Objects that are associated with "meta" data - // about corresponding objects in the group - repeated string meta_object_ids = 5; - // List of label key-value pairs - repeated storage.models.v1.KeyValue labels = 6; - // List of hooks key-value pairs - repeated storage.models.v1.KeyValue hooks = 7; -} - -message CreateObjectGroupResponse { - // Overview of the new objectgroup - storage.models.v1.ObjectGroupOverview object_group = 1; -} - -message UpdateObjectGroupRequest { - // Old group id - string group_id = 1; - // New name - string name = 2; - // New description - string description = 3; - // Collection id - string collection_id = 4; - // This is the reference to the Objects that should be added to the group - repeated string object_ids = 5; - // This is a reference to the Objects that are associated with "meta" data - // about corresponding objects in the group - repeated string meta_object_ids = 6; - // List of label key-value pairs - repeated storage.models.v1.KeyValue labels = 7; - // List of hooks key-value pairs - repeated storage.models.v1.KeyValue hooks = 8; -} - -message UpdateObjectGroupResponse { - // Overview of the updated objectgroup - storage.models.v1.ObjectGroupOverview object_group = 1; -} - -message GetObjectGroupByIdRequest { - // Object group id - string group_id = 1; - // Collection id - string collection_id = 2; -} - -message GetObjectGroupByIdResponse { - // Overview of the objectgroup - storage.models.v1.ObjectGroupOverview object_group = 1; -} - -message GetObjectGroupsFromObjectRequest { - // Object id - string object_id = 1; - // Collection id - string collection_id = 2; - // Page request - storage.models.v1.PageRequest page_request = 3; -} - -message GetObjectGroupsFromObjectResponse { - // Overviews of multiple objectgroups - storage.models.v1.ObjectGroupOverviews object_groups = 1; -} - -message DeleteObjectGroupRequest { - // Objectgroup id - string group_id = 1; - // Collection id - string collection_id = 2; - // with revisions - bool with_revisions = 3; -} - -message DeleteObjectGroupResponse {} - -message GetObjectGroupsRequest { - // Collection id - string collection_id = 1; - // Paginate the results: Default is 20 - storage.models.v1.PageRequest page_request = 2; - // Filter by Labels (optional) OR request a specific list of ObjectGroups - storage.models.v1.LabelOrIDQuery label_id_filter = 3; -} - -message GetObjectGroupsResponse { - // Overviews of multiple objectgroups - storage.models.v1.ObjectGroupOverviews object_groups = 1; -} - -message GetObjectGroupHistoryRequest { - // Collection id - string collection_id = 1; - // Objectgroup id - string group_id = 2; - // Pagerequest - storage.models.v1.PageRequest page_request = 3; -} - -message GetObjectGroupHistoryResponse { - // Overviews of multiple objectgroups - storage.models.v1.ObjectGroupOverviews object_groups = 1; -} - -message GetObjectGroupObjectsRequest { - // Collection id - string collection_id = 1; - // Objectgroup id - string group_id = 2; - // Pagerequest - storage.models.v1.PageRequest page_request = 3; - // Include meta objects only - bool meta_only = 4; // Should only the "meta" objects be returned -} - -// Objectgroup objects are a combination of "object" and the boolean is_metadata -// flag Returned as single list to allow for more precise queries -message ObjectGroupObject { - // Object - storage.models.v1.Object object = 1; - // Is this objet a meta object - bool is_metadata = 2; -} - -message GetObjectGroupObjectsResponse { - // List of associated object group objects - repeated ObjectGroupObject object_group_objects = 1; -} - -message AddLabelsToObjectGroupRequest { - // Collection id - string collection_id = 1; - // ObjectGroup id - string group_id = 2; - // List of labels that should be added to the list of labels - repeated storage.models.v1.KeyValue labels_to_add = 3; -} - -message AddLabelsToObjectGroupResponse { - // Returns the updated ObjectGroup - storage.models.v1.ObjectGroupOverview object_group = 1; -} \ No newline at end of file From 7cb41ef7aa46bf70e703d98470c31ba53cd91722 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:49:52 +0200 Subject: [PATCH 07/51] feat: Refactor auth proto_files --- aruna/api/storage/models/v1/auth.proto | 19 +++--- aruna/api/storage/models/v1/models.proto | 61 ------------------- .../services/v1/endpoint_service.proto | 6 +- .../storage/services/v1/user_service.proto | 2 +- 4 files changed, 13 insertions(+), 75 deletions(-) diff --git a/aruna/api/storage/models/v1/auth.proto b/aruna/api/storage/models/v1/auth.proto index 76cff229..21f2e039 100644 --- a/aruna/api/storage/models/v1/auth.proto +++ b/aruna/api/storage/models/v1/auth.proto @@ -50,9 +50,8 @@ enum Permission { PERMISSION_NONE = 1; // No permissions granted, used for users that are in the // project but have no default permissions PERMISSION_READ = 2; // Read only - PERMISSION_APPEND = - 3; // Append objects to the collection cannot modify existing objects - PERMISSION_MODIFY = 4; // Can Read/Append/Modify objects in the collection + PERMISSION_APPEND = 3; // Append objects to the collection cannot modify existing objects + PERMISSION_WRITE = 4; // Can Read/Append/Modify objects in the collection // that owns the object / Create new collections PERMISSION_ADMIN = 5; // Can modify the collections itself and permanently // delete owned objects / move ownership of objects @@ -74,14 +73,16 @@ enum TokenType { message Token { string id = 1; string name = 2; - TokenType token_type = 4; google.protobuf.Timestamp created_at = 5; google.protobuf.Timestamp expires_at = 6; - string collection_id = 7; - string project_id = 8; - Permission permission = 9; - bool is_session = 10; - google.protobuf.Timestamp used_at = 11; + oneof resource_id { + string collection_id = 7; + string project_id = 8; + bool personal = 9; + } + Permission permission = 10; + bool is_session = 11; + google.protobuf.Timestamp used_at = 12; } message ProjectPermission { diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index 06a6545b..415cfe6e 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -71,12 +71,6 @@ message CollectionStats { google.protobuf.Timestamp last_updated = 3; } -// Stats for an object group -message ObjectGroupStats { - Stats object_stats = 1; - google.protobuf.Timestamp last_updated = 2; -} - // Semver version -> Alpha Beta release are not supported -> Use "latest" for // mutable collections that are in development message Version { @@ -215,60 +209,6 @@ message Object { // Multiple Objects message Objects { repeated Object objects = 1; } -// ObjectGroups are optional and can be used to group objects in a collection -// together They need to refer to objects in the same collection Objectgroups -// can be changed if the collection is mutable -message ObjectGroup { - string id = 1; - string name = 2; - string description = 3; - repeated KeyValue labels = 6; - repeated KeyValue hooks = 7; - repeated Object objects = 8; // Must be in collection objects - repeated Object meta_objects = 9; // Must be in collection objects - ObjectGroupStats stats = 10; - int64 rev_number = 11; -} - -// Multiple ObjectGroups -message ObjectGroups { repeated ObjectGroup object_groups = 1; } - -// This is a representation of the ObjectGroup without the recursive nature of -// object references -message ObjectGroupOverview { - string id = 1; - string name = 2; - string description = 3; - repeated KeyValue labels = 6; - repeated KeyValue hooks = 7; - ObjectGroupStats stats = 8; - int64 rev_number = 9; -} - -// Multiple ObjectGroupOverviews -message ObjectGroupOverviews { - repeated ObjectGroupOverview object_group_overviews = 1; -} - -// This is a representation of the ObjectGroup with only ObjectIDs instead of -// full objects -message ObjectGroupWithID { - string id = 1; - string name = 2; - string description = 3; - repeated KeyValue labels = 6; - repeated KeyValue hooks = 7; - repeated string object_ids = 8; // Must be in collection objects - repeated string meta_object_ids = 9; // Must be in collection objects - ObjectGroupStats stats = 10; - int64 rev_number = 11; -} - -// Multiple ObjectGroupWithIDs -message ObjectGroupWithIDs { - repeated ObjectGroupWithID object_group_with_ids = 1; -} - // RULES for Collections: // 1. Each object is "owned" by one/or more collections // 2. Objects can be in multiple collections and must be in the owner collection @@ -290,7 +230,6 @@ message Collection { google.protobuf.Timestamp created = 7; repeated Object objects = 8; repeated Object specifications = 9; - repeated ObjectGroup object_groups = 10; oneof version { Version semantic_version = 12; bool latest = 13; diff --git a/aruna/api/storage/services/v1/endpoint_service.proto b/aruna/api/storage/services/v1/endpoint_service.proto index 8f4e1d33..6784bf24 100644 --- a/aruna/api/storage/services/v1/endpoint_service.proto +++ b/aruna/api/storage/services/v1/endpoint_service.proto @@ -87,12 +87,10 @@ message AddEndpointRequest { string documentation_path = 5; // Is this endpoint public bool is_public = 6; - // (optional) ED25519 Pubkey -> Pubkey to validate endpoint authenticated tokens + // required public_key string pubkey = 7; - // Added option to make a Dataproxy a bundler - bool is_bundler = 8; // List of EndpointHostConfigs - repeated storage.models.v1.EndpointHostConfig host_configs = 9; + repeated storage.models.v1.EndpointHostConfig host_configs = 8; } message AddEndpointResponse { diff --git a/aruna/api/storage/services/v1/user_service.proto b/aruna/api/storage/services/v1/user_service.proto index c5b6d4fb..028c7a3e 100644 --- a/aruna/api/storage/services/v1/user_service.proto +++ b/aruna/api/storage/services/v1/user_service.proto @@ -43,7 +43,7 @@ service UserService { }; } - // ActivateUser + // ActivateUser // // Status: STABLE // From 517a25c453f1294f40fa4b0008974515afb4952a Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:50:50 +0200 Subject: [PATCH 08/51] feat: Remove query models --- aruna/api/storage/models/v1/query.proto | 33 ------------------------- 1 file changed, 33 deletions(-) delete mode 100644 aruna/api/storage/models/v1/query.proto diff --git a/aruna/api/storage/models/v1/query.proto b/aruna/api/storage/models/v1/query.proto deleted file mode 100644 index ad16bc85..00000000 --- a/aruna/api/storage/models/v1/query.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -package aruna.api.storage.models.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v1"; - -import "aruna/api/storage/models/v1/models.proto"; - -// This file contains parameters for queries that return a list of resources. -// The results are paginated. -// The page request specifies the page size and last_id. -// If page_size is not specified, it defaults to 20. -// If page_size is -1, it returns all objects. -message PageRequest { - string last_uuid = 1; // This is the last ID of the previous returned request - int64 page_size = 2; // Default to 20, -1 for all -} - -// LabelFilter is used to filter resources by labels. -// The labels are specified as a map of key-value pairs. -message LabelFilter { - repeated KeyValue labels = 1; - // True if and, if empty or false or - bool and_or_or = 2; - // Should only the keys be considered ? - bool keys_only = 3; -} - -// This is a combined query for either a list of resource IDs or filtered by -// Label Can be expanded in the future to allow for more complex queries -message LabelOrIDQuery { - LabelFilter labels = 1; - repeated string ids = 2; -} From 0da624d3a173d3287c9b0c34cd5ebd521f27e674 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:53:47 +0200 Subject: [PATCH 09/51] feat: Refactor endpoint_service, remove hierarchy part from info service --- .../storage/services/v1/info_service.proto | 54 ++----------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/aruna/api/storage/services/v1/info_service.proto b/aruna/api/storage/services/v1/info_service.proto index 0da94d6c..b809cb9b 100644 --- a/aruna/api/storage/services/v1/info_service.proto +++ b/aruna/api/storage/services/v1/info_service.proto @@ -4,7 +4,7 @@ package aruna.api.storage.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 = "InfoService"; +option java_outer_classname = "StorageStatusService"; import "aruna/api/storage/models/v1/models.proto"; @@ -12,33 +12,12 @@ import "google/api/visibility.proto"; import "google/api/annotations.proto"; -// ResourceInfoService -// -// This is a generic service that contains utility functions -// these functions are used to query additional meta-information -// about resources -service ResourceInfoService { - - option (google.api.api_visibility).restriction = "UNFINISHED"; - // GetResourceHierarchy - // - // This requests a hierarchy based on one resource (object / objectgroup or collection) - // and returns a hierarchy with all associated higherlevel objects up to projects. - // Needs projects level read access. - rpc GetResourceHierarchy(GetResourceHierarchyRequest) returns (GetResourceHierarchyResponse) { - option (google.api.http) = { - get : "/v1/info/resource/hierarchy" - }; - } -} - - -// StorageInfoService +// StorageStatusService // // This is a generic service that contains utility functions // these functions are used to query additional meta-information // about the status of the overall storage architecture -service StorageInfoService { +service StorageStatusService { // GetStorageVersion // @@ -65,33 +44,6 @@ service StorageInfoService { } - -message GetResourceHierarchyRequest { - string resource_id = 1; - storage.models.v1.ResourceType resource_type = 2; -} - -message Hierarchy { - // Starting with one object id - // (might be empty if higher is queried) - string object_id = 1; - // 0..n object groups per object in one collection - repeated string object_group_ids = 2; - // one collection - string collection_id = 3; - // one project - string project_id = 4; -} - -message GetResourceHierarchyResponse { - // Returns a list of hierarchies - // for collections n will be 1 - // for objects this might contain more than one hierarchy - // starting with the object_id but different collections / objectgroups - repeated Hierarchy hierarchies = 1; -} - - message GetStorageVersionRequest {} From b673dbac84fb446115c300c0e7c193faaf3212cf Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 21:57:52 +0200 Subject: [PATCH 10/51] feat: Refactor models --- aruna/api/storage/models/v1/models.proto | 41 +++--------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index 415cfe6e..b179d933 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -10,21 +10,13 @@ message KeyValue { string value = 2; } -message LabelOntology { - // These are the keys for labels that are required for the collection - // Adding an Object without these keys will result in an error - // Defaults to empty string if not specified - repeated string required_label_keys = 1; -} - // An resourcetype used to identify generic authorizations enum ResourceType { RESOURCE_TYPE_UNSPECIFIED = 0; RESOURCE_TYPE_PROJECT = 1; RESOURCE_TYPE_COLLECTION = 2; - RESOURCE_TYPE_OBJECT_GROUP = 3; - RESOURCE_TYPE_OBJECT = 4; - RESOURCE_TYPE_ALL = 5; + RESOURCE_TYPE_OBJECT = 3; + RESOURCE_TYPE_ALL = 4; } // Used for the internal associated services to validate permissions @@ -45,7 +37,7 @@ enum Status { STATUS_AVAILABLE = 2; STATUS_UNAVAILABLE = 3; STATUS_ERROR = 4; - STATUS_TRASH = 5; + STATUS_DELETED = 5; STATUS_FINALIZING = 6; } @@ -67,7 +59,6 @@ message Stats { // Stats for a collection message CollectionStats { Stats object_stats = 1; - int64 object_group_count = 2; google.protobuf.Timestamp last_updated = 3; } @@ -80,18 +71,9 @@ message Version { } enum Hashalgorithm { - - reserved 2, 4 to 7; - HASHALGORITHM_UNSPECIFIED = 0; - HASHALGORITHM_MD5 = 1; - //HASHALGORITHM_SHA1 = 2; - HASHALGORITHM_SHA256 = 3; - //HASHALGORITHM_SHA512 = 4; - //HASHALGORITHM_MURMUR3A32 = 5; - //HASHALGORITHM_XXHASH32 = 6; - //HASHALGORITHM_SHA224 = 7; + HASHALGORITHM_SHA256 = 2; } message Hash { @@ -99,27 +81,12 @@ message Hash { string hash = 2; } -// Specifies the Origin of the object -//enum OriginType { -// ORIGIN_TYPE_UNSPECIFIED = 0; -// ORIGIN_TYPE_USER = 1; // User uploaded the object -// ORIGIN_TYPE_OBJCLONE = 2; // Object was cloned from another object -//} - -// Origin of the object -> To be GDPA compliant -message Origin { - reserved 1; - //OriginType type = 1; - string id = 2; -} - // Dataclass defines the confidentiality of the object enum DataClass { DATA_CLASS_UNSPECIFIED = 0; DATA_CLASS_PUBLIC = 1; DATA_CLASS_PRIVATE = 2; DATA_CLASS_CONFIDENTIAL = 3; - DATA_CLASS_PROTECTED = 4; } message Source { From e473915668464b54194beb3e3073e1be0da74772 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 22:23:41 +0200 Subject: [PATCH 11/51] feat: Update object + relations --- aruna/api/storage/models/v1/models.proto | 123 ++++++++++++++--------- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index b179d933..b0122323 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -89,19 +89,6 @@ enum DataClass { DATA_CLASS_CONFIDENTIAL = 3; } -message Source { - // This is a URL / DOI - string identifier = 1; - // Either URL oder DOI - SourceType source_type = 2; -} - -enum SourceType { - SOURCE_TYPE_UNSPECIFIED = 0; - SOURCE_TYPE_URL = 1; - SOURCE_TYPE_DOI = 2; -} - enum EndpointType { ENDPOINT_TYPE_UNSPECIFIED = 0; ENDPOINT_TYPE_S3 = 1; @@ -135,6 +122,45 @@ message Endpoint { repeated EndpointHostConfig host_configs = 11; } + +// A first draft for possible relation types +// That should be introduced by us +enum RelationType { + RELATION_TYPE_UNSPECIFIED = 0; // DO NOT USE + RELATION_TYPE_CROSSREF = 1; // Crossref -> URL + RELATION_TYPE_ORIGIN = 2; // Crossref -> Objectid + RELATION_TYPE_METADATA = 3; // Data -> Metadata link + RELATION_TYPE_SPECIFICATION = 4; // Specification for metadata etc. + RELATION_TYPE_DATASET = 5; // Part of Dataset -> To "bundle", dataset objects +} + +// A Link is a connection to other data, +// this can either be +// A: An URL (DOI, crossref, etc.) +// B: Another Object +message Link { + oneof identifier { + string object_id = 1; + string url = 2; + } + string relation_type = 3; +} + +message Relation { + // A relation can be outbound or inbound + // Most of the time relations are updated bidirectional + oneof relation { + Link describes = 1; + Link described_by = 2; + } + // Relation is either a custom string type, or a predefined type + oneof relationtype { + RelationType relation_type = 3; + string custom_relation = 4; + } + string relation_id = 5; // Relations are revisioned and share a common ID to track whats changed +} + // RULES for Objects: // 1. Each object is "owned" by one/or more collections // 2. Objects can be "borrowed" to multiple other collections @@ -152,30 +178,33 @@ message Endpoint { // the owner collection message Object { - reserved 11; - - string id = 1; // ObjectID - string filename = 2; // Filename: Name of the original file e.g.: mydata.json - repeated KeyValue labels = 4; // Labels to additionally describe the object - repeated KeyValue hooks = 5; // Hooks to be executed on the object - google.protobuf.Timestamp created = 6; - int64 content_len = 7; // Lenght of the stored dataset - Status status = 8; - Origin origin = 9; // Origin of the object - DataClass data_class = 10; // Confidentiality of the object - repeated Hash hashes = 16; // MD5 and SHA256 hash of the data - int64 rev_number = 12; // Increasing revion number for each update - Source source = 13; // External source where this data originates from - - bool latest = 14; // Is this the latest version of the object? - // This is a collection specific attribute - // Must be false if collection is immutable - bool auto_update = 15; // If true, the object will be updated automatically + string id = 1; // ObjectID + string filename = 2; // Filename: Name of the original file e.g.: mydata.json + repeated KeyValue labels = 3; // Labels to additionally describe the object + repeated KeyValue hooks = 4; // Hooks to be executed on the object + google.protobuf.Timestamp created = 5; + int64 content_len = 6; // Length of the stored dataset + Status status = 7; + repeated Relation relations = 8; // Relations to other objects / external URLs -> Replaces Objectgroups + DataClass data_class = 9; // Confidentiality of the object + repeated Hash hashes = 10; // MD5 and SHA256 hash of the data + int64 rev_number = 11; // Increasing revion number for each update + bool latest = 12; // Is this the latest version of the object? } // Multiple Objects message Objects { repeated Object objects = 1; } +message FullObjectReference { + Object object = 1; + bool auto_update = 2; +} + +message ObjectIdReference { + string object_id = 1; + bool auto_update = 2; +} + // RULES for Collections: // 1. Each object is "owned" by one/or more collections // 2. Objects can be in multiple collections and must be in the owner collection @@ -189,20 +218,20 @@ message Objects { repeated Object objects = 1; } message Collection { string id = 1; - string name = 2; // Should be unique in authgroup + string name = 2; // Should be unique in authgroup string description = 3; repeated KeyValue labels = 4; repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels + FullObjectReference label_policy = 6; // Policy file for label ontology google.protobuf.Timestamp created = 7; - repeated Object objects = 8; - repeated Object specifications = 9; + repeated FullObjectReference objects = 8; + repeated FullObjectReference specifications = 9; oneof version { Version semantic_version = 12; bool latest = 13; } CollectionStats stats = 14; - bool is_public = 15; + DataClass dataclass = 15; } // Multiple Collections @@ -216,14 +245,14 @@ message CollectionOverview { string description = 3; repeated KeyValue labels = 4; repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels + Object label_policy = 6; // Policy file for label ontology google.protobuf.Timestamp created = 7; oneof version { Version semantic_version = 12; bool latest = 13; } CollectionStats stats = 14; - bool is_public = 15; + DataClass dataclass = 15; } // Multiple CollectionOverviews @@ -233,24 +262,22 @@ message CollectionOverviews { // This is a representation of the Collection with only Resource RevisionIDs // instead of full objects -message CollectionWithID { +message CollectionWithId { string id = 1; - string name = 2; + string name = 2; // Should be unique in authgroup string description = 3; repeated KeyValue labels = 4; repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels + ObjectIdReference label_policy = 6; // Policy file for label ontology google.protobuf.Timestamp created = 7; - repeated string objects = 8; - repeated string specifications = 9; - repeated string object_groups = 10; + repeated ObjectIdReference objects = 8; + repeated ObjectIdReference specifications = 9; oneof version { Version semantic_version = 12; bool latest = 13; } CollectionStats stats = 14; - bool is_public = 15; + DataClass dataclass = 15; } - // Multiple CollectionWithIDs -message CollectionWithIDs { repeated CollectionWithID collection_with_ids = 1; } \ No newline at end of file +message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } \ No newline at end of file From 531890537d3b8a9e4438a48f708a053870493537 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 22:29:37 +0200 Subject: [PATCH 12/51] feat: Refactor collection service --- .../services/v1/collection_service.proto | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v1/collection_service.proto index 797c39bf..921f50d0 100644 --- a/aruna/api/storage/services/v1/collection_service.proto +++ b/aruna/api/storage/services/v1/collection_service.proto @@ -228,10 +228,8 @@ message CreateNewCollectionRequest { repeated storage.models.v1.KeyValue labels = 4; // List of associated hooks repeated storage.models.v1.KeyValue hooks = 5; - // Optional LabelOntology with required labels - storage.models.v1.LabelOntology label_ontology = 6; // Optional Dataclass - storage.models.v1.DataClass dataclass = 7; + storage.models.v1.DataClass dataclass = 6; } message CreateNewCollectionResponse { @@ -252,15 +250,15 @@ message GetCollectionByIDResponse { message GetCollectionsRequest { // Project id string project_id = 1; - // (optional) Filter, label or ids - storage.models.v1.LabelOrIDQuery label_or_id_filter = 2; - // (optional) Pagerequest - storage.models.v1.PageRequest page_request = 3; + // Pagination default 50 + string continuation_token = 2; } message GetCollectionsResponse { // List of collection overviews storage.models.v1.CollectionOverviews collections = 1; + // Only included if more than 50 collections will be returned + string continuation_token = 2; } // This updates the collection @@ -277,8 +275,8 @@ message UpdateCollectionRequest { // New list of hooks repeated storage.models.v1.KeyValue hooks = 6; - // (optional) LabelOntology - storage.models.v1.LabelOntology label_ontology = 7; + // (optional) Policy (rego) file for label ontology -> must be valid object_id + string label_policy_object = 7; // Optional update Dataclass, this will not overwrite // the dataclass of all existing associated objects @@ -313,7 +311,7 @@ message DeleteCollectionRequest { // Collection id string collection_id = 1; // Force delete - bool force = 3; + bool force = 2; } message DeleteCollectionResponse {} From 88f680fc8c3d4652953c9c8724ccedc2e47f5b67 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 23:08:32 +0200 Subject: [PATCH 13/51] feat: Update object service --- aruna/api/storage/models/v1/models.proto | 7 + .../services/v1/collection_service.proto | 2 - .../services/v1/endpoint_service.proto | 3 +- .../storage/services/v1/object_service.proto | 196 ++++-------------- 4 files changed, 47 insertions(+), 161 deletions(-) diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index b0122323..2a6bbc2e 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -10,6 +10,11 @@ message KeyValue { string value = 2; } +message PageRequest { + string start_after = 1; // This is the last ID of the previous returned request + int64 page_size = 2; // Default to 20, -1 for all +} + // An resourcetype used to identify generic authorizations enum ResourceType { RESOURCE_TYPE_UNSPECIFIED = 0; @@ -198,11 +203,13 @@ message Objects { repeated Object objects = 1; } message FullObjectReference { Object object = 1; bool auto_update = 2; + string path = 3; } message ObjectIdReference { string object_id = 1; bool auto_update = 2; + string path = 3; } // RULES for Collections: diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v1/collection_service.proto index 921f50d0..fc24f022 100644 --- a/aruna/api/storage/services/v1/collection_service.proto +++ b/aruna/api/storage/services/v1/collection_service.proto @@ -5,10 +5,8 @@ option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; option java_outer_classname = "CollectionService"; - import "aruna/api/storage/models/v1/models.proto"; import "aruna/api/storage/models/v1/query.proto"; - import "google/api/annotations.proto"; // CollectionService diff --git a/aruna/api/storage/services/v1/endpoint_service.proto b/aruna/api/storage/services/v1/endpoint_service.proto index 6784bf24..71cc3517 100644 --- a/aruna/api/storage/services/v1/endpoint_service.proto +++ b/aruna/api/storage/services/v1/endpoint_service.proto @@ -94,9 +94,8 @@ message AddEndpointRequest { } message AddEndpointResponse { - // Overview of the requested endpoint + // Overview of the created endpoint storage.models.v1.Endpoint endpoint = 1; - int64 pubkey_serial = 2; } message GetEndpointRequest { diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v1/object_service.proto index 430ad4b9..eaaa9b8d 100644 --- a/aruna/api/storage/services/v1/object_service.proto +++ b/aruna/api/storage/services/v1/object_service.proto @@ -8,7 +8,6 @@ option java_outer_classname = "ObjectService"; import "aruna/api/storage/models/v1/models.proto"; import "aruna/api/storage/models/v1/query.proto"; - import "google/api/annotations.proto"; // ObjectService @@ -238,6 +237,7 @@ service ObjectService { get : "/v1/collection/{collection_id}/object/{object_id}/endpoints" }; } + // AddLabelsToObject // // Status: STABLE @@ -279,57 +279,20 @@ service ObjectService { get : "/v1/collection/{collection_id}/object/{object_id}/references" }; } - - // GetObjectPath - // - // Status: BETA - // - // Get all object_paths for this object in a specific collection - // !! Paths are collection specific !! - rpc GetObjectPath(GetObjectPathRequest) returns (GetObjectPathResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/path" - }; - } - - // GetObjectPaths - // - // Status: BETA - // - // Get all object_paths for a specific collection - // !! Paths are collection specific !! - rpc GetObjectPaths(GetObjectPathsRequest) returns (GetObjectPathsResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/paths" - }; - } - // CreateObjectPath + // UpdateObjectPath // // Status: BETA // // Create collection_specific object_paths for an object // !! Paths are collection specific !! - rpc CreateObjectPath(CreateObjectPathRequest) returns (CreateObjectPathResponse) { + rpc UpdateObjectPath(UpdateObjectPathRequest) returns (UpdateObjectPathResponse) { option (google.api.http) = { post : "/v1/collection/{collection_id}/object/{object_id}/path" body: "*" }; } - // SetObjectPathVisibility - // - // Status: BETA - // - // Updates the visibility setting for an object_path (hide/unhide) - // !! Paths are collection specific !! - rpc SetObjectPathVisibility(SetObjectPathVisibilityRequest) returns (SetObjectPathVisibilityResponse) { - option (google.api.http) = { - patch : "/v1/collection/{collection_id}/path/{path=**}/visibility" - body: "*" - }; - } - // GetObjectsByPath // // Status: BETA @@ -380,30 +343,22 @@ message URL { } message StageObject { - - reserved 2, 3; - // Filename string filename = 1; - - // Removed fields: - // string description = 2; - // string collection_id = 3; - // Content length - int64 content_len = 4; + int64 content_len = 2; // Source of the object (e.g. wikipedia) - storage.models.v1.Source source = 5; + repeated storage.models.v1.Relation relations = 3; // Dataclass public / private - storage.models.v1.DataClass dataclass = 6; + storage.models.v1.DataClass dataclass = 4; // List of label key-values - repeated storage.models.v1.KeyValue labels = 7; + repeated storage.models.v1.KeyValue labels = 5; // List of hook key-values - repeated storage.models.v1.KeyValue hooks = 8; + repeated storage.models.v1.KeyValue hooks = 6; // (collection specific) sub_path for file // does not include file-, collection- or projectname // final fully-qualified schema: //// - string sub_path = 9; + string sub_path = 7; } message InitializeNewObjectRequest { @@ -415,36 +370,25 @@ message InitializeNewObjectRequest { // this can be used to specify which endpoint this object should use // only needed if it is not the default endpoint for the current server // instance - string preferred_endpoint_id = 4; - // Should the object be uploaded via multipart? - bool multipart = 5; - // Is specification ? - // Should this object contain a specification for the collection ? - bool is_specification = 6; + string preferred_endpoint_id = 3; // (optional) Hash - storage.models.v1.Hash hash = 7; + storage.models.v1.Hash hash = 4; } message InitializeNewObjectResponse { // ObjectId string object_id = 1; - // Upload ID, a ID used to identify the upload / staging object - string upload_id = 2; - // CollectionID - string collection_id = 3; } message GetUploadURLRequest { // ObjectId string object_id = 1; - // Upload ID, a ID used to identify the upload / staging object - string upload_id = 2; // CollectionID - string collection_id = 3; + string collection_id = 2; // Is this a multipart upload? - bool multipart = 4; + bool multipart = 3; // (optional) if multi was initialized - int32 part_number = 5; + int32 part_number = 4; } message GetUploadURLResponse { @@ -495,26 +439,19 @@ message CreateDownloadLinksStreamResponse { URL url = 1; } message FinishObjectStagingRequest { // ObjectId string object_id = 1; - // Always the S3 upload_id - string upload_id = 2; // CollectionID - string collection_id = 3; + string collection_id = 2; // Hash of the uploaded data - used to verify the data integrity. // This supports multiple hashing algorithms. - storage.models.v1.Hash hash = 4; - - // If the staging object had no uploads - // Use this argument to skip the finish upload request - bool no_upload = 5; + storage.models.v1.Hash hash = 3; // If the upload was multipart, this is the list of parts that were uploaded. // Should be empty if the upload was not multipart. // (optional) - repeated CompletedParts completed_parts = 6; - + repeated CompletedParts completed_parts = 4; // Should the object be auto-updated in the collection? // default: false - bool auto_update = 7; + bool auto_update = 5; } message FinishObjectStagingResponse { @@ -523,35 +460,24 @@ message FinishObjectStagingResponse { } message UpdateObjectRequest { - reserved 8; // Existing object ID string object_id = 1; // collection ID string collection_id = 2; // New object data StageObject object = 3; - // Should new data be uploaded ? - bool reupload = 4; // If this is an reupload a preferred endpoint // can be specified by id - string preferred_endpoint_id = 5; - // Should a multipart upload be used? - bool multi_part = 6; - // Is specification ? - // Should this object contain a specification for the collection ? - bool is_specification = 7; + string preferred_endpoint_id = 4; // (optional) Hash - storage.models.v1.Hash hash = 9; + storage.models.v1.Hash hash = 5; } message UpdateObjectResponse { - // ObjectId + // NEW ! ObjectId string object_id = 1; - // Staging ID, a generic ID when multipart is not enabled, otherwise the - // multipart upload ID. - string staging_id = 2; // CollectionID - string collection_id = 3; + string collection_id = 2; } message CreateObjectReferenceRequest { @@ -615,12 +541,9 @@ message DeleteObjectsResponse {} message ObjectWithURL { // Description of a specified object - storage.models.v1.Object object = 1; - // This is a associated download URL - // Will be empty if request does not contain the associated with_url flag + storage.models.v1.FullObjectReference object = 1; + // Download S3 urls string url = 2; - // collection specific paths of object - repeated string paths = 3; } message GetObjectByIDRequest { @@ -628,8 +551,8 @@ message GetObjectByIDRequest { string collection_id = 1; // Object Id string object_id = 2; - // With URL: Include URL in response ? - bool with_url = 4; + // Try to get URL for preferred endpoint + string preferred_endpoint = 3; } message GetObjectByIDResponse { ObjectWithURL object = 1; } @@ -637,12 +560,8 @@ message GetObjectByIDResponse { ObjectWithURL object = 1; } message GetObjectsRequest { // Collection id string collection_id = 1; - // Paginate the results: Default is 20 - storage.models.v1.PageRequest page_request = 2; - // Filter by Labels (optional) OR request a specific list of Objects - storage.models.v1.LabelOrIDQuery label_id_filter = 3; - // With URL: Include URL in response ? - bool with_url = 4; + // Object start after + storage.models.v1.PageRequest page_request = 3; } message GetObjectsResponse { @@ -655,10 +574,8 @@ message GetObjectRevisionsRequest { string collection_id = 1; // Object id string object_id = 2; - // Pagination info + // Object start after storage.models.v1.PageRequest page_request = 3; - // Should the response include download urls ? - bool with_url = 4; } message GetObjectRevisionsResponse { @@ -671,8 +588,6 @@ message GetLatestObjectRevisionRequest { string collection_id = 1; // Object id string object_id = 2; - // Should the response include download urls ? - bool with_url = 3; } message GetLatestObjectRevisionResponse { @@ -739,6 +654,8 @@ message ObjectReference { int64 revision_number = 3; // Is the writeable? bool is_writeable = 4; + // Path of object_ref + string path = 5; } message GetReferencesResponse { @@ -746,49 +663,16 @@ message GetReferencesResponse { repeated ObjectReference references = 1; } -message Path { - string path = 1; - bool visibility = 2; -} - -message GetObjectPathRequest { - string collection_id = 1; - string object_id = 2; - bool include_inactive = 3; -} - -message GetObjectPathResponse { - repeated Path object_paths = 1; -} - -message GetObjectPathsRequest { - string collection_id = 1; - bool include_inactive = 2; -} - -message GetObjectPathsResponse { - repeated Path object_paths = 1; -} - -message CreateObjectPathRequest { - string collection_id = 1; - string object_id = 2; - string sub_path = 3; // Subpath not full path -} - -message CreateObjectPathResponse { - Path path = 1; +message UpdateObjectPathRequest { + string object_id = 1; + string collection_id = 2; + string new_subpath = 3; } -message SetObjectPathVisibilityRequest { - string collection_id = 1; - string path = 2; - bool visibility = 3; +message UpdateObjectPathResponse { + ObjectReference reference = 1; } -message SetObjectPathVisibilityResponse { - Path path = 1; -} message GetObjectsByPathRequest { string path = 1; @@ -805,10 +689,9 @@ message GetProjectCollectionIdsByPathResponse { } message GetObjectsByPathResponse { - repeated storage.models.v1.Object object = 3; + repeated storage.models.v1.FullObjectReference object = 3; } - message GetObjectsAsListV2Request { // Required string bucket = 1; @@ -828,8 +711,7 @@ message GetObjectsAsListV2Response { bool is_truncated = 2; uint32 max_keys = 4; uint32 key_count = 5; - // Does not contain URLs, only paths - repeated ObjectWithURL contents = 6; + repeated storage.models.v1.FullObjectReference contents = 6; repeated CommonPrefix prefixes = 7; optional string next_continuation_token = 8; } From 6982b22ebe87b698b4dfa0a26775f9c8f5f53778 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 23:16:46 +0200 Subject: [PATCH 14/51] feat: Remove functionality to rename project --- aruna/api/storage/services/v1/object_service.proto | 12 ++++++++++++ aruna/api/storage/services/v1/project_service.proto | 6 ++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v1/object_service.proto index eaaa9b8d..faaa89e1 100644 --- a/aruna/api/storage/services/v1/object_service.proto +++ b/aruna/api/storage/services/v1/object_service.proto @@ -330,6 +330,18 @@ service ObjectService { } + // CreateCrossRelation + // + // Status: ALPHA + // + // Adds a relation to an object + rpc CreateCrossRelations(CreateCrossRelationsRequest) returns (CreateCrossRelationsResponse) { + option (google.api.http) = { + post : "/v1/relation" + }; + } + + } // Models diff --git a/aruna/api/storage/services/v1/project_service.proto b/aruna/api/storage/services/v1/project_service.proto index 6fcaf734..e78bbe64 100644 --- a/aruna/api/storage/services/v1/project_service.proto +++ b/aruna/api/storage/services/v1/project_service.proto @@ -218,12 +218,10 @@ message DestroyProjectResponse {} message UpdateProjectRequest { // Project id to update string project_id = 1; - // Updated name - string name = 2; // Update description - string description = 3; + string description = 2; // Project binary flag(s) - int64 flag = 4; + int64 flag = 3; } message UpdateProjectResponse { From 916b621f96b0a98dbb7024f9e32cde4c2374eabb Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Wed, 5 Jul 2023 23:38:44 +0200 Subject: [PATCH 15/51] feat: Remove refs to query.proto --- aruna/api/storage/services/v1/collection_service.proto | 1 - aruna/api/storage/services/v1/endpoint_service.proto | 1 - aruna/api/storage/services/v1/object_service.proto | 1 - 3 files changed, 3 deletions(-) diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v1/collection_service.proto index fc24f022..66f2e022 100644 --- a/aruna/api/storage/services/v1/collection_service.proto +++ b/aruna/api/storage/services/v1/collection_service.proto @@ -6,7 +6,6 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; option java_outer_classname = "CollectionService"; import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/storage/models/v1/query.proto"; import "google/api/annotations.proto"; // CollectionService diff --git a/aruna/api/storage/services/v1/endpoint_service.proto b/aruna/api/storage/services/v1/endpoint_service.proto index 71cc3517..b6b8af14 100644 --- a/aruna/api/storage/services/v1/endpoint_service.proto +++ b/aruna/api/storage/services/v1/endpoint_service.proto @@ -7,7 +7,6 @@ option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.servic option java_outer_classname = "EndpointService"; import "aruna/api/storage/models/v1/models.proto"; - import "google/api/annotations.proto"; diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v1/object_service.proto index faaa89e1..afdb0750 100644 --- a/aruna/api/storage/services/v1/object_service.proto +++ b/aruna/api/storage/services/v1/object_service.proto @@ -7,7 +7,6 @@ option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.servic option java_outer_classname = "ObjectService"; import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/storage/models/v1/query.proto"; import "google/api/annotations.proto"; // ObjectService From 804195285b58737159d51ffe1aae70bd4c951123 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 6 Jul 2023 09:09:17 +0200 Subject: [PATCH 16/51] chore: Update google deps --- aruna/api/google | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aruna/api/google b/aruna/api/google index 511319c6..2b006afc 160000 --- a/aruna/api/google +++ b/aruna/api/google @@ -1 +1 @@ -Subproject commit 511319c6af9172bf12de3e80672b8109c49efd29 +Subproject commit 2b006afc7a392006602ce0868c22341b5aeef4a8 From 020df7497b224317bb9ef2e73c5005ad280b30ad Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 6 Jul 2023 09:24:28 +0200 Subject: [PATCH 17/51] feat: Remove session from token --- aruna/api/storage/models/v1/auth.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aruna/api/storage/models/v1/auth.proto b/aruna/api/storage/models/v1/auth.proto index 21f2e039..10d077fc 100644 --- a/aruna/api/storage/models/v1/auth.proto +++ b/aruna/api/storage/models/v1/auth.proto @@ -81,8 +81,7 @@ message Token { bool personal = 9; } Permission permission = 10; - bool is_session = 11; - google.protobuf.Timestamp used_at = 12; + google.protobuf.Timestamp used_at = 11; } message ProjectPermission { From 7f8c861215e735586f9ea097aa7b1bf05194c361 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 6 Jul 2023 09:41:11 +0200 Subject: [PATCH 18/51] feat: First iteration of ABAC user permissions --- aruna/api/storage/models/v1/auth.proto | 32 ++++++++++++++++++ .../storage/services/v1/user_service.proto | 33 +++++++------------ 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/aruna/api/storage/models/v1/auth.proto b/aruna/api/storage/models/v1/auth.proto index 10d077fc..a74151fe 100644 --- a/aruna/api/storage/models/v1/auth.proto +++ b/aruna/api/storage/models/v1/auth.proto @@ -91,6 +91,38 @@ message ProjectPermission { bool service_account = 4; } +message ResourcePermission { + string resource_id = 1; + Permission permission = 2; +} + + +message CustomAttributes { + string attribute_name = 1; + string attribute_value = 2; +} + +message GlobalAttributes { + bool global_admin = 1; + bool service_account = 2; + repeated CustomAttributes custom_attributes = 3; // This is a placeholder for future additional attributes +} + +message UserAttributes { + GlobalAttributes attributes = 1; + StoragePermissions storage_perms = 2; +} + +// Storage resource specific userpermissions +// Evaluated in Order -> 1: object_deny > 4: collection_permissions etc. +message StoragePermissions { + repeated string object_deny = 1; + repeated ResourcePermission object_permissions = 2; + repeated string collection_deny = 3; + repeated ResourcePermission collection_permissions = 4; + repeated ResourcePermission project_permissions = 5; +} + message ProjectPermissionDisplayName { string user_id = 1; string project_id = 2; diff --git a/aruna/api/storage/services/v1/user_service.proto b/aruna/api/storage/services/v1/user_service.proto index 028c7a3e..24e5fc05 100644 --- a/aruna/api/storage/services/v1/user_service.proto +++ b/aruna/api/storage/services/v1/user_service.proto @@ -187,17 +187,12 @@ service UserService { } } -message ExpiresAt { - // Expiry time - google.protobuf.Timestamp timestamp = 1; -} - message RegisterUserRequest { // user_displayname string display_name = 1; - // Mail address + // Mail address (optional) string email = 2; - // Project description string (optional) + // Project hint description string (optional) string project = 3; } @@ -209,19 +204,19 @@ message RegisterUserResponse { message CreateAPITokenRequest { // Empty if token_type is personal, otherwise the id of the collection or // project to create the token for - - // Project id - string project_id = 1; - // Collection id - string collection_id = 2; // Token name - string name = 3; + string name = 1; + + // Either project or Collection of personal + oneof resource_id { + string collection_id = 2; + string project_id = 3; + bool personal = 4; + } // Token expiry - ExpiresAt expires_at = 4; + google.protobuf.Timestamp expires_at = 5; // Token permissions - storage.models.v1.Permission permission = 5; - // Session token - bool is_session = 6; + storage.models.v1.Permission permission = 6; } message CreateAPITokenResponse { @@ -231,10 +226,6 @@ message CreateAPITokenResponse { // Attention, this can not be recreated and needs to be stored securely // New tokens will always contain a new secret string token_secret = 2; - // S3 Access Key - string s3_access_key = 3; - // S3 Secret Key - string s3_secret_key = 4; } message GetAPITokenRequest { From cf9061608e42089a0c271ef4e4182f2954271aa1 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Tue, 11 Jul 2023 17:03:22 +0200 Subject: [PATCH 19/51] feat: Update user schema --- aruna/api/storage/models/v1/auth.proto | 131 ------------------ aruna/api/storage/models/v1/models.proto | 113 ++++++++++++++- .../storage/services/v1/user_service.proto | 27 ++-- 3 files changed, 120 insertions(+), 151 deletions(-) delete mode 100644 aruna/api/storage/models/v1/auth.proto diff --git a/aruna/api/storage/models/v1/auth.proto b/aruna/api/storage/models/v1/auth.proto deleted file mode 100644 index a74151fe..00000000 --- a/aruna/api/storage/models/v1/auth.proto +++ /dev/null @@ -1,131 +0,0 @@ -syntax = "proto3"; - -package aruna.api.storage.models.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v1"; - -import "google/protobuf/timestamp.proto"; - -// A Project is a list of collections with associated users -// This is used to manage access to multiple collections at the same time -// Each Collection can only be in one Project at a time -message Project { - string id = 1; - string name = 2; - repeated ProjectPermission user_permissions = 3; - repeated string collection_ids = 4; - string description = 5; - // Project binary flag(s) - int64 flags = 6; -} - -message ProjectOverview { - string id = 1; - string name = 2; - string description = 3; - repeated string collection_ids = 4; - repeated string user_ids = 5; - // Project binary flag(s) - int64 flags = 6; -} - -message User { - // Internal Aruna UserID - string id = 1; - // Oidc subject ID - string external_id = 2; - // (optional) User display_name - string display_name = 3; - // Is the user activated - bool active = 4; - // Is the user admin ? - bool is_admin = 5; - // Is service account - bool is_service_account = 6; - // User email (empty if service account) - string email = 7; -} - -enum Permission { - PERMISSION_UNSPECIFIED = 0; - PERMISSION_NONE = 1; // No permissions granted, used for users that are in the - // project but have no default permissions - PERMISSION_READ = 2; // Read only - PERMISSION_APPEND = 3; // Append objects to the collection cannot modify existing objects - PERMISSION_WRITE = 4; // Can Read/Append/Modify objects in the collection - // that owns the object / Create new collections - PERMISSION_ADMIN = 5; // Can modify the collections itself and permanently - // delete owned objects / move ownership of objects -} - -enum PermType { - PERM_TYPE_UNSPECIFIED = 0; - PERM_TYPE_USER = 1; // Regular OAuth users - PERM_TYPE_ANONYMOUS = 2; // Anonymous users without an OAuth token - PERM_TYPE_TOKEN = 3; // Access token on behalf of a user -} - -enum TokenType { - TOKEN_TYPE_UNSPECIFIED = 0; - TOKEN_TYPE_PERSONAL = 1; - TOKEN_TYPE_SCOPED = 2; -} - -message Token { - string id = 1; - string name = 2; - google.protobuf.Timestamp created_at = 5; - google.protobuf.Timestamp expires_at = 6; - oneof resource_id { - string collection_id = 7; - string project_id = 8; - bool personal = 9; - } - Permission permission = 10; - google.protobuf.Timestamp used_at = 11; -} - -message ProjectPermission { - string user_id = 1; - string project_id = 2; - Permission permission = 3; - bool service_account = 4; -} - -message ResourcePermission { - string resource_id = 1; - Permission permission = 2; -} - - -message CustomAttributes { - string attribute_name = 1; - string attribute_value = 2; -} - -message GlobalAttributes { - bool global_admin = 1; - bool service_account = 2; - repeated CustomAttributes custom_attributes = 3; // This is a placeholder for future additional attributes -} - -message UserAttributes { - GlobalAttributes attributes = 1; - StoragePermissions storage_perms = 2; -} - -// Storage resource specific userpermissions -// Evaluated in Order -> 1: object_deny > 4: collection_permissions etc. -message StoragePermissions { - repeated string object_deny = 1; - repeated ResourcePermission object_permissions = 2; - repeated string collection_deny = 3; - repeated ResourcePermission collection_permissions = 4; - repeated ResourcePermission project_permissions = 5; -} - -message ProjectPermissionDisplayName { - string user_id = 1; - string project_id = 2; - Permission permission = 3; - string display_name = 4; -} \ No newline at end of file diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index 2a6bbc2e..f3f6cdbc 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -4,6 +4,75 @@ option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v1" package aruna.api.storage.models.v1; + +message User { + // Internal Aruna UserID + string id = 1; + // Oidc subject ID + repeated string external_id = 2; + // (optional) User display_name + string display_name = 3; + // Is the user activated + bool active = 4; + // User email (empty if service account) + string email = 5; + // User attributes + UserAttributes attributes = 6; +} + + +message ResourcePermission { + oneof resource_id { + string project_id = 1; + string collection_id = 2; + string dataset_id = 3; + string object_id = 4; + bool personal = 5; + } + Permission permission = 6; +} + + +message Token { + string id = 1; + string name = 2; + google.protobuf.Timestamp created_at = 3; + google.protobuf.Timestamp expires_at = 4; + ResourcePermission permission = 5; + google.protobuf.Timestamp used_at = 6; +} + + +message CustomAttributes { + string attribute_name = 1; + string attribute_value = 2; +} + +message GlobalAttributes { + bool global_admin = 1; + bool service_account = 2; + repeated CustomAttributes custom_attributes = 3; // This is a placeholder for future additional attributes +} + +message UserAttributes { + GlobalAttributes attributes = 1; + PersonalPermissions personal_perms = 2; +} + +// Storage resource specific userpermissions +// Evaluated in Order -> 1: object_deny > 4: collection_permissions etc. +message PersonalPermissions { + repeated ResourcePermission deny = 1; + repeated ResourcePermission allow = 2; +} + +message ProjectPermission { + string user_id = 1; + string project_id = 2; + ResourcePermission permission = 3; + bool service_account = 4; +} + // A key value pair for hooks and labels message KeyValue { string key = 1; @@ -147,8 +216,8 @@ message Link { oneof identifier { string object_id = 1; string url = 2; + string custom_identifier = 3; } - string relation_type = 3; } message Relation { @@ -287,4 +356,44 @@ message CollectionWithId { DataClass dataclass = 15; } // Multiple CollectionWithIDs -message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } \ No newline at end of file +message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } + + +// A Project is a list of collections with associated users +// This is used to manage access to multiple collections at the same time +// Each Collection can only be in one Project at a time +message Project { + string id = 1; + string name = 2; + repeated ProjectPermission user_permissions = 3; + repeated string collection_ids = 4; + string description = 5; + // Project binary flag(s) + int64 flags = 6; +} + +message ProjectOverview { + string id = 1; + string name = 2; + string description = 3; + repeated string collection_ids = 4; + repeated string user_ids = 5; + // Project binary flag(s) + int64 flags = 6; +} + + + +enum Permission { + PERMISSION_UNSPECIFIED = 0; + PERMISSION_NONE = 1; // No permissions granted, used for users that are in the + // project but have no default permissions + PERMISSION_READ = 2; // Read only + PERMISSION_APPEND = 3; // Append objects to the collection cannot modify existing objects + PERMISSION_WRITE = 4; // Can Read/Append/Modify objects in the collection + // that owns the object / Create new collections + PERMISSION_ADMIN = 5; // Can modify the collections itself and permanently + // delete owned objects / move ownership of objects +} + + diff --git a/aruna/api/storage/services/v1/user_service.proto b/aruna/api/storage/services/v1/user_service.proto index 24e5fc05..0f8a0d6a 100644 --- a/aruna/api/storage/services/v1/user_service.proto +++ b/aruna/api/storage/services/v1/user_service.proto @@ -6,8 +6,7 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; option java_outer_classname = "UserService"; -import "aruna/api/storage/models/v1/auth.proto"; - +import "aruna/api/storage/models/v1/models.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; @@ -132,7 +131,7 @@ service UserService { rpc UpdateUserDisplayName(UpdateUserDisplayNameRequest) returns (UpdateUserDisplayNameResponse) { option (google.api.http) = { - patch : "/v1/user/display_name" + patch : "/v1/user/{user_id}/display_name" body : "*" }; } @@ -145,7 +144,7 @@ service UserService { rpc UpdateUserEmail(UpdateUserEmailRequest) returns (UpdateUserEmailResponse) { option (google.api.http) = { - patch : "/v1/user/email" + patch : "/v1/user/{user_id}/email" body : "*" }; } @@ -201,22 +200,15 @@ message RegisterUserResponse { string user_id = 1; } + + message CreateAPITokenRequest { - // Empty if token_type is personal, otherwise the id of the collection or - // project to create the token for // Token name string name = 1; - - // Either project or Collection of personal - oneof resource_id { - string collection_id = 2; - string project_id = 3; - bool personal = 4; - } + // Personal or resource specific + storage.models.v1.ResourcePermission permission = 2; // Token expiry - google.protobuf.Timestamp expires_at = 5; - // Token permissions - storage.models.v1.Permission permission = 6; + google.protobuf.Timestamp expires_at = 3; } message CreateAPITokenResponse { @@ -270,14 +262,13 @@ message GetUserRequest { message GetUserResponse { // User info storage.models.v1.User user = 1; - // User permissions per project - repeated storage.models.v1.ProjectPermission project_permissions = 2; } message UpdateUserDisplayNameRequest { // New display name string new_display_name = 1; } + message UpdateUserDisplayNameResponse { // Updated user info storage.models.v1.User user = 1; From 4038741891a1394d1872d857a22788c81c864d63 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Tue, 11 Jul 2023 18:05:53 +0200 Subject: [PATCH 20/51] feat: Update project service v2 --- aruna/api/storage/models/v1/models.proto | 49 +++++++---- .../storage/services/v1/project_service.proto | 83 ++++++++++++++----- 2 files changed, 93 insertions(+), 39 deletions(-) diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v1/models.proto index f3f6cdbc..6652b2a7 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v1/models.proto @@ -73,12 +73,36 @@ message ProjectPermission { bool service_account = 4; } + +enum KeyValueVariant { + KEY_VALUE_VARIANT_UNSPECIFIED = 0; + KEY_VALUE_VARIANT_LABEL = 1; + KEY_VALUE_VARIANT_STATIC_LABEL = 2; + KEY_VALUE_VARIANT_HOOK = 3; +} + // A key value pair for hooks and labels message KeyValue { string key = 1; string value = 2; + KeyValueVariant variant = 3; + bool indexed = 4; +} + +enum RelationVariant { + RELATION_VARIANT_UNSPECIFIED = 0; + RELATION_VARIANT_URL = 1; + RELATION_VARIANT_IDENTIFIER = 2; +} + +message ExternalRelation { + string name = 1; + string identifier = 2; + RelationVariant variant = 3; } + + message PageRequest { string start_after = 1; // This is the last ID of the previous returned request int64 page_size = 2; // Default to 20, -1 for all @@ -365,25 +389,16 @@ message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } message Project { string id = 1; string name = 2; - repeated ProjectPermission user_permissions = 3; - repeated string collection_ids = 4; - string description = 5; - // Project binary flag(s) - int64 flags = 6; -} - -message ProjectOverview { - string id = 1; - string name = 2; - string description = 3; - repeated string collection_ids = 4; - repeated string user_ids = 5; - // Project binary flag(s) - int64 flags = 6; + // Project specific labels / hooks + repeated storage.models.v1.KeyValue key_values = 3; + // External relations (URLs / IDs from external sources) + repeated storage.models.v1.ExternalRelation external_relations = 4; + int64 size = 5; + storage.models.v1.DataClass data_class = 6; + google.protobuf.Timestamp created_at = 7; + string created_by = 8; } - - enum Permission { PERMISSION_UNSPECIFIED = 0; PERMISSION_NONE = 1; // No permissions granted, used for users that are in the diff --git a/aruna/api/storage/services/v1/project_service.proto b/aruna/api/storage/services/v1/project_service.proto index e78bbe64..240e0387 100644 --- a/aruna/api/storage/services/v1/project_service.proto +++ b/aruna/api/storage/services/v1/project_service.proto @@ -6,7 +6,7 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; option java_outer_classname = "ProjectService"; -import "aruna/api/storage/models/v1/auth.proto"; +import "aruna/api/storage/models/v1/models.proto"; import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; @@ -92,29 +92,62 @@ service ProjectService { }; } - // DestroyProject + // DeleteProject // // Status: STABLE // - // Destroys the project and all its associated data. Must be empty - // (cannot contain any collections). - rpc DestroyProject(DestroyProjectRequest) returns (DestroyProjectResponse) { + // Deletes the project and all its associated data. Must be empty! + rpc DeleteProject(DeleteProjectRequest) returns (DeleteProjectResponse) { option (google.api.http) = { delete : "/v1/project/{project_id}" }; } - // UpdateProject + // UpdateProjectName // - // Status: STABLE + // Status: BETA + // + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectName(UpdateProjectNameRequest) returns (UpdateProjectNameResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/name" + }; + } + + // UpdateProjectKeyValues + // + // Status: BETA + // + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValueResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/key_values" + }; + } + + // UpdateProjectExternalRelations + // + // Status: BETA + // + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectExternalRelations(UpdateProjectExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/external_relations" + }; + } + + // UpdateProjectDataClass + // + // Status: BETA // - // Updates the project. All (meta) data will be overwritten. - rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) { + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectDataClass(UpdateProjectDataClassRequest) returns (UpdateProjectDataClassResponse) { option (google.api.http) = { - put : "/v1/project/{project_id}" + patch : "/v2/project/{project_id}/data_class" }; } + // RemoveUserFromProject // // Status: STABLE @@ -170,10 +203,12 @@ service ProjectService { message CreateProjectRequest { // Project name string name = 1; - // Description for the project - string description = 2; - // Project binary flag(s) - int64 flag = 3; + // Project specific labels / hooks + repeated storage.models.v1.KeyValue key_values = 2; + // External relations (URLs / IDs from external sources) + repeated storage.models.v1.ExternalRelation external_relations = 3; + // DataClass + storage.models.v1.DataClass data_class = 4; } message CreateProjectResponse { @@ -182,13 +217,14 @@ message CreateProjectResponse { } message AddUserToProjectRequest { - // The id of the project to add the user to string project_id = 1; - // Permissions for the user - storage.models.v1.ProjectPermission user_permission = 3; + string user_id = 2; + storage.models.v1.Permission permission = 3; } -message AddUserToProjectResponse {} +message AddUserToProjectResponse { + storage.models.v1.ProjectPermission permission = 4; +} message GetProjectRequest { // The id of the project to get @@ -197,23 +233,26 @@ message GetProjectRequest { message GetProjectResponse { // Overview of the projectroject - storage.models.v1.ProjectOverview project = 1; + storage.models.v1.Project project = 1; } message GetProjectsRequest {} message GetProjectsResponse { // Overview of the projects - repeated storage.models.v1.ProjectOverview projects = 1; + repeated storage.models.v1.Project projects = 1; } -message DestroyProjectRequest { +message DeleteProjectRequest { // The id of the project to destroy string project_id = 1; } -message DestroyProjectResponse {} +message DeleteProjectResponse {} + + + message UpdateProjectRequest { // Project id to update From 35daf990a8f7900f36b7cdf86a7b5d707c5d75ad Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 21:05:53 +0200 Subject: [PATCH 21/51] feat: Rename all to v2, updated project_service --- .../services/{v1 => v2}/hooks_service.proto | 12 +- .../{v1 => v2}/notification_service.proto | 12 +- .../storage/models/{v1 => v2}/models.proto | 10 +- .../storage/services/v1/project_service.proto | 313 ------------------ .../services/v2/authorization_service.proto | 0 .../{v1 => v2}/collection_service.proto | 43 +-- .../{v1 => v2}/endpoint_service.proto | 0 .../services/{v1 => v2}/info_service.proto | 0 .../services/{v1 => v2}/object_service.proto | 0 .../storage/services/v2/project_service.proto | 218 ++++++++++++ .../storage/services/v2/search_service.proto | 0 .../{v1 => v2}/service_account_service.proto | 0 .../services/{v1 => v2}/user_service.proto | 0 .../services/v2/workspace_service.proto | 0 14 files changed, 253 insertions(+), 355 deletions(-) rename aruna/api/hooks/services/{v1 => v2}/hooks_service.proto (89%) rename aruna/api/notification/services/{v1 => v2}/notification_service.proto (93%) rename aruna/api/storage/models/{v1 => v2}/models.proto (98%) delete mode 100644 aruna/api/storage/services/v1/project_service.proto create mode 100644 aruna/api/storage/services/v2/authorization_service.proto rename aruna/api/storage/services/{v1 => v2}/collection_service.proto (89%) rename aruna/api/storage/services/{v1 => v2}/endpoint_service.proto (100%) rename aruna/api/storage/services/{v1 => v2}/info_service.proto (100%) rename aruna/api/storage/services/{v1 => v2}/object_service.proto (100%) create mode 100644 aruna/api/storage/services/v2/project_service.proto create mode 100644 aruna/api/storage/services/v2/search_service.proto rename aruna/api/storage/services/{v1 => v2}/service_account_service.proto (100%) rename aruna/api/storage/services/{v1 => v2}/user_service.proto (100%) create mode 100644 aruna/api/storage/services/v2/workspace_service.proto diff --git a/aruna/api/hooks/services/v1/hooks_service.proto b/aruna/api/hooks/services/v2/hooks_service.proto similarity index 89% rename from aruna/api/hooks/services/v1/hooks_service.proto rename to aruna/api/hooks/services/v2/hooks_service.proto index 16a4ca06..74215876 100644 --- a/aruna/api/hooks/services/v1/hooks_service.proto +++ b/aruna/api/hooks/services/v2/hooks_service.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package aruna.api.hooks.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.hooks.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "HooksService"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; // HooksService // @@ -83,8 +83,8 @@ 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; + repeated aruna.api.storage.models.v2.KeyValue labels = 2; + repeated aruna.api.storage.models.v2.KeyValue hooks = 3; } message HookCallbackResponse{} diff --git a/aruna/api/notification/services/v1/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto similarity index 93% rename from aruna/api/notification/services/v1/notification_service.proto rename to aruna/api/notification/services/v2/notification_service.proto index 77002459..db14cfb8 100644 --- a/aruna/api/notification/services/v1/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -1,14 +1,14 @@ syntax = "proto3"; -package aruna.api.notification.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.notification.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "UpdateNotificationServices"; import "google/api/visibility.proto"; import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; @@ -55,7 +55,7 @@ service EventNotificationService { } message CreateEventStreamingGroupRequest { - aruna.api.storage.models.v1.ResourceType resource = 1; + aruna.api.storage.models.v2.ResourceType resource = 1; string resource_id = 2; bool include_subresource = 3; oneof stream_type { @@ -113,7 +113,7 @@ message StreamFromDate { google.protobuf.Timestamp timestamp = 1; } message StreamAll {} message EventNotificationMessage { - aruna.api.storage.models.v1.ResourceType resource = 1; + aruna.api.storage.models.v2.ResourceType resource = 1; string resource_id = 2; EventType updated_type = 3; Reply reply = 4; diff --git a/aruna/api/storage/models/v1/models.proto b/aruna/api/storage/models/v2/models.proto similarity index 98% rename from aruna/api/storage/models/v1/models.proto rename to aruna/api/storage/models/v2/models.proto index 6652b2a7..1d25492a 100644 --- a/aruna/api/storage/models/v1/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -1,8 +1,8 @@ syntax = "proto3"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v1"; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v2"; -package aruna.api.storage.models.v1; +package aruna.api.storage.models.v2; message User { @@ -390,11 +390,11 @@ message Project { string id = 1; string name = 2; // Project specific labels / hooks - repeated storage.models.v1.KeyValue key_values = 3; + repeated storage.models.v2.KeyValue key_values = 3; // External relations (URLs / IDs from external sources) - repeated storage.models.v1.ExternalRelation external_relations = 4; + repeated storage.models.v2.ExternalRelation external_relations = 4; int64 size = 5; - storage.models.v1.DataClass data_class = 6; + storage.models.v2.DataClass data_class = 6; google.protobuf.Timestamp created_at = 7; string created_by = 8; } diff --git a/aruna/api/storage/services/v1/project_service.proto b/aruna/api/storage/services/v1/project_service.proto deleted file mode 100644 index 240e0387..00000000 --- a/aruna/api/storage/services/v1/project_service.proto +++ /dev/null @@ -1,313 +0,0 @@ -syntax = "proto3"; - -package aruna.api.storage.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 = "ProjectService"; - -import "aruna/api/storage/models/v1/models.proto"; - -import "google/api/annotations.proto"; -import "protoc-gen-openapiv2/options/annotations.proto"; - -option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { - info: { - title: "Aruna Object Storage (AOS) REST API"; - version: "1.1.0-rc.8" - }; - // Overwriting host entry breaks tests, so this is not done here. - schemes: HTTPS; - consumes: "application/json"; - produces: "application/json"; - security_definitions: { - security: { - key: "AccessKeyAuth"; - value: { - type: TYPE_API_KEY; - in: IN_HEADER; - name: "Authorization"; - description: "Authentication token, prefixed by Bearer: Bearer " - } - } - } - security: { - security_requirement: { - key: "AccessKeyAuth"; - value: {} - } - } -}; - - -// ProjectService -// -// Contains all methods that get/create or update Projects and associated resources -service ProjectService { - - // CreateProject - // - // Status: STABLE - // - // Creates a new project all users and collections are bundled in a project. - rpc CreateProject(CreateProjectRequest) returns (CreateProjectResponse) { - option (google.api.http) = { - post : "/v1/project" - body : "*" - }; - } - - // AddUserToProject - // - // Status: STABLE - // - // Adds a new user to a given project by its id - rpc AddUserToProject(AddUserToProjectRequest) - returns (AddUserToProjectResponse) { - option (google.api.http) = { - post : "/v1/project/{project_id}/add_user" - body : "*" - }; - } - - // GetProject - // - // Status: STABLE - // - // Requests a project by id - rpc GetProject(GetProjectRequest) returns (GetProjectResponse) { - option (google.api.http) = { - get : "/v1/project/{project_id}" - }; - } - - // GetProjects - // - // Status: STABLE - // - // Admin request to get all projects - rpc GetProjects(GetProjectsRequest) returns (GetProjectsResponse) { - option (google.api.http) = { - get : "/v1/projects" - }; - } - - // DeleteProject - // - // Status: STABLE - // - // Deletes the project and all its associated data. Must be empty! - rpc DeleteProject(DeleteProjectRequest) returns (DeleteProjectResponse) { - option (google.api.http) = { - delete : "/v1/project/{project_id}" - }; - } - - // UpdateProjectName - // - // Status: BETA - // - // Updates the project name. All (meta) data will be overwritten. - rpc UpdateProjectName(UpdateProjectNameRequest) returns (UpdateProjectNameResponse) { - option (google.api.http) = { - patch : "/v2/project/{project_id}/name" - }; - } - - // UpdateProjectKeyValues - // - // Status: BETA - // - // Updates the project name. All (meta) data will be overwritten. - rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValueResponse) { - option (google.api.http) = { - patch : "/v2/project/{project_id}/key_values" - }; - } - - // UpdateProjectExternalRelations - // - // Status: BETA - // - // Updates the project name. All (meta) data will be overwritten. - rpc UpdateProjectExternalRelations(UpdateProjectExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { - option (google.api.http) = { - patch : "/v2/project/{project_id}/external_relations" - }; - } - - // UpdateProjectDataClass - // - // Status: BETA - // - // Updates the project name. All (meta) data will be overwritten. - rpc UpdateProjectDataClass(UpdateProjectDataClassRequest) returns (UpdateProjectDataClassResponse) { - option (google.api.http) = { - patch : "/v2/project/{project_id}/data_class" - }; - } - - - // RemoveUserFromProject - // - // Status: STABLE - // - // Removes a specified user from the project. - rpc RemoveUserFromProject(RemoveUserFromProjectRequest) - returns (RemoveUserFromProjectResponse) { - option (google.api.http) = { - delete : "/v1/project/{project_id}/remove_user" - }; - } - - // GetUserPermissionsForProject - // - // Status: STABLE - // - // Get the user_permission of a specific user for the project. - rpc GetUserPermissionsForProject(GetUserPermissionsForProjectRequest) - returns (GetUserPermissionsForProjectResponse) { - option (google.api.http) = { - get : "/v1/project/{project_id}/get_user" - }; - } - - - // GetAllUserPermissionsForProject - // - // Status: ALPHA - // - // Get the user_permission of a specific user for the project. - rpc GetAllUserPermissionsForProject(GetAllUserPermissionsForProjectRequest) - returns (GetAllUserPermissionsForProjectResponse) { - option (google.api.http) = { - get : "/v1/project/{project_id}/get_users" - }; - } - - - // EditUserPermissionsForProject - // - // Status: STABLE - // - // Modifies the user_permission of a specific user for the project. - rpc EditUserPermissionsForProject(EditUserPermissionsForProjectRequest) - returns (EditUserPermissionsForProjectResponse) { - option (google.api.http) = { - patch : "/v1/project/{project_id}/edit_user" - body : "*" - }; - } -} - -message CreateProjectRequest { - // Project name - string name = 1; - // Project specific labels / hooks - repeated storage.models.v1.KeyValue key_values = 2; - // External relations (URLs / IDs from external sources) - repeated storage.models.v1.ExternalRelation external_relations = 3; - // DataClass - storage.models.v1.DataClass data_class = 4; -} - -message CreateProjectResponse { - // The freshly created project_id - string project_id = 1; -} - -message AddUserToProjectRequest { - string project_id = 1; - string user_id = 2; - storage.models.v1.Permission permission = 3; -} - -message AddUserToProjectResponse { - storage.models.v1.ProjectPermission permission = 4; -} - -message GetProjectRequest { - // The id of the project to get - string project_id = 1; -} - -message GetProjectResponse { - // Overview of the projectroject - storage.models.v1.Project project = 1; -} - -message GetProjectsRequest {} - -message GetProjectsResponse { - // Overview of the projects - repeated storage.models.v1.Project projects = 1; -} - - -message DeleteProjectRequest { - // The id of the project to destroy - string project_id = 1; -} - -message DeleteProjectResponse {} - - - - -message UpdateProjectRequest { - // Project id to update - string project_id = 1; - // Update description - string description = 2; - // Project binary flag(s) - int64 flag = 3; -} - -message UpdateProjectResponse { - // Updated project overview - storage.models.v1.ProjectOverview project = 1; -} - -message RemoveUserFromProjectRequest { - // Project id - string project_id = 1; - // User that should be removed - string user_id = 2; -} - -message RemoveUserFromProjectResponse {} - -message GetUserPermissionsForProjectRequest { - // Project id - string project_id = 1; - // User id - string user_id = 2; -} - -message GetUserPermissionsForProjectResponse { - // Userpermission for a specific user - storage.models.v1.ProjectPermissionDisplayName user_permission = 1; -} - -message EditUserPermissionsForProjectRequest { - // Project id - string project_id = 1; - // This contains the user_id and the "new permission" - storage.models.v1.ProjectPermission user_permission = 2; -} - -message EditUserPermissionsForProjectResponse {} - -message UserWithProjectPermissions { - storage.models.v1.User user = 1; - storage.models.v1.ProjectPermission user_permissions = 2; -} - -message GetAllUserPermissionsForProjectRequest { - // Project id - string project_id = 1; -} - -message GetAllUserPermissionsForProjectResponse { - repeated UserWithProjectPermissions users = 1; -} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/authorization_service.proto b/aruna/api/storage/services/v2/authorization_service.proto new file mode 100644 index 00000000..e69de29b diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto similarity index 89% rename from aruna/api/storage/services/v1/collection_service.proto rename to aruna/api/storage/services/v2/collection_service.proto index 66f2e022..a3f8cc64 100644 --- a/aruna/api/storage/services/v1/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "CollectionService"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; // CollectionService @@ -15,50 +15,43 @@ service CollectionService { // CreateNewCollection // - // Status: STABLE + // Status: BETA // // creates a new Collection - rpc CreateNewCollection(CreateNewCollectionRequest) - returns (CreateNewCollectionResponse) { + rpc CreateCollection(CreateCollectionRequest) + returns (CreateCollectionResponse) { option (google.api.http) = { - post : "/v1/collection" + post : "/v2/collection" body : "*" }; } - // GetCollectionByID + // GetCollection // - // Status: STABLE + // Status: BETA // - // Queries a specific Collection by ID - // The result can be one_of: - // CollectionOverview -> default - // CollectionWithID - // Collection (full) - // This can be modified with the optional OutputFormat parameter - rpc GetCollectionByID(GetCollectionByIDRequest) - returns (GetCollectionByIDResponse) { + // Request a specific collection by ID + rpc GetCollection(GetCollectionRequest) + returns (GetCollectionResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}" + get : "/v2/collection/{collection_id}" }; } // GetCollections // - // Status: STABLE + // Status: BETA // - // queries multiple collections by ID or by LabelFilter - // This returns by default a paginated result with 20 entries. - // Must specify a project_id as context + // Queries multiple collections by ID rpc GetCollections(GetCollectionsRequest) returns (GetCollectionsResponse) { option (google.api.http) = { - get : "/v1/collections/{project_id}" + get : "/v2/collections/" }; } // UpdateCollection // - // Status: STABLE + // Status: BETA // // Updates the current collection // This will update the collection in place if it is unversioned / latest diff --git a/aruna/api/storage/services/v1/endpoint_service.proto b/aruna/api/storage/services/v2/endpoint_service.proto similarity index 100% rename from aruna/api/storage/services/v1/endpoint_service.proto rename to aruna/api/storage/services/v2/endpoint_service.proto diff --git a/aruna/api/storage/services/v1/info_service.proto b/aruna/api/storage/services/v2/info_service.proto similarity index 100% rename from aruna/api/storage/services/v1/info_service.proto rename to aruna/api/storage/services/v2/info_service.proto diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v2/object_service.proto similarity index 100% rename from aruna/api/storage/services/v1/object_service.proto rename to aruna/api/storage/services/v2/object_service.proto diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto new file mode 100644 index 00000000..7dfd8f7c --- /dev/null +++ b/aruna/api/storage/services/v2/project_service.proto @@ -0,0 +1,218 @@ +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "ProjectService"; + +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Aruna Object Storage (AOS) REST API"; + version: "2.0.0-rc.1" + }; + // Overwriting host entry breaks tests, so this is not done here. + schemes: HTTPS; + consumes: "application/json"; + produces: "application/json"; + security_definitions: { + security: { + key: "AccessKeyAuth"; + value: { + type: TYPE_API_KEY; + in: IN_HEADER; + name: "Authorization"; + description: "Authentication token, prefixed by Bearer: Bearer " + } + } + } + security: { + security_requirement: { + key: "AccessKeyAuth"; + value: {} + } + } +}; + + +// ProjectService +// +// Contains all methods that get/create or update Projects and associated resources +service ProjectService { + + // CreateProject + // + // Status: BETA + // + // Creates a new project. All subsequent resources are part of a project. + rpc CreateProject(CreateProjectRequest) returns (CreateProjectResponse) { + option (google.api.http) = { + post : "/v2/project" + body : "*" + }; + } + + // GetProject + // + // Status: BETA + // + // Requests a project (by id) + rpc GetProject(GetProjectRequest) returns (GetProjectResponse) { + option (google.api.http) = { + get : "/v2/project/{project_id}" + }; + } + + // GetProjects + // + // Status: BETA + // + // Admin request to get all projects + rpc GetProjects(GetProjectsRequest) returns (GetProjectsResponse) { + option (google.api.http) = { + get : "/v2/projects" + }; + } + + // DeleteProject + // + // Status: BETA + // + // Deletes the project and all its associated data. Must be empty! + rpc DeleteProject(DeleteProjectRequest) returns (DeleteProjectResponse) { + option (google.api.http) = { + delete : "/v2/project/{project_id}" + }; + } + + // UpdateProjectName + // + // Status: BETA + // + // Updates the project name. Caveat! Will rename the "s3 bucket" for data proxies! + rpc UpdateProjectName(UpdateProjectNameRequest) returns (UpdateProjectNameResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/name" + }; + } + + // UpdateProjectKeyValues + // + // Status: BETA + // + // Updates the project key values. + rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValueResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/key_values" + }; + } + + // UpdateProjectExternalRelations + // + // Status: BETA + // + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectExternalRelations(UpdateProjectExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/external_relations" + }; + } + + // UpdateProjectDataClass + // + // Status: BETA + // + // Updates the project name. All (meta) data will be overwritten. + rpc UpdateProjectDataClass(UpdateProjectDataClassRequest) returns (UpdateProjectDataClassResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/data_class" + }; + } +} + +message CreateProjectRequest { + // Project name + string name = 1; + // Project specific labels / hooks + repeated storage.models.v2.KeyValue key_values = 2; + // External relations (URLs / IDs from external sources) + repeated storage.models.v2.ExternalRelation external_relations = 3; + // DataClass + storage.models.v2.DataClass data_class = 4; +} + +message CreateProjectResponse { + // The freshly created project + storage.models.v2.Project project = 1; +} + +message GetProjectRequest { + // The id of the project to get + string project_id = 1; +} + +message GetProjectResponse { + // Overview of the projectroject + storage.models.v2.Project project = 1; +} + +message GetProjectsRequest { + // optional filter for specific ids + repeated string ids = 1; +} + +message GetProjectsResponse { + // Overview of the projects + repeated storage.models.v2.Project projects = 1; +} + + +message DeleteProjectRequest { + // The id of the project to destroy + string project_id = 1; +} + +message DeleteProjectResponse {} + + +message UpdateProjectNameRequest { + string project_id = 1; + string name = 2; +} + +message UpdateProjectNameResponse { + storage.models.v2.Project project = 1; +} + +message UpdateProjectKeyValuesRequest { + string project_id = 1; + repeated storage.models.v2.KeyValue add_key_values = 2; + repeated storage.models.v2.KeyValue remove_key_values = 3; +} + +message UpdateProjectKeyValueResponse { + storage.models.v2.Project project = 1; +} + +message UpdateProjectExternalRelationsRequest { + string project_id = 1; + repeated storage.models.v2.ExternalRelation add_relations = 2; + repeated storage.models.v2.ExternalRelation remove_relations = 3; +} + +message UpdateProjectExternalRelationsResponse { + storage.models.v2.Project project = 1; +} + +message UpdateProjectDataClassRequest { + string project_id = 1; + storage.models.v2.DataClass data_class = 2; +} + +message UpdateProjectDataClassResponse { + storage.models.v2.Project project = 1; +} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/search_service.proto b/aruna/api/storage/services/v2/search_service.proto new file mode 100644 index 00000000..e69de29b diff --git a/aruna/api/storage/services/v1/service_account_service.proto b/aruna/api/storage/services/v2/service_account_service.proto similarity index 100% rename from aruna/api/storage/services/v1/service_account_service.proto rename to aruna/api/storage/services/v2/service_account_service.proto diff --git a/aruna/api/storage/services/v1/user_service.proto b/aruna/api/storage/services/v2/user_service.proto similarity index 100% rename from aruna/api/storage/services/v1/user_service.proto rename to aruna/api/storage/services/v2/user_service.proto diff --git a/aruna/api/storage/services/v2/workspace_service.proto b/aruna/api/storage/services/v2/workspace_service.proto new file mode 100644 index 00000000..e69de29b From a46bedd80f9b91381dc89fd7a047ab7ef4f5a091 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 21:10:14 +0200 Subject: [PATCH 22/51] feat: Update user_service to v2 --- .../storage/services/v2/user_service.proto | 98 +++++++------------ 1 file changed, 34 insertions(+), 64 deletions(-) diff --git a/aruna/api/storage/services/v2/user_service.proto b/aruna/api/storage/services/v2/user_service.proto index 0f8a0d6a..a6c54728 100644 --- a/aruna/api/storage/services/v2/user_service.proto +++ b/aruna/api/storage/services/v2/user_service.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "UserService"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; @@ -20,60 +20,60 @@ service UserService { // RegisterUser // - // Status: STABLE + // Status: BETA // // This request should be called when a new user logs in for the first time rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse) { option (google.api.http) = { - post : "/v1/auth/register" + post : "/v2/auth/register" body : "*" }; } // DeActivateUser // - // Status: ALPHA + // Status: BETA // // This deactivates a specific user (Admin request) rpc DeactivateUser(DeactivateUserRequest) returns (DeactivateUserResponse) { option (google.api.http) = { - patch : "/v1/user/{user_id}/deactivate" + patch : "/v2/user/{user_id}/deactivate" body : "*" }; } // ActivateUser // - // Status: STABLE + // Status: BETA // // This activates a specific user (Admin request) rpc ActivateUser(ActivateUserRequest) returns (ActivateUserResponse) { option (google.api.http) = { - patch : "/v1/user/{user_id}/activate" + patch : "/v2/user/{user_id}/activate" body : "*" }; } // CreateAPIToken // - // Status: STABLE + // Status: BETA // // Creates an API token to authenticate rpc CreateAPIToken(CreateAPITokenRequest) returns (CreateAPITokenResponse) { option (google.api.http) = { - post : "/v1/auth/token" + post : "/v2/auth/token" body : "*" }; } // GetAPIToken // - // Status: STABLE + // Status: BETA // // Returns one API token by id rpc GetAPIToken(GetAPITokenRequest) returns (GetAPITokenResponse) { option (google.api.http) = { - get : "/v1/auth/token/{token_id}" + get : "/v2/auth/token/{token_id}" }; } @@ -84,7 +84,7 @@ service UserService { // Returns a list of API tokens for a specific user rpc GetAPITokens(GetAPITokensRequest) returns (GetAPITokensResponse) { option (google.api.http) = { - get : "/v1/auth/tokens" + get : "/v2/auth/tokens" }; } @@ -95,19 +95,19 @@ service UserService { // Deletes the specified API Token rpc DeleteAPIToken(DeleteAPITokenRequest) returns (DeleteAPITokenResponse) { option (google.api.http) = { - delete : "/v1/auth/token/{token_id}" + delete : "/v2/auth/token/{token_id}" }; } // DeleteAPITokens // - // Status: STABLE + // Status: BETA // // Deletes the specified API Token rpc DeleteAPITokens(DeleteAPITokensRequest) returns (DeleteAPITokensResponse) { option (google.api.http) = { - delete : "/v1/auth/tokens" + delete : "/v2/auth/tokens" }; } @@ -119,7 +119,7 @@ service UserService { // current user or if invoked by an admin from another user rpc GetUser(GetUserRequest) returns (GetUserResponse) { option (google.api.http) = { - get : "/v1/user" + get : "/v2/user" }; } @@ -131,7 +131,7 @@ service UserService { rpc UpdateUserDisplayName(UpdateUserDisplayNameRequest) returns (UpdateUserDisplayNameResponse) { option (google.api.http) = { - patch : "/v1/user/{user_id}/display_name" + patch : "/v2/user/{user_id}/display_name" body : "*" }; } @@ -144,23 +144,11 @@ service UserService { rpc UpdateUserEmail(UpdateUserEmailRequest) returns (UpdateUserEmailResponse) { option (google.api.http) = { - patch : "/v1/user/{user_id}/email" + patch : "/v2/user/{user_id}/email" body : "*" }; } - // GetUserProjects - // - // Status: STABLE - // - // Gets all project_ids a user is member of - rpc GetUserProjects(GetUserProjectsRequest) - returns (GetUserProjectsResponse) { - option (google.api.http) = { - get : "/v1/user/{user_id}/projects" - }; - } - // GetNotActivatedUsers // // Status: STABLE @@ -169,7 +157,7 @@ service UserService { rpc GetNotActivatedUsers(GetNotActivatedUsersRequest) returns (GetNotActivatedUsersResponse) { option (google.api.http) = { - get : "/v1/user/not_activated" + get : "/v2/user/not_activated" }; } @@ -181,7 +169,7 @@ service UserService { rpc GetAllUsers(GetAllUsersRequest) returns (GetAllUsersResponse) { option (google.api.http) = { - get : "/v1/user/all" + get : "/v2/user/all" }; } } @@ -206,14 +194,14 @@ message CreateAPITokenRequest { // Token name string name = 1; // Personal or resource specific - storage.models.v1.ResourcePermission permission = 2; + storage.models.v2.ResourcePermission permission = 2; // Token expiry google.protobuf.Timestamp expires_at = 3; } message CreateAPITokenResponse { // This contains only the token description - storage.models.v1.Token token = 1; + storage.models.v2.Token token = 1; // This is the actual secret token // Attention, this can not be recreated and needs to be stored securely // New tokens will always contain a new secret @@ -227,14 +215,14 @@ message GetAPITokenRequest { message GetAPITokenResponse { // List of API tokens - storage.models.v1.Token token = 1; + storage.models.v2.Token token = 1; } message GetAPITokensRequest {} message GetAPITokensResponse { // List of API tokens with redacted actual token - repeated storage.models.v1.Token token = 1; + repeated storage.models.v2.Token token = 1; } message DeleteAPITokenRequest { @@ -261,7 +249,7 @@ message GetUserRequest { message GetUserResponse { // User info - storage.models.v1.User user = 1; + storage.models.v2.User user = 1; } message UpdateUserDisplayNameRequest { @@ -271,32 +259,14 @@ message UpdateUserDisplayNameRequest { message UpdateUserDisplayNameResponse { // Updated user info - storage.models.v1.User user = 1; -} -message GetUserProjectsRequest { - // User id - string user_id = 1; -} - -message UserProject { - // Project id - string id = 1; - // Project name - string name = 2; - // Project description - string description = 3; -} - -message GetUserProjectsResponse { - // List of associated projects - repeated UserProject projects = 1; + storage.models.v2.User user = 1; } message ActivateUserRequest { // User to activate string user_id = 1; // (optional) add user to project - storage.models.v1.ProjectPermission project_perms = 2; + storage.models.v2.ProjectPermission project_perms = 2; } message ActivateUserResponse {} @@ -305,7 +275,7 @@ message GetNotActivatedUsersRequest {} message GetNotActivatedUsersResponse { // List of users that are not yet activated - repeated storage.models.v1.User users = 1; + repeated storage.models.v2.User users = 1; } message GetAllUsersRequest { @@ -313,8 +283,8 @@ message GetAllUsersRequest { } message UserWithPerms { - storage.models.v1.User user = 1; - repeated storage.models.v1.ProjectPermission project_perms = 2; + storage.models.v2.User user = 1; + repeated storage.models.v2.ProjectPermission project_perms = 2; } message GetAllUsersResponse { @@ -337,5 +307,5 @@ message UpdateUserEmailRequest { } message UpdateUserEmailResponse { - storage.models.v1.User user = 1; + storage.models.v2.User user = 1; } \ No newline at end of file From 348ebdfbd066ad92b14632b250e352fe573816a1 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 21:32:02 +0200 Subject: [PATCH 23/51] feat: Update permissions made deny just another permission variant --- aruna/api/storage/models/v2/models.proto | 118 +++++++++++++---------- 1 file changed, 68 insertions(+), 50 deletions(-) diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index 1d25492a..f8657eec 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -5,6 +5,22 @@ option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v2" package aruna.api.storage.models.v2; + + + +// ------------- USERS & PERMISSIONS ----------------------- + + +enum PermissionLevel { + PERMISSION_LEVEL_UNSPECIFIED = 0; + PERMISSION_LEVEL_DENY = 1; + PERMISSION_LEVEL_NONE = 2; + PERMISSION_LEVEL_READ = 3; + PERMISSION_LEVEL_APPEND = 4; + PERMISSION_LEVEL_WRITE = 5; + PERMISSION_LEVEL_ADMIN = 6; +} + message User { // Internal Aruna UserID string id = 1; @@ -21,15 +37,14 @@ message User { } -message ResourcePermission { +message Permission { oneof resource_id { string project_id = 1; string collection_id = 2; string dataset_id = 3; string object_id = 4; - bool personal = 5; } - Permission permission = 6; + PermissionLevel permission_level = 6; } @@ -38,8 +53,12 @@ message Token { string name = 2; google.protobuf.Timestamp created_at = 3; google.protobuf.Timestamp expires_at = 4; - ResourcePermission permission = 5; - google.protobuf.Timestamp used_at = 6; + // Tokens can either be personal or resource "specific" + oneof variant { + Permission permission = 5; + bool personal = 6; + } + google.protobuf.Timestamp used_at = 7; } @@ -56,23 +75,10 @@ message GlobalAttributes { message UserAttributes { GlobalAttributes attributes = 1; - PersonalPermissions personal_perms = 2; -} - -// Storage resource specific userpermissions -// Evaluated in Order -> 1: object_deny > 4: collection_permissions etc. -message PersonalPermissions { - repeated ResourcePermission deny = 1; - repeated ResourcePermission allow = 2; -} - -message ProjectPermission { - string user_id = 1; - string project_id = 2; - ResourcePermission permission = 3; - bool service_account = 4; + repeated Permission personal_permissions = 2; } +// --------------- RELATION / KEYVALUES ------------------- enum KeyValueVariant { KEY_VALUE_VARIANT_UNSPECIFIED = 0; @@ -102,6 +108,48 @@ message ExternalRelation { } +enum InternalRelationVariant { + INTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; + INTERNAL_RELATION_VARIANT_BELONGS_TO = 1; + INTERNAL_RELATION_VARIANT_ORIGIN = 2; + INTERNAL_RELATION_VARIANT_DERIVED = 3; + INTERNAL_RELATION_VARIANT_META = 4; +} + +enum RelationDirection { + RELATION_DIRECTION_UNSPECIFIED = 0; + RELATION_DIRECTION_INBOUND = 1; + RELATION_DIRECTION_OUTBOUND = 2; + RELATION_DIRECTION_BIDIRECTIONAL = 3; +} + +message InternalRelation { + string resource_id = 1; + oneof variant { + InternalRelationVariant fixed_variant = 2; + string custom_variant = 3; + } + RelationDirection direction = 4; +} + + +// A Project is a list of collections with associated users +// This is used to manage access to multiple collections at the same time +// Each Collection can only be in one Project at a time +message Project { + string id = 1; + string name = 2; + // Project specific labels / hooks + repeated KeyValue key_values = 3; + // External relations (URLs / IDs from external sources) + repeated ExternalRelation external_relations = 4; + // Internal relations + repeated InternalRelation internal_relation = 5; + int64 size = 6; + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; +} message PageRequest { string start_after = 1; // This is the last ID of the previous returned request @@ -382,33 +430,3 @@ message CollectionWithId { // Multiple CollectionWithIDs message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } - -// A Project is a list of collections with associated users -// This is used to manage access to multiple collections at the same time -// Each Collection can only be in one Project at a time -message Project { - string id = 1; - string name = 2; - // Project specific labels / hooks - repeated storage.models.v2.KeyValue key_values = 3; - // External relations (URLs / IDs from external sources) - repeated storage.models.v2.ExternalRelation external_relations = 4; - int64 size = 5; - storage.models.v2.DataClass data_class = 6; - google.protobuf.Timestamp created_at = 7; - string created_by = 8; -} - -enum Permission { - PERMISSION_UNSPECIFIED = 0; - PERMISSION_NONE = 1; // No permissions granted, used for users that are in the - // project but have no default permissions - PERMISSION_READ = 2; // Read only - PERMISSION_APPEND = 3; // Append objects to the collection cannot modify existing objects - PERMISSION_WRITE = 4; // Can Read/Append/Modify objects in the collection - // that owns the object / Create new collections - PERMISSION_ADMIN = 5; // Can modify the collections itself and permanently - // delete owned objects / move ownership of objects -} - - From 17f95b32075d5c8da5c0be80f3ff00908439d4e2 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 22:26:18 +0200 Subject: [PATCH 24/51] feat: Added archive project request --- .../services/v2/authorization_service.proto | 9 +++++++++ .../storage/services/v2/project_service.proto | 20 +++++++++++++++++++ .../services/v2/relations_service.proto | 0 3 files changed, 29 insertions(+) create mode 100644 aruna/api/storage/services/v2/relations_service.proto diff --git a/aruna/api/storage/services/v2/authorization_service.proto b/aruna/api/storage/services/v2/authorization_service.proto index e69de29b..895d6fda 100644 --- a/aruna/api/storage/services/v2/authorization_service.proto +++ b/aruna/api/storage/services/v2/authorization_service.proto @@ -0,0 +1,9 @@ +message AddUserToProjectRequest { + string project_id = 1; + string user_id = 2; + storage.models.v1.Permission permission = 3; + } + + message AddUserToProjectResponse { + storage.models.v1.ProjectPermission permission = 4; + } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto index 7dfd8f7c..876554f6 100644 --- a/aruna/api/storage/services/v2/project_service.proto +++ b/aruna/api/storage/services/v2/project_service.proto @@ -132,6 +132,17 @@ service ProjectService { patch : "/v2/project/{project_id}/data_class" }; } + + // ArchiveProjectRequest + // + // Status: BETA + // + // Archives the full project, rendering all downstream relations immutable + rpc ArchiveProject(ArchiveProjectRequest) returns (ArchiveProjectResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/archive" + }; + } } message CreateProjectRequest { @@ -215,4 +226,13 @@ message UpdateProjectDataClassRequest { message UpdateProjectDataClassResponse { storage.models.v2.Project project = 1; +} + +message ArchiveProjectRequest { + string project_id = 1; +} + +message ArchiveProjectResponse { + // This project will be returned via an Persistent Identifier! Updates will be impossible + storage.models.v2.Project project = 1; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/relations_service.proto b/aruna/api/storage/services/v2/relations_service.proto new file mode 100644 index 00000000..e69de29b From b829aa284d4f69d87f2e800b59fe4510fd432d43 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 23:19:47 +0200 Subject: [PATCH 25/51] feat: Refactor models bring resources in line, update project service --- aruna/api/storage/models/v2/models.proto | 437 ++++++------------ .../services/v2/collection_service.proto | 160 ++----- .../storage/services/v2/project_service.proto | 36 +- .../services/v2/workspace_service.proto | 93 ++++ 4 files changed, 317 insertions(+), 409 deletions(-) diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index f8657eec..8dd53409 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -4,12 +4,28 @@ option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v2" package aruna.api.storage.models.v2; +// --------------- ENUMS ------------------------ +// Dataclass defines the confidentiality of the object +enum DataClass { + DATA_CLASS_UNSPECIFIED = 0; + DATA_CLASS_PUBLIC = 1; + DATA_CLASS_PRIVATE = 2; + DATA_CLASS_CONFIDENTIAL = 3; +} +enum EndpointType { + ENDPOINT_TYPE_UNSPECIFIED = 0; + ENDPOINT_TYPE_S3 = 1; + ENDPOINT_TYPE_FILE = 2; +} - -// ------------- USERS & PERMISSIONS ----------------------- - +enum EndpointHostType { + ENDPOINT_HOST_TYPE_UNSPECIFIED = 0; + ENDPOINT_HOST_TYPE_PROXY = 1; + ENDPOINT_HOST_TYPE_INTERNAL = 2; + ENDPOINT_HOST_TYPE_BUNDLER = 3; +} enum PermissionLevel { PERMISSION_LEVEL_UNSPECIFIED = 0; @@ -21,6 +37,83 @@ enum PermissionLevel { PERMISSION_LEVEL_ADMIN = 6; } +enum KeyValueVariant { + KEY_VALUE_VARIANT_UNSPECIFIED = 0; + KEY_VALUE_VARIANT_LABEL = 1; + KEY_VALUE_VARIANT_STATIC_LABEL = 2; + KEY_VALUE_VARIANT_HOOK = 3; +} + +enum ExternalRelationVariant { + EXTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; + EXTERNAL_RELATION_VARIANT_URL = 1; + EXTERNAL_RELATION_VARIANT_IDENTIFIER = 2; +} + +enum InternalRelationVariant { + INTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; + INTERNAL_RELATION_VARIANT_BELONGS_TO = 1; + INTERNAL_RELATION_VARIANT_ORIGIN = 2; + INTERNAL_RELATION_VARIANT_DERIVED = 3; + INTERNAL_RELATION_VARIANT_METADATA = 4; + INTERNAL_RELATION_VARIANT_POLICY = 5; +} + +enum RelationDirection { + RELATION_DIRECTION_UNSPECIFIED = 0; + RELATION_DIRECTION_INBOUND = 1; + RELATION_DIRECTION_OUTBOUND = 2; + RELATION_DIRECTION_BIDIRECTIONAL = 3; +} + +// An resourcetype used to identify generic authorizations +enum ResourceType { + RESOURCE_TYPE_UNSPECIFIED = 0; + RESOURCE_TYPE_PROJECT = 1; + RESOURCE_TYPE_COLLECTION = 2; + RESOURCE_TYPE_DATASET = 3; + RESOURCE_TYPE_OBJECT = 4; +} + +// Used for the internal associated services to validate permissions +// Actions are similar to HTTP verbs +enum ResourceAction { + RESOURCE_ACTION_UNSPECIFIED = 0; + RESOURCE_ACTION_CREATE = 1; + RESOURCE_ACTION_APPEND = 2; + RESOURCE_ACTION_UPDATE = 3; + RESOURCE_ACTION_READ = 4; + RESOURCE_ACTION_DELETE = 5; +} + +// An arbitrary status for Objects +enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_INITIALIZING = 1; + STATUS_AVAILABLE = 2; + STATUS_UNAVAILABLE = 3; + STATUS_ERROR = 4; + STATUS_DELETED = 5; + STATUS_VALIDATING = 6; +} + +enum EndpointStatus { + ENDPOINT_STATUS_UNSPECIFIED = 0; + ENDPOINT_STATUS_INITIALIZING = 1; + ENDPOINT_STATUS_AVAILABLE = 2; + ENDPOINT_STATUS_DEGRADED = 3; + ENDPOINT_STATUS_UNAVAILABLE = 4; + ENDPOINT_STATUS_MAINTENANCE = 5; +} + +enum Hashalgorithm { + HASHALGORITHM_UNSPECIFIED = 0; + HASHALGORITHM_MD5 = 1; + HASHALGORITHM_SHA256 = 2; +} + +// ------------- USERS & PERMISSIONS ----------------------- + message User { // Internal Aruna UserID string id = 1; @@ -36,7 +129,6 @@ message User { UserAttributes attributes = 6; } - message Permission { oneof resource_id { string project_id = 1; @@ -47,7 +139,6 @@ message Permission { PermissionLevel permission_level = 6; } - message Token { string id = 1; string name = 2; @@ -80,13 +171,6 @@ message UserAttributes { // --------------- RELATION / KEYVALUES ------------------- -enum KeyValueVariant { - KEY_VALUE_VARIANT_UNSPECIFIED = 0; - KEY_VALUE_VARIANT_LABEL = 1; - KEY_VALUE_VARIANT_STATIC_LABEL = 2; - KEY_VALUE_VARIANT_HOOK = 3; -} - // A key value pair for hooks and labels message KeyValue { string key = 1; @@ -95,159 +179,47 @@ message KeyValue { bool indexed = 4; } -enum RelationVariant { - RELATION_VARIANT_UNSPECIFIED = 0; - RELATION_VARIANT_URL = 1; - RELATION_VARIANT_IDENTIFIER = 2; +message Relation { + oneof relation { + ExternalRelation external = 1; + InternalRelation internal = 2; + } } message ExternalRelation { - string name = 1; - string identifier = 2; - RelationVariant variant = 3; -} - - -enum InternalRelationVariant { - INTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; - INTERNAL_RELATION_VARIANT_BELONGS_TO = 1; - INTERNAL_RELATION_VARIANT_ORIGIN = 2; - INTERNAL_RELATION_VARIANT_DERIVED = 3; - INTERNAL_RELATION_VARIANT_META = 4; + string identifier = 1; + oneof variant { + ExternalRelationVariant defined_variant = 2; + string custom_variant = 3; + } } -enum RelationDirection { - RELATION_DIRECTION_UNSPECIFIED = 0; - RELATION_DIRECTION_INBOUND = 1; - RELATION_DIRECTION_OUTBOUND = 2; - RELATION_DIRECTION_BIDIRECTIONAL = 3; -} - message InternalRelation { string resource_id = 1; oneof variant { - InternalRelationVariant fixed_variant = 2; + InternalRelationVariant defined_variant = 2; string custom_variant = 3; } RelationDirection direction = 4; } - -// A Project is a list of collections with associated users -// This is used to manage access to multiple collections at the same time -// Each Collection can only be in one Project at a time -message Project { - string id = 1; - string name = 2; - // Project specific labels / hooks - repeated KeyValue key_values = 3; - // External relations (URLs / IDs from external sources) - repeated ExternalRelation external_relations = 4; - // Internal relations - repeated InternalRelation internal_relation = 5; - int64 size = 6; - DataClass data_class = 7; - google.protobuf.Timestamp created_at = 8; - string created_by = 9; -} - message PageRequest { string start_after = 1; // This is the last ID of the previous returned request int64 page_size = 2; // Default to 20, -1 for all } -// An resourcetype used to identify generic authorizations -enum ResourceType { - RESOURCE_TYPE_UNSPECIFIED = 0; - RESOURCE_TYPE_PROJECT = 1; - RESOURCE_TYPE_COLLECTION = 2; - RESOURCE_TYPE_OBJECT = 3; - RESOURCE_TYPE_ALL = 4; -} - -// Used for the internal associated services to validate permissions -// Actions are similar to HTTP verbs -enum ResourceAction { - RESOURCE_ACTION_UNSPECIFIED = 0; - RESOURCE_ACTION_CREATE = 1; - RESOURCE_ACTION_APPEND = 2; - RESOURCE_ACTION_UPDATE = 3; - RESOURCE_ACTION_READ = 4; - RESOURCE_ACTION_DELETE = 5; -} - -// An arbitrary status for Objects -enum Status { - STATUS_UNSPECIFIED = 0; - STATUS_INITIALIZING = 1; - STATUS_AVAILABLE = 2; - STATUS_UNAVAILABLE = 3; - STATUS_ERROR = 4; - STATUS_DELETED = 5; - STATUS_FINALIZING = 6; -} - -enum EndpointStatus { - ENDPOINT_STATUS_UNSPECIFIED = 0; - ENDPOINT_STATUS_INITIALIZING = 1; - ENDPOINT_STATUS_AVAILABLE = 2; - ENDPOINT_STATUS_DEGRADED = 3; - ENDPOINT_STATUS_UNAVAILABLE = 4; - ENDPOINT_STATUS_MAINTENANCE = 5; -} - // Stats for a set of objects message Stats { int64 count = 1; - int64 acc_size = 2; -} - -// Stats for a collection -message CollectionStats { - Stats object_stats = 1; + int64 size = 2; google.protobuf.Timestamp last_updated = 3; } -// Semver version -> Alpha Beta release are not supported -> Use "latest" for -// mutable collections that are in development -message Version { - int32 major = 1; - int32 minor = 2; - int32 patch = 3; -} - -enum Hashalgorithm { - HASHALGORITHM_UNSPECIFIED = 0; - HASHALGORITHM_MD5 = 1; - HASHALGORITHM_SHA256 = 2; -} - message Hash { Hashalgorithm alg = 1; string hash = 2; } -// Dataclass defines the confidentiality of the object -enum DataClass { - DATA_CLASS_UNSPECIFIED = 0; - DATA_CLASS_PUBLIC = 1; - DATA_CLASS_PRIVATE = 2; - DATA_CLASS_CONFIDENTIAL = 3; -} - -enum EndpointType { - ENDPOINT_TYPE_UNSPECIFIED = 0; - ENDPOINT_TYPE_S3 = 1; - ENDPOINT_TYPE_FILE = 2; -} - -enum EndpointHostType { - ENDPOINT_HOST_TYPE_UNSPECIFIED = 0; - ENDPOINT_HOST_TYPE_PROXY = 1; - ENDPOINT_HOST_TYPE_INTERNAL = 2; - ENDPOINT_HOST_TYPE_BUNDLER = 3; -} - message EndpointHostConfig { string url = 1; bool is_primary = 2; @@ -268,165 +240,64 @@ message Endpoint { repeated EndpointHostConfig host_configs = 11; } +// ------ Resources ---------- -// A first draft for possible relation types -// That should be introduced by us -enum RelationType { - RELATION_TYPE_UNSPECIFIED = 0; // DO NOT USE - RELATION_TYPE_CROSSREF = 1; // Crossref -> URL - RELATION_TYPE_ORIGIN = 2; // Crossref -> Objectid - RELATION_TYPE_METADATA = 3; // Data -> Metadata link - RELATION_TYPE_SPECIFICATION = 4; // Specification for metadata etc. - RELATION_TYPE_DATASET = 5; // Part of Dataset -> To "bundle", dataset objects -} - -// A Link is a connection to other data, -// this can either be -// A: An URL (DOI, crossref, etc.) -// B: Another Object -message Link { - oneof identifier { - string object_id = 1; - string url = 2; - string custom_identifier = 3; - } -} - -message Relation { - // A relation can be outbound or inbound - // Most of the time relations are updated bidirectional - oneof relation { - Link describes = 1; - Link described_by = 2; - } - // Relation is either a custom string type, or a predefined type - oneof relationtype { - RelationType relation_type = 3; - string custom_relation = 4; - } - string relation_id = 5; // Relations are revisioned and share a common ID to track whats changed -} - -// RULES for Objects: -// 1. Each object is "owned" by one/or more collections -// 2. Objects can be "borrowed" to multiple other collections -// 3. Objects are immutable, updating an object will create a new object with -// increased revision number -// only people with modify permissions in the owner collection can update an -// object -// 3.1 Special cases: -// Hooks: Can be added/removed and modified without changing the object -// revision number Labels: Can be added without changing the object revision -// number, removing or modifying labels WILL change the object revision -// number (append only) auto_update: Can be added/removed without changing -// the object revision number and is collection specific -// 4. Objects can only be permanently deleted by a person with admin rights on -// the owner collection - -message Object { - string id = 1; // ObjectID - string filename = 2; // Filename: Name of the original file e.g.: mydata.json - repeated KeyValue labels = 3; // Labels to additionally describe the object - repeated KeyValue hooks = 4; // Hooks to be executed on the object - google.protobuf.Timestamp created = 5; - int64 content_len = 6; // Length of the stored dataset - Status status = 7; - repeated Relation relations = 8; // Relations to other objects / external URLs -> Replaces Objectgroups - DataClass data_class = 9; // Confidentiality of the object - repeated Hash hashes = 10; // MD5 and SHA256 hash of the data - int64 rev_number = 11; // Increasing revion number for each update - bool latest = 12; // Is this the latest version of the object? -} - -// Multiple Objects -message Objects { repeated Object objects = 1; } - -message FullObjectReference { - Object object = 1; - bool auto_update = 2; - string path = 3; -} - -message ObjectIdReference { - string object_id = 1; - bool auto_update = 2; - string path = 3; +message Project { + string id = 1; + string name = 2; // Short name according to BucketNamingRules + string description = 3; // Long name + // Project specific labels / hooks + repeated KeyValue key_values = 4; + // Relations to internal and external sources + repeated Relation relations = 5; + Stats stats = 6; + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; } -// RULES for Collections: -// 1. Each object is "owned" by one/or more collections -// 2. Objects can be in multiple collections and must be in the owner collection -// 3. Collections are either mutable with Version.latest == true or immutable -// with a fixed version number 3.1 If a collection gets a fixed version a copy -// is created with all "latest" objects dereferenced to their respective -// revisions 3.2 Modifying an immutable collection will create a new copy of the -// collection with a new version number -// 4. Collections can be created by any user, but only the owner can modify or -// delete them message Collection { string id = 1; - string name = 2; // Should be unique in authgroup + string name = 2; string description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - FullObjectReference label_policy = 6; // Policy file for label ontology - google.protobuf.Timestamp created = 7; - repeated FullObjectReference objects = 8; - repeated FullObjectReference specifications = 9; - oneof version { - Version semantic_version = 12; - bool latest = 13; - } - CollectionStats stats = 14; - DataClass dataclass = 15; + // Collection specific labels / hooks + repeated KeyValue key_values = 4; + // Relations to internal and external sources + repeated Relation relations = 5; + Stats stats = 6; + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; } -// Multiple Collections -message Collections { repeated Collection collections = 1; } - -// This is a representation of the Collection without the recursive nature of -// objectreferences -message CollectionOverview { +message Dataset { string id = 1; string name = 2; string description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - Object label_policy = 6; // Policy file for label ontology - google.protobuf.Timestamp created = 7; - oneof version { - Version semantic_version = 12; - bool latest = 13; - } - CollectionStats stats = 14; - DataClass dataclass = 15; -} - -// Multiple CollectionOverviews -message CollectionOverviews { - repeated CollectionOverview collection_overviews = 1; + // Dataset specific labels / hooks + repeated KeyValue key_values = 4; + // Relations to internal and external sources + repeated Relation relations = 5; + Stats stats = 6; + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; } -// This is a representation of the Collection with only Resource RevisionIDs -// instead of full objects -message CollectionWithId { - string id = 1; - string name = 2; // Should be unique in authgroup +message Object { + string id = 1; + string name = 2; string description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - ObjectIdReference label_policy = 6; // Policy file for label ontology - google.protobuf.Timestamp created = 7; - repeated ObjectIdReference objects = 8; - repeated ObjectIdReference specifications = 9; - oneof version { - Version semantic_version = 12; - bool latest = 13; - } - CollectionStats stats = 14; - DataClass dataclass = 15; -} -// Multiple CollectionWithIDs -message CollectionWithIDs { repeated CollectionWithId collection_with_ids = 1; } - + // Collection specific labels / hooks + repeated KeyValue key_values = 4; + // Relations to internal and external sources + repeated Relation relations = 5; + int64 content_len = 6; // Object only + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; + // Object specific attributes + Status status = 10; + repeated Hash hashes = 11; +} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index a3f8cc64..9f03a2cc 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -49,47 +49,11 @@ service CollectionService { }; } - // UpdateCollection - // - // Status: BETA - // - // Updates the current collection - // This will update the collection in place if it is unversioned / latest - // A versioned (pinned) collection requires a new semantic version after the - // update This can be used to pin a collection to a specific version similar - // to the PinCollectionVersion request - rpc UpdateCollection(UpdateCollectionRequest) - returns (UpdateCollectionResponse) { - option (google.api.http) = { - put : "/v1/collection/{collection_id}" - body : "*" - }; - } - - // PinCollectionVersion - // - // Status: STABLE - // - // This pins the current status of the version to a - // specific version. Effectively creating a copy of the collection with a - // stable version All objects will be pinned to an explicit revision number - // Pinned collections can not be updated in place - rpc PinCollectionVersion(PinCollectionVersionRequest) - returns (PinCollectionVersionResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/pin" - body : "*" - }; - } - // DeleteCollection // // Status: STABLE // // This request deletes the collection. - // If with_version is true, it deletes the collection and all its versions. - // If cascade is true, all objects that are owned by the collection will also - // deleted. This should be avoided rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse) { option (google.api.http) = { @@ -98,131 +62,83 @@ service CollectionService { }; } - // AddKeyValueToCollection + // UpdateCollectionName // // Status: BETA // - // Adds key values (labels / hooks) to a collection - rpc AddKeyValuesToCollection(AddKeyValuesToCollectionRequest) - returns (AddKeyValuesToCollectionResponse) { + // Updates the collection name. Caveat! Will rename the "s3 bucket" for data proxies! + rpc UpdateCollectionName(UpdateCollectionNameRequest) returns (UpdateCollectionNameResponse) { option (google.api.http) = { - patch : "/v1/collection/{collection_id}/add_key_value" + patch : "/v2/collection/{collection_id}/name" body : "*" }; } -} - -// WorkspaceService -// -// Service to manage "special" anonymous collections / workspaces -service WorkspaceService { - // CreateWorkspace + // UpdateCollectionKeyValues // - // Status: ALPHA + // Status: BETA // - // A new request to create a personal anonymous workspace - rpc CreateWorkspace(CreateWorkspaceRequest) - returns (CreateWorkspaceResponse) { + // Updates the collection key values. + rpc UpdateProjectKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValueResponse) { option (google.api.http) = { - post : "/v1/workspace" + patch : "/v2/collection/{collection_id}/key_values" body : "*" }; } - - - // DeleteWorkspace + + // UpdateCollectionExternalRelations // - // Status: ALPHA + // Status: BETA // - // Delete a workspace - rpc DeleteWorkspace(DeleteWorkspaceRequest) - returns (DeleteWorkspaceResponse) { + // Updates the collection name. All (meta) data will be overwritten. + rpc UpdateCollectionExternalRelations(UpdateCollectionExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { option (google.api.http) = { - delete : "/v1/workspace/{workspace_id}" + patch : "/v2/collection/{collection_id}/external_relations" body : "*" }; } - // DeleteWorkspace + // UpdateCollectionDataClass // - // Status: ALPHA + // Status: BETA // - // Claims an anonymous workspace, and transfers the owner to a regular user account. - rpc ClaimWorkspace(ClaimWorkspaceRequest) - returns (ClaimWorkspaceResponse) { + // Updates the collection name. All (meta) data will be overwritten. + rpc UpdateCollectionDataClass(UpdateCollectionDataClassRequest) returns (UpdateCollectionDataClassResponse) { option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/claim" + patch : "/v2/collection/{collection_id}/data_class" body : "*" }; } - // MoveWorkspaceData + // SnapshotCollectionRequest // - // Status: ALPHA + // Status: BETA // - // Claims an anonymous workspace - rpc MoveWorkspaceData(MoveWorkspaceDataRequest) - returns (MoveWorkspaceDataResponse) { + // Archives the full project, rendering all downstream relations immutable + rpc SnapshotCollection(SnapshotCollectionRequest) returns (SnapshotCollectionResponse) { option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/move/{collection_id}" + post : "/v2/collection/{collection_id}/snapshot" 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 +message CreateCollectionRequest { + // Project name string name = 1; - // Description - string description = 2; - // Project id - string project_id = 3; - // List of associated labels - repeated storage.models.v1.KeyValue labels = 4; - // List of associated hooks - repeated storage.models.v1.KeyValue hooks = 5; - // Optional Dataclass - storage.models.v1.DataClass dataclass = 6; + // Project specific labels / hooks + repeated storage.models.v2.KeyValue key_values = 2; + // External relations (URLs / IDs from external sources) + repeated storage.models.v2.ExternalRelation external_relations = 3; + // DataClass + storage.models.v2.DataClass data_class = 4; + // Parent_id MUST be Project + oneof parent { + string project_id = 5; + } } -message CreateNewCollectionResponse { +message CreateCollectionResponse { // The new collection_id string collection_id = 1; } diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto index 876554f6..d3adc7f3 100644 --- a/aruna/api/storage/services/v2/project_service.proto +++ b/aruna/api/storage/services/v2/project_service.proto @@ -97,6 +97,19 @@ service ProjectService { rpc UpdateProjectName(UpdateProjectNameRequest) returns (UpdateProjectNameResponse) { option (google.api.http) = { patch : "/v2/project/{project_id}/name" + body : "*" + }; + } + + // UpdateProjectDescription + // + // Status: BETA + // + // Updates the project name. + rpc UpdateProjectDescription(UpdateProjectDescriptionRequest) returns (UpdateProjectDescriptionResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/description" + body : "*" }; } @@ -108,6 +121,7 @@ service ProjectService { rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValueResponse) { option (google.api.http) = { patch : "/v2/project/{project_id}/key_values" + body : "*" }; } @@ -119,6 +133,7 @@ service ProjectService { rpc UpdateProjectExternalRelations(UpdateProjectExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { option (google.api.http) = { patch : "/v2/project/{project_id}/external_relations" + body : "*" }; } @@ -130,6 +145,7 @@ service ProjectService { rpc UpdateProjectDataClass(UpdateProjectDataClassRequest) returns (UpdateProjectDataClassResponse) { option (google.api.http) = { patch : "/v2/project/{project_id}/data_class" + body : "*" }; } @@ -140,7 +156,8 @@ service ProjectService { // Archives the full project, rendering all downstream relations immutable rpc ArchiveProject(ArchiveProjectRequest) returns (ArchiveProjectResponse) { option (google.api.http) = { - patch : "/v2/project/{project_id}/archive" + post : "/v2/project/{project_id}/archive" + body : "*" }; } } @@ -148,12 +165,14 @@ service ProjectService { message CreateProjectRequest { // Project name string name = 1; + // Description + string description = 2; // Project specific labels / hooks - repeated storage.models.v2.KeyValue key_values = 2; + repeated storage.models.v2.KeyValue key_values = 3; // External relations (URLs / IDs from external sources) - repeated storage.models.v2.ExternalRelation external_relations = 3; + repeated storage.models.v2.ExternalRelation external_relations = 4; // DataClass - storage.models.v2.DataClass data_class = 4; + storage.models.v2.DataClass data_class = 5; } message CreateProjectResponse { @@ -199,6 +218,15 @@ message UpdateProjectNameResponse { storage.models.v2.Project project = 1; } +message UpdateProjectDescriptionRequest { + string project_id = 1; + string description = 2; +} + +message UpdateProjectDescriptionResponse { + storage.models.v2.Project project = 1; +} + message UpdateProjectKeyValuesRequest { string project_id = 1; repeated storage.models.v2.KeyValue add_key_values = 2; diff --git a/aruna/api/storage/services/v2/workspace_service.proto b/aruna/api/storage/services/v2/workspace_service.proto index e69de29b..a4b6fad0 100644 --- a/aruna/api/storage/services/v2/workspace_service.proto +++ b/aruna/api/storage/services/v2/workspace_service.proto @@ -0,0 +1,93 @@ +/ 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 {} \ No newline at end of file From dfcff42d40c65357a28037461ef27a33078cdc27 Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 23:29:22 +0200 Subject: [PATCH 26/51] feat: Finalize new collection service --- .../services/v2/collection_service.proto | 135 +++++++++--------- .../storage/services/v2/project_service.proto | 2 +- 2 files changed, 69 insertions(+), 68 deletions(-) diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index 9f03a2cc..560aabdc 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -58,7 +58,6 @@ service CollectionService { returns (DeleteCollectionResponse) { option (google.api.http) = { delete : "/v1/collection/{collection_id}" - body : "*" }; } @@ -74,6 +73,18 @@ service CollectionService { }; } + // UpdateCollectionDescription + // + // Status: BETA + // + // Updates the collection description. + rpc UpdateCollectionDescription(UpdateCollectionDescriptionRequest) returns (UpdateCollectionDescriptionResponse) { + option (google.api.http) = { + patch : "/v2/collection/{collection_id}/description" + body : "*" + }; + } + // UpdateCollectionKeyValues // // Status: BETA @@ -91,7 +102,7 @@ service CollectionService { // Status: BETA // // Updates the collection name. All (meta) data will be overwritten. - rpc UpdateCollectionExternalRelations(UpdateCollectionExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { + rpc UpdateCollectionExternalRelations(UpdateCollectionExternalRelationsRequest) returns (UpdateCollectionExternalRelationsResponse) { option (google.api.http) = { patch : "/v2/collection/{collection_id}/external_relations" body : "*" @@ -140,96 +151,86 @@ message CreateCollectionRequest { message CreateCollectionResponse { // The new collection_id - string collection_id = 1; + storage.models.v2.Collection collection = 1; } -message GetCollectionByIDRequest { +message GetCollectionRequest { // Requested id string collection_id = 1; } -message GetCollectionByIDResponse { +message GetCollectionResponse { // Overview of the requested collection - storage.models.v1.CollectionOverview collection = 1; + storage.models.v2.Collection collection = 1; } message GetCollectionsRequest { - // Project id - string project_id = 1; - // Pagination default 50 - string continuation_token = 2; + repeated string collection_ids = 1; } message GetCollectionsResponse { // List of collection overviews - storage.models.v1.CollectionOverviews collections = 1; - // Only included if more than 50 collections will be returned - string continuation_token = 2; -} - -// This updates the collection -// Updating a pinned collection will require a new version to be created -message UpdateCollectionRequest { - // Old collection_id - string collection_id = 2; - // New name - string name = 3; - // New description - string description = 4; - // New list of labels - repeated storage.models.v1.KeyValue labels = 5; - // New list of hooks - repeated storage.models.v1.KeyValue hooks = 6; - - // (optional) Policy (rego) file for label ontology -> must be valid object_id - string label_policy_object = 7; - - // Optional update Dataclass, this will not overwrite - // the dataclass of all existing associated objects - // New objects can only have this dataclass - storage.models.v1.DataClass dataclass = 8; - - // If this is set, the collection will be automatically pinned to this version - // Similar to the more explicit Pin request - // Updating a pinned collection will make this field required - // (optional if unpinned || required if pinned) - storage.models.v1.Version version = 9; -} - -message UpdateCollectionResponse { - // New collection overview - storage.models.v1.CollectionOverview collection = 1; -} - -message PinCollectionVersionRequest { - // Old collection_id + repeated storage.models.v2.Collection collections = 1; +} + +message DeleteCollectionRequest { string collection_id = 1; - // New version - storage.models.v1.Version version = 2; } -message PinCollectionVersionResponse { - // New collection overview - storage.models.v1.CollectionOverview collection = 1; +message DeleteCollectionResponse {} + +message UpdateCollectionNameRequest { + string collection_id = 1; + string name = 2; } -message DeleteCollectionRequest { - // Collection id +message UpdateCollectionNameResponse { + storage.models.v2.Collection collection = 1; +} + +message UpdateCollectionDescriptionRequest { string collection_id = 1; - // Force delete - bool force = 2; + string description = 2; } -message DeleteCollectionResponse {} +message UpdateCollectionDescriptionResponse { + storage.models.v2.Collection collection = 1; +} +message UpdateCollectionKeyValuesRequest { + string collection_id = 1; + repeated storage.models.v2.KeyValue add_key_values = 2; + repeated storage.models.v2.KeyValue remove_key_values = 3; +} + +message UpdateCollectionKeyValueResponse { + storage.models.v2.Collection collection = 1; +} + +message UpdateCollectionExternalRelationsRequest { + string collection_id = 1; + repeated storage.models.v2.ExternalRelation add_relations = 2; + repeated storage.models.v2.ExternalRelation remove_relations = 3; +} + +message UpdateCollectionExternalRelationsResponse { + storage.models.v2.Collection collection = 1; +} + +message UpdateCollectionDataClassRequest { + string collection_id = 1; + storage.models.v2.DataClass data_class = 2; +} + +message UpdateCollectionDataClassResponse { + storage.models.v2.Collection collection = 1; +} -message AddKeyValuesToCollectionRequest { +message SnapshotCollectionRequest { string collection_id = 1; - repeated storage.models.v1.KeyValue labels = 2; - repeated storage.models.v1.KeyValue hooks = 3; } -message AddKeyValuesToCollectionResponse { - // New collection overview - storage.models.v1.CollectionOverview collection = 1; +message SnapshotCollectionResponse { + // This collection will be returned via an Persistent Identifier! Updates will be impossible + storage.models.v2.Collection collection = 1; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto index d3adc7f3..e1ba8db6 100644 --- a/aruna/api/storage/services/v2/project_service.proto +++ b/aruna/api/storage/services/v2/project_service.proto @@ -192,7 +192,7 @@ message GetProjectResponse { message GetProjectsRequest { // optional filter for specific ids - repeated string ids = 1; + repeated string project_ids = 1; } message GetProjectsResponse { From aa330ec2ee5e0ee97588ee2c278b749fe5da1bbf Mon Sep 17 00:00:00 2001 From: Sebastian Beyvers Date: Tue, 11 Jul 2023 23:33:32 +0200 Subject: [PATCH 27/51] feat: Introduced dataset service (replaces ObjectGroup) --- .../services/v2/collection_service.proto | 10 +- .../storage/services/v2/dataset_service.proto | 237 ++++++++++++++++++ 2 files changed, 242 insertions(+), 5 deletions(-) create mode 100644 aruna/api/storage/services/v2/dataset_service.proto diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index 560aabdc..ddcad782 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -90,7 +90,7 @@ service CollectionService { // Status: BETA // // Updates the collection key values. - rpc UpdateProjectKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValueResponse) { + rpc UpdatecollectionKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValueResponse) { option (google.api.http) = { patch : "/v2/collection/{collection_id}/key_values" body : "*" @@ -125,7 +125,7 @@ service CollectionService { // // Status: BETA // - // Archives the full project, rendering all downstream relations immutable + // Archives the full collection, rendering all downstream relations immutable rpc SnapshotCollection(SnapshotCollectionRequest) returns (SnapshotCollectionResponse) { option (google.api.http) = { post : "/v2/collection/{collection_id}/snapshot" @@ -135,15 +135,15 @@ service CollectionService { } message CreateCollectionRequest { - // Project name + // collection name string name = 1; - // Project specific labels / hooks + // collection specific labels / hooks repeated storage.models.v2.KeyValue key_values = 2; // External relations (URLs / IDs from external sources) repeated storage.models.v2.ExternalRelation external_relations = 3; // DataClass storage.models.v2.DataClass data_class = 4; - // Parent_id MUST be Project + // Parent_id MUST be collection oneof parent { string project_id = 5; } diff --git a/aruna/api/storage/services/v2/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto new file mode 100644 index 00000000..9605d173 --- /dev/null +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -0,0 +1,237 @@ +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "DatasetService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + +// DatasetService +// +// Contains all methods that get/create or update Dataset and associated resources +service DatasetService { + + // CreateNewDataset + // + // Status: BETA + // + // creates a new Dataset + rpc CreateDataset(CreateDatasetRequest) + returns (CreateDatasetResponse) { + option (google.api.http) = { + post : "/v2/dataset" + body : "*" + }; + } + + // GetDataset + // + // Status: BETA + // + // Request a specific dataset by ID + rpc GetDataset(GetDatasetRequest) + returns (GetDatasetResponse) { + option (google.api.http) = { + get : "/v2/dataset/{dataset_id}" + }; + } + + // GetDatasets + // + // Status: BETA + // + // Queries multiple datasets by ID + rpc GetDatasets(GetDatasetsRequest) returns (GetDatasetsResponse) { + option (google.api.http) = { + get : "/v2/datasets/" + }; + } + + // DeleteDataset + // + // Status: STABLE + // + // This request deletes the dataset. + rpc DeleteDataset(DeleteDatasetRequest) + returns (DeleteDatasetResponse) { + option (google.api.http) = { + delete : "/v1/dataset/{dataset_id}" + }; + } + + // UpdateDatasetName + // + // Status: BETA + // + // Updates the dataset name. Caveat! Will rename the "s3 bucket" for data proxies! + rpc UpdateDatasetName(UpdateDatasetNameRequest) returns (UpdateDatasetNameResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/name" + body : "*" + }; + } + + // UpdateDatasetDescription + // + // Status: BETA + // + // Updates the dataset description. + rpc UpdateDatasetDescription(UpdateDatasetDescriptionRequest) returns (UpdateDatasetDescriptionResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/description" + body : "*" + }; + } + + // UpdateDatasetKeyValues + // + // Status: BETA + // + // Updates the dataset key values. + rpc UpdateProjectKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValueResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/key_values" + body : "*" + }; + } + + // UpdateDatasetExternalRelations + // + // Status: BETA + // + // Updates the dataset name. All (meta) data will be overwritten. + rpc UpdateDatasetExternalRelations(UpdateDatasetExternalRelationsRequest) returns (UpdateDatasetExternalRelationsResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/external_relations" + body : "*" + }; + } + + // UpdateDatasetDataClass + // + // Status: BETA + // + // Updates the dataset name. All (meta) data will be overwritten. + rpc UpdateDatasetDataClass(UpdateDatasetDataClassRequest) returns (UpdateDatasetDataClassResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/data_class" + body : "*" + }; + } + + // SnapshotDatasetRequest + // + // Status: BETA + // + // Archives the full dataset, rendering all downstream relations immutable + rpc SnapshotDataset(SnapshotDatasetRequest) returns (SnapshotDatasetResponse) { + option (google.api.http) = { + post : "/v2/dataset/{dataset_id}/snapshot" + body : "*" + }; + } +} + +message CreateDatasetRequest { + // Project name + string name = 1; + // Project specific labels / hooks + repeated storage.models.v2.KeyValue key_values = 2; + // External relations (URLs / IDs from external sources) + repeated storage.models.v2.ExternalRelation external_relations = 3; + // DataClass + storage.models.v2.DataClass data_class = 4; + // Parent_id MUST be Project + oneof parent { + string project_id = 5; + string collection_id = 6; + } +} + +message CreateDatasetResponse { + // The new dataset_id + storage.models.v2.Dataset dataset = 1; +} + +message GetDatasetRequest { + // Requested id + string dataset_id = 1; +} + +message GetDatasetResponse { + // Overview of the requested dataset + storage.models.v2.Dataset dataset = 1; +} + +message GetDatasetsRequest { + repeated string dataset_ids = 1; +} + +message GetDatasetsResponse { + // List of dataset overviews + repeated storage.models.v2.Dataset datasets = 1; +} + +message DeleteDatasetRequest { + string dataset_id = 1; +} + +message DeleteDatasetResponse {} + +message UpdateDatasetNameRequest { + string dataset_id = 1; + string name = 2; +} + +message UpdateDatasetNameResponse { + storage.models.v2.Dataset dataset = 1; +} + +message UpdateDatasetDescriptionRequest { + string dataset_id = 1; + string description = 2; +} + +message UpdateDatasetDescriptionResponse { + storage.models.v2.Dataset dataset = 1; +} + +message UpdateDatasetKeyValuesRequest { + string dataset_id = 1; + repeated storage.models.v2.KeyValue add_key_values = 2; + repeated storage.models.v2.KeyValue remove_key_values = 3; +} + +message UpdateDatasetKeyValueResponse { + storage.models.v2.Dataset dataset = 1; +} + +message UpdateDatasetExternalRelationsRequest { + string dataset_id = 1; + repeated storage.models.v2.ExternalRelation add_relations = 2; + repeated storage.models.v2.ExternalRelation remove_relations = 3; +} + +message UpdateDatasetExternalRelationsResponse { + storage.models.v2.Dataset dataset = 1; +} + +message UpdateDatasetDataClassRequest { + string dataset_id = 1; + storage.models.v2.DataClass data_class = 2; +} + +message UpdateDatasetDataClassResponse { + storage.models.v2.Dataset dataset = 1; +} + +message SnapshotDatasetRequest { + string dataset_id = 1; +} + +message SnapshotDatasetResponse { + // This dataset will be returned via an Persistent Identifier! Updates will be impossible + storage.models.v2.Dataset dataset = 1; +} \ No newline at end of file From 210278d183eb0c6af3f45eb222ec88fbcc7a5900 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 08:11:05 +0200 Subject: [PATCH 28/51] feat: Update info and endpoint service --- aruna/api/storage/models/v2/models.proto | 76 ++++++++++++------- .../services/v2/endpoint_service.proto | 49 ++++++------ .../storage/services/v2/info_service.proto | 48 +++++------- 3 files changed, 90 insertions(+), 83 deletions(-) diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index 8dd53409..0a0ac8a3 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -14,19 +14,22 @@ enum DataClass { DATA_CLASS_CONFIDENTIAL = 3; } +// Which kind of endpoint enum EndpointType { ENDPOINT_TYPE_UNSPECIFIED = 0; ENDPOINT_TYPE_S3 = 1; ENDPOINT_TYPE_FILE = 2; + ENDPOINT_TYPE_MEMCACHED = 3; } +// Which features does the endpoint have enum EndpointHostType { ENDPOINT_HOST_TYPE_UNSPECIFIED = 0; ENDPOINT_HOST_TYPE_PROXY = 1; - ENDPOINT_HOST_TYPE_INTERNAL = 2; - ENDPOINT_HOST_TYPE_BUNDLER = 3; + ENDPOINT_HOST_TYPE_BUNDLER = 2; } +// Permission Levels enum PermissionLevel { PERMISSION_LEVEL_UNSPECIFIED = 0; PERMISSION_LEVEL_DENY = 1; @@ -37,19 +40,22 @@ enum PermissionLevel { PERMISSION_LEVEL_ADMIN = 6; } +// KeyValueVariants enum KeyValueVariant { KEY_VALUE_VARIANT_UNSPECIFIED = 0; KEY_VALUE_VARIANT_LABEL = 1; - KEY_VALUE_VARIANT_STATIC_LABEL = 2; + KEY_VALUE_VARIANT_STATIC_LABEL = 2; // A Label that only admins can remove KEY_VALUE_VARIANT_HOOK = 3; } +// External Relations enum ExternalRelationVariant { EXTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; EXTERNAL_RELATION_VARIANT_URL = 1; EXTERNAL_RELATION_VARIANT_IDENTIFIER = 2; } +// InternalRelations enum InternalRelationVariant { INTERNAL_RELATION_VARIANT_UNSPECIFIED = 0; INTERNAL_RELATION_VARIANT_BELONGS_TO = 1; @@ -59,6 +65,7 @@ enum InternalRelationVariant { INTERNAL_RELATION_VARIANT_POLICY = 5; } +// internal object relation type (direction) enum RelationDirection { RELATION_DIRECTION_UNSPECIFIED = 0; RELATION_DIRECTION_INBOUND = 1; @@ -66,7 +73,7 @@ enum RelationDirection { RELATION_DIRECTION_BIDIRECTIONAL = 3; } -// An resourcetype used to identify generic authorizations +// resourcetype enum ResourceType { RESOURCE_TYPE_UNSPECIFIED = 0; RESOURCE_TYPE_PROJECT = 1; @@ -88,22 +95,23 @@ enum ResourceAction { // An arbitrary status for Objects enum Status { - STATUS_UNSPECIFIED = 0; - STATUS_INITIALIZING = 1; - STATUS_AVAILABLE = 2; - STATUS_UNAVAILABLE = 3; - STATUS_ERROR = 4; - STATUS_DELETED = 5; - STATUS_VALIDATING = 6; + STATUS_UNSPECIFIED = 0; // Unspecified + STATUS_INITIALIZING = 1; // This object is initializing -> Staging + STATUS_VALIDATING = 2; // Data got uploaded and a validating hook got triggered + STATUS_AVAILABLE = 3; // Data is available + STATUS_UNAVAILABLE = 4; // Data is temporarily not available + STATUS_ERROR = 5; // Validating failed or fatal error in data proxy + STATUS_DELETED = 6; // Object got deleted } -enum EndpointStatus { - ENDPOINT_STATUS_UNSPECIFIED = 0; - ENDPOINT_STATUS_INITIALIZING = 1; - ENDPOINT_STATUS_AVAILABLE = 2; - ENDPOINT_STATUS_DEGRADED = 3; - ENDPOINT_STATUS_UNAVAILABLE = 4; - ENDPOINT_STATUS_MAINTENANCE = 5; +// Status for endpoints +enum ComponentStatus { + COMPONENT_STATUS_UNSPECIFIED = 0; + COMPONENT_STATUS_INITIALIZING = 1; + COMPONENT_STATUS_AVAILABLE = 2; + COMPONENT_STATUS_DEGRADED = 3; + COMPONENT_STATUS_UNAVAILABLE = 4; + COMPONENT_STATUS_MAINTENANCE = 5; } enum Hashalgorithm { @@ -176,7 +184,6 @@ message KeyValue { string key = 1; string value = 2; KeyValueVariant variant = 3; - bool indexed = 4; } message Relation { @@ -232,16 +239,24 @@ message Endpoint { string id = 1; EndpointType ep_type = 2; string name = 3; - string documentation_path = 6; - bool is_public = 7; - bool is_default = 8; - EndpointStatus status = 9; - bool is_bundler = 10; - repeated EndpointHostConfig host_configs = 11; + bool is_public = 4; + repeated string default_for = 5; // Aruna Servers that this endpoint is default for + ComponentStatus status = 6; + bool is_bundler = 7; + repeated EndpointHostConfig host_configs = 8; } // ------ Resources ---------- +message GenericResource { + oneof resource { + Project project = 1; + Collection collection = 2; + Dataset dataset = 3; + Object object = 4; + } +} + message Project { string id = 1; string name = 2; // Short name according to BucketNamingRules @@ -253,7 +268,8 @@ message Project { Stats stats = 6; DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; - string created_by = 9; + string created_by = 9; + Status status = 10; } @@ -268,7 +284,8 @@ message Collection { Stats stats = 6; DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; - string created_by = 9; + string created_by = 9; + Status status = 10; } message Dataset { @@ -282,7 +299,8 @@ message Dataset { Stats stats = 6; DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; - string created_by = 9; + string created_by = 9; + Status status = 10; } message Object { @@ -297,7 +315,7 @@ message Object { DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; string created_by = 9; - // Object specific attributes Status status = 10; + // Object specific attributes repeated Hash hashes = 11; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/endpoint_service.proto b/aruna/api/storage/services/v2/endpoint_service.proto index b6b8af14..a433e227 100644 --- a/aruna/api/storage/services/v2/endpoint_service.proto +++ b/aruna/api/storage/services/v2/endpoint_service.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "EndpointService"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; @@ -16,15 +16,15 @@ import "google/api/annotations.proto"; service EndpointService { - // AddEndpoint + // CreateEndpoint // // Status: BETA // // Registers a new Endpoint (Aruna DataProxy) to the server // Needs admin permissions - rpc AddEndpoint(AddEndpointRequest) returns (AddEndpointResponse) { + rpc CreateEndpoint(CreateEndpointRequest) returns (CreateEndpointResponse) { option (google.api.http) = { - post : "/v1/endpoint" + post : "/v2/endpoint" body : "*" }; } @@ -36,7 +36,7 @@ service EndpointService { // Gets an specific endpoint by ID or Name rpc GetEndpoint(GetEndpointRequest) returns (GetEndpointResponse) { option (google.api.http) = { - get : "/v1/endpoint" + get : "/v2/endpoint" }; } @@ -47,7 +47,7 @@ service EndpointService { // Gets all available endpoints rpc GetEndpoints(GetEndpointsRequest) returns (GetEndpointsResponse) { option (google.api.http) = { - get : "/v1/endpoints" + get : "/v2/endpoints" }; } @@ -59,7 +59,7 @@ service EndpointService { // This needs admin permissions rpc DeleteEndpoint(DeleteEndpointRequest) returns (DeleteEndpointResponse) { option (google.api.http) = { - delete : "/v1/endpoint/{endpoint_id}" + delete : "/v2/endpoint/{endpoint_id}" }; } @@ -72,29 +72,27 @@ service EndpointService { rpc GetDefaultEndpoint(GetDefaultEndpointRequest) returns (GetDefaultEndpointResponse) { option (google.api.http) = { - get : "/v1/endpoint/default" + get : "/v2/endpoint/default" }; } } -message AddEndpointRequest { +message CreateEndpointRequest { // Endpoint name string name = 1; // Endpoint type - storage.models.v1.EndpointType ep_type = 2; - // (optional) URL to a offsite documentation - string documentation_path = 5; + storage.models.v2.EndpointType ep_type = 2; // Is this endpoint public - bool is_public = 6; + bool is_public = 3; // required public_key - string pubkey = 7; + string pubkey = 4; // List of EndpointHostConfigs - repeated storage.models.v1.EndpointHostConfig host_configs = 8; + repeated storage.models.v2.EndpointHostConfig host_configs = 5; } -message AddEndpointResponse { +message CreateEndpointResponse { // Overview of the created endpoint - storage.models.v1.Endpoint endpoint = 1; + storage.models.v2.Endpoint endpoint = 1; } message GetEndpointRequest { @@ -109,7 +107,7 @@ message GetEndpointRequest { message GetEndpointResponse { // Overview of the requested endpoint - storage.models.v1.Endpoint endpoint = 1; + storage.models.v2.Endpoint endpoint = 1; } message GetEndpointsRequest { @@ -118,7 +116,7 @@ message GetEndpointsRequest { message GetEndpointsResponse { // List of endpoints - repeated storage.models.v1.Endpoint endpoints = 1; + repeated storage.models.v2.Endpoint endpoints = 1; } message DeleteEndpointRequest { @@ -128,9 +126,12 @@ message DeleteEndpointRequest { message DeleteEndpointResponse {} -message GetDefaultEndpointRequest {} +message GetDefaultEndpointRequest { + // (optional identifier) + string server_identifier = 1; +} message GetDefaultEndpointResponse { // Default endpoint of the server instance - storage.models.v1.Endpoint endpoint = 1; + storage.models.v2.Endpoint endpoint = 1; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/info_service.proto b/aruna/api/storage/services/v2/info_service.proto index b809cb9b..e23c3ccf 100644 --- a/aruna/api/storage/services/v2/info_service.proto +++ b/aruna/api/storage/services/v2/info_service.proto @@ -1,13 +1,11 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "StorageStatusService"; - -import "aruna/api/storage/models/v1/models.proto"; - +import "aruna/api/storage/models/v2/models.proto"; import "google/api/visibility.proto"; import "google/api/annotations.proto"; @@ -21,13 +19,13 @@ service StorageStatusService { // GetStorageVersion // - // Status: ALPHA + // Status: BETA // // A request to get the current version of the server application // String representation and https://semver.org/ rpc GetStorageVersion(GetStorageVersionRequest) returns (GetStorageVersionResponse) { option (google.api.http) = { - get : "/v1/info/version" + get : "/v2/info/version" }; } @@ -38,7 +36,7 @@ service StorageStatusService { // A request to get the current status of the storage components by location(s) rpc GetStorageStatus(GetStorageStatusRequest) returns (GetStorageStatusResponse) { option (google.api.http) = { - get : "/v1/info/status" + get : "/v2/info/status" }; } } @@ -59,47 +57,37 @@ message SemanticVersion { message LocationVersion { - // Status of a specific Location e.g Gießen / 0.5.0-beta.1 + // Status of a specific Location e.g Gießen / dataproxy / 0.5.0-beta.1 string location = 1; - SemanticVersion version = 2; + repeated ComponentVersion version = 2; } message ComponentVersion { // Name of a specific component e.g. server, dataproxy etc. and their status by location - string component_name = 1; - repeated LocationVersion location_version = 2; + string name = 1; + SemanticVersion version = 2; } - +// Version of each component by location message GetStorageVersionResponse { - repeated ComponentVersion component_version = 1; + repeated LocationVersion location_version = 1; } - message GetStorageStatusRequest {} -enum Status { - // Status of a specific component at a specific location - STATUS_UNSPECIFIED = 0; - STATUS_AVAILABLE = 1; - STATUS_UNAVAILABLE = 2; - STATUS_DEGRADED = 3; - STATUS_UNKNOWN = 4; -} - message LocationStatus { // Status of a specific Location e.g Gießen / AVAILABLE string location = 1; - Status status = 2; + repeated ComponentStatus component_status = 2; } message ComponentStatus { // Name of a specific component e.g. server, dataproxy etc. and their status by location - string component_name = 1; - repeated LocationStatus location_status = 2; + string name = 1; + storage.models.v2.ComponentStatus status = 2; } message GetStorageStatusResponse { - // List of all components and their status - repeated ComponentStatus component_status = 1; + // List of all locations and their component / status + repeated LocationStatus location_status = 1; } \ No newline at end of file From c5cd18fd5213e3f23aa3a0acd16ba456d48aa0f9 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 08:37:10 +0200 Subject: [PATCH 29/51] feat: Update object service to v2 --- .../storage/services/v2/dataset_service.proto | 8 +- .../storage/services/v2/object_service.proto | 608 ++++-------------- 2 files changed, 116 insertions(+), 500 deletions(-) diff --git a/aruna/api/storage/services/v2/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto index 9605d173..b9210f24 100644 --- a/aruna/api/storage/services/v2/dataset_service.proto +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -90,7 +90,7 @@ service DatasetService { // Status: BETA // // Updates the dataset key values. - rpc UpdateProjectKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValueResponse) { + rpc UpdateDatasetKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValueResponse) { option (google.api.http) = { patch : "/v2/dataset/{dataset_id}/key_values" body : "*" @@ -135,15 +135,15 @@ service DatasetService { } message CreateDatasetRequest { - // Project name + // dataset name string name = 1; - // Project specific labels / hooks + // dataset specific labels / hooks repeated storage.models.v2.KeyValue key_values = 2; // External relations (URLs / IDs from external sources) repeated storage.models.v2.ExternalRelation external_relations = 3; // DataClass storage.models.v2.DataClass data_class = 4; - // Parent_id MUST be Project + // Parent_id MUST be dataset oneof parent { string project_id = 5; string collection_id = 6; diff --git a/aruna/api/storage/services/v2/object_service.proto b/aruna/api/storage/services/v2/object_service.proto index afdb0750..948a3109 100644 --- a/aruna/api/storage/services/v2/object_service.proto +++ b/aruna/api/storage/services/v2/object_service.proto @@ -1,12 +1,12 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "ObjectService"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; // ObjectService @@ -14,93 +14,64 @@ import "google/api/annotations.proto"; // Contains all methods that get/create or update Objects and associated resources service ObjectService { - // InitializeNewObject + // InitializeObject // - // Status: STABLE + // Status: BETA // // This initializes a new object // Initializing an object will put it in a staging area. // Staged objects will get a separate staging id and need to be finished // before they can be used. - rpc InitializeNewObject(InitializeNewObjectRequest) - returns (InitializeNewObjectResponse) { + rpc InitializeObject(InitializeObjectRequest) + returns (InitializeObjectResponse) { option (google.api.http) = { - post : "/v1/collection/{collection_id}/object" + post : "/v2/object" body : "*" }; } // GetUploadURL // - // Status: STABLE + // Status: BETA // + // This is a proxy method that will call the apropriate method at dataproxy level // This method will return a (multi-part) url that can be used to upload a // file to S3. Part is a optional query parameter that can be used to upload a // part of the file / multipart upload. rpc GetUploadURL(GetUploadURLRequest) returns (GetUploadURLResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/staging/" - "{upload_id}/upload" + get : "/v2/object/{object_id}/staging/{upload_id}/upload" }; } // GetDownloadUrl // - // Status: STABLE + // Status: BETA // - // This method will return a url that can be used to download a file from S3. + // This is a proxy method that will call the apropriate method at dataproxy level + // will return a url that can be used to download a file from S3. rpc GetDownloadURL(GetDownloadURLRequest) returns (GetDownloadURLResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/download" - }; - } - - // GetDownloadLinksBatch - // - // Status: BETA - // - // This method can be used to get download urls for multiple objects. - // The order of the returned urls will be the same as the order of the object - // ids in the request. - rpc GetDownloadLinksBatch(GetDownloadLinksBatchRequest) - returns (GetDownloadLinksBatchResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/objects/batch" - }; - } - - // CreateDownloadLinksStream - // - // Status: BETA - // - // Creates a stream of objects and presigned links based on the provided query - // This can be used retrieve a large number of Objects as a stream that would - // otherwise cause issues with the connection - rpc CreateDownloadLinksStream(CreateDownloadLinksStreamRequest) - returns (stream CreateDownloadLinksStreamResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/objects/stream" - body : "*" + get : "/v2/object/{object_id}/download" }; } // FinishObjectStaging // - // Status: STABLE + // Status: BETA // // This method completes the staging of an object. rpc FinishObjectStaging(FinishObjectStagingRequest) returns (FinishObjectStagingResponse) { option (google.api.http) = { - patch : "/v1/collection/{collection_id}/object/{object_id}/staging/" - "{upload_id}/finish" + patch : "/v2/object/{object_id}/finish" body : "*" }; } // UpdateObject // - // Status: STABLE + // Status: BETA // // Objects are immutable! // Updating an object will create a new revision for the object @@ -109,97 +80,65 @@ service ObjectService { // before they can be used. rpc UpdateObject(UpdateObjectRequest) returns (UpdateObjectResponse) { option (google.api.http) = { - post : "/v1/collection/{collection_id}/object/{object_id}/update" - body : "*" - }; - } - - // CreateObjectReference - // - // Status: STABLE - // - // Creates a new reference of this object in another collection - rpc CreateObjectReference(CreateObjectReferenceRequest) - returns (CreateObjectReferenceResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/object/{object_id}/reference/" - "{target_collection_id}" + post : "/v2/object/{object_id}" body : "*" }; } // CloneObject // - // Status: STABLE + // Status: BETA // // This method clones an object and creates a copy in the same collection. // This copy has a new id and revision and will not receive any updates from // the original object. rpc CloneObject(CloneObjectRequest) returns (CloneObjectResponse) { option (google.api.http) = { - post : "/v1/collection/{collection_id}/object/{object_id}/clone" + post : "/v2/{object_id}/clone" body : "*" }; } // DeleteObject // - // Status: STABLE + // Status: BETA // // Deletes the object with the complete revision history. rpc DeleteObject(DeleteObjectRequest) returns (DeleteObjectResponse) { option (google.api.http) = { - delete : "/v1/collection/{collection_id}/object/{object_id}" - body : "*" - }; - } - - - // DeleteObjects - // - // Status: STABLE - // - // Deletes multiple objects at once. - rpc DeleteObjects(DeleteObjectsRequest) returns (DeleteObjectsResponse) { - option (google.api.http) = { - delete : "/v1/collection/{collection_id}/objects" + delete : "/v2/object/{object_id}" body : "*" }; } - // GetObjectByID + // GetObject // - // Status: STABLE + // Status: BETA // // gets a specific Object by ID that is associated to the // current collection By default only the latest revision of an object will be // returned Specify a revision_number to select an older revision With the // optional with_url boolean a download link can automatically be requested - rpc GetObjectByID(GetObjectByIDRequest) returns (GetObjectByIDResponse) { + rpc GetObject(GetObjectRequest) returns (GetObjectResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}" + get : "/v2/object/{object_id}" }; } // GetObjects // - // Status: STABLE + // Status: BETA // - // GetObjects returns a (paginated) list of objects in a specific collection - // By default only the latest revisions of all objects will be shown - // This behaviour can be changed with the include_history flag - // With the optional with_url boolean a download link can automatically be - // requested for each Object This request contains a LabelOrIDQuery message, - // this is either a list of request ObjectIDs or a query filtered by Labels + // Get multiple objects by ID at once rpc GetObjects(GetObjectsRequest) returns (GetObjectsResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/objects" + get : "/v2/objects" }; } // GetObjectRevisions // - // Status: STABLE + // Status: BETA // // This returns the full list of revisions of a specified object // With the optional with_url boolean a download link can automatically be @@ -207,12 +146,13 @@ service ObjectService { rpc GetObjectRevisions(GetObjectRevisionsRequest) returns (GetObjectRevisionsResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/revisions" + get : "/v2/object/{object_id}/revisions" }; } + // GetLatestObjectRevision // - // Status: STABLE + // Status: BETA // // This returns the latest revision of a specific object // The returned `latest` object will have a different id if the current @@ -220,127 +160,10 @@ service ObjectService { rpc GetLatestObjectRevision(GetLatestObjectRevisionRequest) returns (GetLatestObjectRevisionResponse) { option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/latest" - }; - } - - // GetObjectEndpoints - // - // Status: BETA - // - // This returns a list of endpoints - // One endpoint will be the "default" endpoint - rpc GetObjectEndpoints(GetObjectEndpointsRequest) - returns (GetObjectEndpointsResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/endpoints" - }; - } - - // AddLabelsToObject - // - // Status: STABLE - // - // This is a specific request to add new label(s) - // to an existing object, in contrast to UpdateObject - // this will not create a new object in the staging area - // Instead it will directly add the specified label(s) to the object - rpc AddLabelsToObject(AddLabelsToObjectRequest) - returns (AddLabelsToObjectResponse) { - option (google.api.http) = { - patch : "/v1/collection/{collection_id}/object/{object_id}/add_labels" - body : "*" - }; - } - // SetHooksOfObject - // - // Status: BETA - // - // This is a specific request to update the complete list - // of hooks for a specific object. This will not update the object - // and create a new id, instead it will overwrite all hooks of the existing - // object. - rpc SetHooksOfObject(SetHooksOfObjectRequest) - returns (SetHooksOfObjectResponse) { - option (google.api.http) = { - patch : "/v1/collection/{collection_id}/object/{object_id}/set_hooks" - body : "*" - }; - } - - // GetReferences - // - // Status: STABLE - // - // Get a list of references for this object (optional) including all revisions - rpc GetReferences(GetReferencesRequest) returns (GetReferencesResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}/references" - }; - } - - // UpdateObjectPath - // - // Status: BETA - // - // Create collection_specific object_paths for an object - // !! Paths are collection specific !! - rpc UpdateObjectPath(UpdateObjectPathRequest) returns (UpdateObjectPathResponse) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/object/{object_id}/path" - body: "*" - }; - } - - // GetObjectsByPath - // - // Status: BETA - // - // Gets a specific object by object_path - // !! Paths are collection specific !! - rpc GetObjectsByPath(GetObjectsByPathRequest) returns (GetObjectsByPathResponse) { - option (google.api.http) = { - get : "/v1/path/object/{path=**}" - }; - } - - // GetProjectCollectionIdsByPath - // - // Status: BETA - // - // 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 ObjectWithURLs 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" - }; - } - - - // CreateCrossRelation - // - // Status: ALPHA - // - // Adds a relation to an object - rpc CreateCrossRelations(CreateCrossRelationsRequest) returns (CreateCrossRelationsResponse) { - option (google.api.http) = { - post : "/v1/relation" + get : "/v2/object/{object_id}/latest" }; } - } // Models @@ -348,164 +171,108 @@ service ObjectService { // gRPC best practises advice each Request and Response message in a RPC to be // called {rpc_name}Request and {rpc_name}Response. -message URL { - // URL response - string url = 1; -} - -message StageObject { - // Filename - string filename = 1; - // Content length - int64 content_len = 2; - // Source of the object (e.g. wikipedia) - repeated storage.models.v1.Relation relations = 3; - // Dataclass public / private - storage.models.v1.DataClass dataclass = 4; - // List of label key-values - repeated storage.models.v1.KeyValue labels = 5; - // List of hook key-values - repeated storage.models.v1.KeyValue hooks = 6; - // (collection specific) sub_path for file - // does not include file-, collection- or projectname - // final fully-qualified schema: //// - string sub_path = 7; -} - -message InitializeNewObjectRequest { - // This describes the object to be initialized. - StageObject object = 1; - // Collection id of the collection to which the object will be added. - string collection_id = 2; - // (optional) Used to specify a preferred endpoint by id - // this can be used to specify which endpoint this object should use - // only needed if it is not the default endpoint for the current server - // instance - string preferred_endpoint_id = 3; - // (optional) Hash - storage.models.v1.Hash hash = 4; +message InitializeObjectRequest { + // collection name + string name = 1; + // collection specific labels / hooks + repeated storage.models.v2.KeyValue key_values = 2; + // External relations (URLs / IDs from external sources) + repeated storage.models.v2.ExternalRelation external_relations = 3; + // DataClass + storage.models.v2.DataClass data_class = 4; + // Parent can be one of all other resources + oneof parent { + string project_id = 5; + string collection_id = 6; + string dataset_id = 7; + } + repeated storage.models.v2.Hash md5 = 8; } -message InitializeNewObjectResponse { - // ObjectId - string object_id = 1; +message InitializeObjectResponse { + storage.models.v2.Object object = 1; } message GetUploadURLRequest { // ObjectId string object_id = 1; - // CollectionID - string collection_id = 2; // Is this a multipart upload? - bool multipart = 3; + bool multipart = 2; // (optional) if multi was initialized - int32 part_number = 4; + int32 part_number = 3; } message GetUploadURLResponse { // URL - URL url = 1; -} - -message CompletedParts { - // Multipart identifier - string etag = 1; - // Part number - int64 part = 2; + string url = 1; } message GetDownloadURLRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; + string object_id = 1; } message GetDownloadURLResponse { // URL - URL url = 1; -} - -message GetDownloadLinksBatchRequest { - // CollectionID - string collection_id = 1; - // ObjectIds - repeated string objects = 2; -} - -message GetDownloadLinksBatchResponse { - // List of URLs - repeated URL urls = 1; + string url = 1; } -message CreateDownloadLinksStreamRequest { - // CollectionID - string collection_id = 1; - // ObjectIds - repeated string objects = 2; +message CompletedParts { + // Multipart identifier + string etag = 1; + // Part number + int64 part = 2; } -message CreateDownloadLinksStreamResponse { URL url = 1; } - message FinishObjectStagingRequest { // ObjectId string object_id = 1; - // CollectionID - string collection_id = 2; // Hash of the uploaded data - used to verify the data integrity. // This supports multiple hashing algorithms. - storage.models.v1.Hash hash = 3; + repeated storage.models.v2.Hash hashes = 2; // If the upload was multipart, this is the list of parts that were uploaded. // Should be empty if the upload was not multipart. // (optional) repeated CompletedParts completed_parts = 4; - // Should the object be auto-updated in the collection? - // default: false - bool auto_update = 5; } message FinishObjectStagingResponse { // (new) Object overview - storage.models.v1.Object object = 1; + storage.models.v2.Object object = 1; } message UpdateObjectRequest { // Existing object ID string object_id = 1; - // collection ID - string collection_id = 2; - // New object data - StageObject object = 3; - // If this is an reupload a preferred endpoint - // can be specified by id - string preferred_endpoint_id = 4; - // (optional) Hash - storage.models.v1.Hash hash = 5; + // object name + optional string name = 2; + // + optional string description = 3; + // key_values to add + repeated storage.models.v2.KeyValue add_key_values = 4; + // key_values to remove + repeated storage.models.v2.KeyValue remove_key_values = 5; + // External relations (URLs / IDs from external sources) to add + repeated storage.models.v2.ExternalRelation add_external_relations = 6; + // External relations to remove + + // New DataClass + optional storage.models.v2.DataClass data_class = 7; + // Parent can be one of all other resources + oneof parent { + string project_id = 8; + string collection_id = 9; + string dataset_id = 10; + bool none = 11; + } + optional storage.models.v2.Hash md5 = 12; + optional storage.models.v2.Hash sha256 = 13; + optional string preferred_endpoint_id = 14; } message UpdateObjectResponse { - // NEW ! ObjectId - string object_id = 1; - // CollectionID - string collection_id = 2; -} - -message CreateObjectReferenceRequest { - // ObjectId - string object_id = 1; - // OwnerCollectionID - string collection_id = 2; - // BorrowerCollectionID - string target_collection_id = 3; - // Should the other collection have permissions to edit the ressource - bool writeable = 4; - // Should the borrowed ressource be automatically updated ? - bool auto_update = 5; - // (collection specific) sub_path for file - // does not include file-, collection- or projectname - // final schema: ///// - string sub_path = 6; + storage.models.v2.Object object = 1; + bool copied = 2; } message CreateObjectReferenceResponse {} @@ -513,97 +280,63 @@ message CreateObjectReferenceResponse {} message CloneObjectRequest { // ObjectId string object_id = 1; - // From CollectionID - string collection_id = 2; - // Target CollectionID - string target_collection_id = 3; + // + oneof parent { + string project_id = 2; + string collection_id = 3; + string dataset_id = 4; + } } message CloneObjectResponse { // This describes the new object. - storage.models.v1.Object object = 1; + storage.models.v2.Object object = 1; } message DeleteObjectRequest { // ObjectId string object_id = 1; - // CollectionID - string collection_id = 2; // Delete including revisions - bool with_revisions = 3; - // Force delete including revisions - bool force = 4; + bool with_revisions = 2; } message DeleteObjectResponse {} -message DeleteObjectsRequest { - // Multiple ObjectIds - repeated string object_ids = 1; - // CollectionID - string collection_id = 2; - // Delete including revisions - bool with_revisions = 3; - // Force delete including revisions - bool force = 4; -} - -message DeleteObjectsResponse {} - -message ObjectWithURL { - // Description of a specified object - storage.models.v1.FullObjectReference object = 1; - // Download S3 urls - string url = 2; -} - -message GetObjectByIDRequest { - // Collection Id - string collection_id = 1; +message GetObjectRequest { // Object Id - string object_id = 2; - // Try to get URL for preferred endpoint - string preferred_endpoint = 3; + string object_id = 1; } -message GetObjectByIDResponse { ObjectWithURL object = 1; } +message GetObjectResponse { storage.models.v2.Object object = 1; } message GetObjectsRequest { - // Collection id - string collection_id = 1; - // Object start after - storage.models.v1.PageRequest page_request = 3; + // Object ids + repeated string object_ids = 1; } message GetObjectsResponse { - // A List of objects with (optional) associated URLs - repeated ObjectWithURL objects = 1; + // A List of objects + repeated storage.models.v2.Object objects = 1; } message GetObjectRevisionsRequest { - // Collection id - string collection_id = 1; // Object id string object_id = 2; - // Object start after - storage.models.v1.PageRequest page_request = 3; } message GetObjectRevisionsResponse { - // List of objects with (optional) URLs - repeated ObjectWithURL objects = 1; + // List of objects + repeated storage.models.v2.Object objects = 1; } message GetLatestObjectRevisionRequest { - // Collection id - string collection_id = 1; // Object id - string object_id = 2; + string object_id = 1; } message GetLatestObjectRevisionResponse { // The object with the latest revision - ObjectWithURL object = 1; + storage.models.v2.Object object = 1; } message GetObjectEndpointsRequest { @@ -611,121 +344,4 @@ message GetObjectEndpointsRequest { string collection_id = 1; // Object id string object_id = 2; -} - -message GetObjectEndpointsResponse { - // List of endpoints - repeated storage.models.v1.Endpoint endpoints = 1; -} - -message AddLabelsToObjectRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; - // List of labels that should be added to the list of labels - repeated storage.models.v1.KeyValue labels_to_add = 3; -} - -message AddLabelsToObjectResponse { - // Returns the updated Object - storage.models.v1.Object object = 1; -} - -message SetHooksOfObjectRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; - // This will overwrite all existing hooks - // Can be empty to remove all hooks - repeated storage.models.v1.KeyValue hooks = 3; -} - -message SetHooksOfObjectResponse { - // Returns the updated Object - storage.models.v1.Object object = 1; -} - -message GetReferencesRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; - // Should all revisions be included? - bool with_revisions = 3; -} - -message ObjectReference { - // Object id - string object_id = 1; - // Collection id - string collection_id = 2; - // Specific revision number - int64 revision_number = 3; - // Is the writeable? - bool is_writeable = 4; - // Path of object_ref - string path = 5; -} - -message GetReferencesResponse { - // List of object references - repeated ObjectReference references = 1; -} - -message UpdateObjectPathRequest { - string object_id = 1; - string collection_id = 2; - string new_subpath = 3; -} - -message UpdateObjectPathResponse { - ObjectReference reference = 1; -} - - -message GetObjectsByPathRequest { - string path = 1; - bool with_revisions = 2; -} - -message GetProjectCollectionIdsByPathRequest { - string path = 1; -} - -message GetProjectCollectionIdsByPathResponse { - string project_id = 1; - string collection_id = 2; -} - -message GetObjectsByPathResponse { - repeated storage.models.v1.FullObjectReference 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.FullObjectReference contents = 6; - repeated CommonPrefix prefixes = 7; - optional string next_continuation_token = 8; -} - - - +} \ No newline at end of file From 6fdaa1b6dda588e1d538260ee3b40b57221b2a03 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 09:49:45 +0200 Subject: [PATCH 30/51] feat: Draft for authorization service --- .../services/v2/authorization_service.proto | 127 ++++++++++++++++-- .../storage/services/v2/object_service.proto | 1 - 2 files changed, 118 insertions(+), 10 deletions(-) diff --git a/aruna/api/storage/services/v2/authorization_service.proto b/aruna/api/storage/services/v2/authorization_service.proto index 895d6fda..9b27e241 100644 --- a/aruna/api/storage/services/v2/authorization_service.proto +++ b/aruna/api/storage/services/v2/authorization_service.proto @@ -1,9 +1,118 @@ -message AddUserToProjectRequest { - string project_id = 1; - string user_id = 2; - storage.models.v1.Permission permission = 3; - } - - message AddUserToProjectResponse { - storage.models.v1.ProjectPermission permission = 4; - } \ No newline at end of file +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "AuthorizationService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + +// AuthorizationService +// +// Contains all methods to edit and change user authorization +service AuthorizationService { + // CreateAuthorization + // + // Status: BETA + // + // This creates a user-specific attribute that handles permission for a + // specific resource + rpc CreateAuthorization(CreateAuthorizationRequest) + returns (CreateAuthorizationResponse) { + option (google.api.http) = { + post : "/v2/auth" + body : "*" + }; + } + + // GetAuthorization + // + // Status: BETA + // + // This gets resource specific user authorizations + rpc GetAuthorizations(GetAuthorizationsRequest) + returns (GetAuthorizationsResponse) { + option (google.api.http) = { + get : "/v2/auths" + }; + } + + + // DeleteAuthorization + // + // Status: BETA + // + // This creates a user-specific attribute that handles permission for a + // specific resource + rpc DeleteAuthorizations(DeleteAuthorizationsRequest) + returns (DeleteAuthorizationsResponse) { + option (google.api.http) = { + get : "/v2/auths" + }; + } + + // UpdateAuthorization + // + // Status: BETA + // + // This creates a user-specific attribute that handles permission for a + // specific resource + rpc UpdateAuthorizations(UpdateAuthorizationsRequest) + returns (UpdateAuthorizationsResponse) { + option (google.api.http) = { + patch : "/v2/auths" + body : "*" + }; + } + +} + +message UserPermission { + string user_id = 1; + string user_name = 2; + storage.models.v2.PermissionLevel permission_level = 3; +} + +message ResourceAuthorization { + string resource_id = 1; + repeated UserPermission user_permission = 2; +} + +message CreateAuthorizationRequest { + string resource_id = 1; + string user_id = 2; + storage.models.v2.PermissionLevel permission_level = 3; // Can also include "deny" +} + +message CreateAuthorizationResponse { + UserPermission user_permission = 1; +} + +message GetAuthorizationsRequest { + string resource_id = 1; + bool recursive = 2; +} + + + +message GetAuthorizationsResponse { + repeated ResourceAuthorization authorizations = 1; +} + +message DeleteAuthorizationRequest { + string resource_id = 1; + string user_id = 2; +} + +message DeleteAuthorizationsResponse {} + +message UpdateAuthorizationsRequest { + string resource_id = 1; + string user_id = 2; + storage.models.v2.PermissionLevel permission_level = 3; +} + +message UpdateAuthorizationsResponse { + UserPermission user_permission = 1; +} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/object_service.proto b/aruna/api/storage/services/v2/object_service.proto index 948a3109..2d2363ed 100644 --- a/aruna/api/storage/services/v2/object_service.proto +++ b/aruna/api/storage/services/v2/object_service.proto @@ -263,7 +263,6 @@ message UpdateObjectRequest { string project_id = 8; string collection_id = 9; string dataset_id = 10; - bool none = 11; } optional storage.models.v2.Hash md5 = 12; optional storage.models.v2.Hash sha256 = 13; From 6a96f6142c8a1ddcda86352aad4618aeb5794e8a Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 09:51:24 +0200 Subject: [PATCH 31/51] fix: Fixed naming in authorization_service --- .../storage/services/v2/authorization_service.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/aruna/api/storage/services/v2/authorization_service.proto b/aruna/api/storage/services/v2/authorization_service.proto index 9b27e241..7d833cec 100644 --- a/aruna/api/storage/services/v2/authorization_service.proto +++ b/aruna/api/storage/services/v2/authorization_service.proto @@ -45,10 +45,11 @@ service AuthorizationService { // // This creates a user-specific attribute that handles permission for a // specific resource - rpc DeleteAuthorizations(DeleteAuthorizationsRequest) - returns (DeleteAuthorizationsResponse) { + rpc DeleteAuthorization(DeleteAuthorizationRequest) + returns (DeleteAuthorizationResponse) { option (google.api.http) = { - get : "/v2/auths" + delete : "/v2/auth" + body : "*" }; } @@ -61,7 +62,7 @@ service AuthorizationService { rpc UpdateAuthorizations(UpdateAuthorizationsRequest) returns (UpdateAuthorizationsResponse) { option (google.api.http) = { - patch : "/v2/auths" + patch : "/v2/auth" body : "*" }; } @@ -105,7 +106,7 @@ message DeleteAuthorizationRequest { string user_id = 2; } -message DeleteAuthorizationsResponse {} +message DeleteAuthorizationResponse {} message UpdateAuthorizationsRequest { string resource_id = 1; From d418aa35fa36855f6ab5addd711e06f97c89cca5 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 13:50:55 +0200 Subject: [PATCH 32/51] feat: Create relation service update models --- .../api/hooks/services/v2/hooks_service.proto | 6 +- .../services/v2/notification_service.proto | 8 +- aruna/api/storage/models/v2/models.proto | 36 ++++----- .../services/v2/authorization_service.proto | 7 +- .../services/v2/collection_service.proto | 32 ++------ .../storage/services/v2/dataset_service.proto | 34 ++------ .../services/v2/endpoint_service.proto | 5 +- .../storage/services/v2/object_service.proto | 76 +++++------------- .../storage/services/v2/project_service.proto | 22 ------ .../services/v2/relations_service.proto | 77 +++++++++++++++++++ .../storage/services/v2/user_service.proto | 2 +- 11 files changed, 141 insertions(+), 164 deletions(-) diff --git a/aruna/api/hooks/services/v2/hooks_service.proto b/aruna/api/hooks/services/v2/hooks_service.proto index 74215876..4e6ef1cf 100644 --- a/aruna/api/hooks/services/v2/hooks_service.proto +++ b/aruna/api/hooks/services/v2/hooks_service.proto @@ -23,6 +23,7 @@ service HooksService { enum TriggerType { TRIGGER_TYPE_UNSPECIFIED = 0; TRIGGER_TYPE_HOOK_ADDED = 1; + TRIGGER_TYPE_OBJECT_CREATED = 2; } message Trigger { @@ -41,8 +42,7 @@ 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; + INTERNAL_ACTION_CREATE_RELATION = 3; } message InternalHook { @@ -60,7 +60,7 @@ message Hook { } } -// Will be updated with additional credential types +// Will be expanded with additional credential types message Credentials { string token = 1; } diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index db14cfb8..093cd8a3 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -66,7 +66,7 @@ message CreateEventStreamingGroupRequest { EventStreamingGroupHierarchy hierarchy = 7; } -message EventStreamingGroupHierarchy { +message EventStreamingGroupHierarchy { string project_id = 1; string collection_id = 2; string object_id = 3; @@ -133,4 +133,8 @@ enum EventType { EVENT_TYPE_METADATA_UPDATED = 4; EVENT_TYPE_DELETED = 5; EVENT_TYPE_ALL = 6; -} \ No newline at end of file +} + + +PROJECT > COLLECTION > DATASET > OBJECT +PROJECT > OBJECT \ No newline at end of file diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index 0a0ac8a3..bbda3ebd 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -32,7 +32,6 @@ enum EndpointHostType { // Permission Levels enum PermissionLevel { PERMISSION_LEVEL_UNSPECIFIED = 0; - PERMISSION_LEVEL_DENY = 1; PERMISSION_LEVEL_NONE = 2; PERMISSION_LEVEL_READ = 3; PERMISSION_LEVEL_APPEND = 4; @@ -70,7 +69,6 @@ enum RelationDirection { RELATION_DIRECTION_UNSPECIFIED = 0; RELATION_DIRECTION_INBOUND = 1; RELATION_DIRECTION_OUTBOUND = 2; - RELATION_DIRECTION_BIDIRECTIONAL = 3; } // resourcetype @@ -150,13 +148,11 @@ message Permission { message Token { string id = 1; string name = 2; - google.protobuf.Timestamp created_at = 3; - google.protobuf.Timestamp expires_at = 4; + string user_id = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp expires_at = 5; // Tokens can either be personal or resource "specific" - oneof variant { - Permission permission = 5; - bool personal = 6; - } + optional Permission permission = 6; google.protobuf.Timestamp used_at = 7; } @@ -166,15 +162,11 @@ message CustomAttributes { string attribute_value = 2; } -message GlobalAttributes { +message UserAttributes { bool global_admin = 1; bool service_account = 2; - repeated CustomAttributes custom_attributes = 3; // This is a placeholder for future additional attributes -} - -message UserAttributes { - GlobalAttributes attributes = 1; - repeated Permission personal_permissions = 2; + repeated CustomAttributes custom_attributes = 3; + repeated Permission personal_permissions = 4; } // --------------- RELATION / KEYVALUES ------------------- @@ -269,13 +261,14 @@ message Project { DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; string created_by = 9; - Status status = 10; + Status status = 10; + bool dynamic = 11; } message Collection { string id = 1; - string name = 2; + string name = 2; string description = 3; // Collection specific labels / hooks repeated KeyValue key_values = 4; @@ -285,7 +278,8 @@ message Collection { DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; string created_by = 9; - Status status = 10; + Status status = 10; + bool dynamic = 11; } message Dataset { @@ -300,7 +294,8 @@ message Dataset { DataClass data_class = 7; google.protobuf.Timestamp created_at = 8; string created_by = 9; - Status status = 10; + Status status = 10; + bool dynamic = 11; } message Object { @@ -316,6 +311,7 @@ message Object { google.protobuf.Timestamp created_at = 8; string created_by = 9; Status status = 10; + bool dynamic = 11; // Object specific attributes - repeated Hash hashes = 11; + repeated Hash hashes = 12; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/authorization_service.proto b/aruna/api/storage/services/v2/authorization_service.proto index 7d833cec..41c4f78d 100644 --- a/aruna/api/storage/services/v2/authorization_service.proto +++ b/aruna/api/storage/services/v2/authorization_service.proto @@ -87,7 +87,10 @@ message CreateAuthorizationRequest { } message CreateAuthorizationResponse { - UserPermission user_permission = 1; + string resource_id = 1; + string user_id = 2; + string user_name = 3; + storage.models.v2.PermissionLevel permission_level = 4; } message GetAuthorizationsRequest { @@ -95,8 +98,6 @@ message GetAuthorizationsRequest { bool recursive = 2; } - - message GetAuthorizationsResponse { repeated ResourceAuthorization authorizations = 1; } diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index ddcad782..abce02db 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -96,18 +96,6 @@ service CollectionService { body : "*" }; } - - // UpdateCollectionExternalRelations - // - // Status: BETA - // - // Updates the collection name. All (meta) data will be overwritten. - rpc UpdateCollectionExternalRelations(UpdateCollectionExternalRelationsRequest) returns (UpdateCollectionExternalRelationsResponse) { - option (google.api.http) = { - patch : "/v2/collection/{collection_id}/external_relations" - body : "*" - }; - } // UpdateCollectionDataClass // @@ -137,15 +125,17 @@ service CollectionService { message CreateCollectionRequest { // collection name string name = 1; + // description + string description = 2; // collection specific labels / hooks - repeated storage.models.v2.KeyValue key_values = 2; + repeated storage.models.v2.KeyValue key_values = 3; // External relations (URLs / IDs from external sources) - repeated storage.models.v2.ExternalRelation external_relations = 3; + repeated storage.models.v2.ExternalRelation external_relations = 4; // DataClass - storage.models.v2.DataClass data_class = 4; + storage.models.v2.DataClass data_class = 5; // Parent_id MUST be collection oneof parent { - string project_id = 5; + string project_id = 6; } } @@ -207,16 +197,6 @@ message UpdateCollectionKeyValueResponse { storage.models.v2.Collection collection = 1; } -message UpdateCollectionExternalRelationsRequest { - string collection_id = 1; - repeated storage.models.v2.ExternalRelation add_relations = 2; - repeated storage.models.v2.ExternalRelation remove_relations = 3; -} - -message UpdateCollectionExternalRelationsResponse { - storage.models.v2.Collection collection = 1; -} - message UpdateCollectionDataClassRequest { string collection_id = 1; storage.models.v2.DataClass data_class = 2; diff --git a/aruna/api/storage/services/v2/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto index b9210f24..635313f9 100644 --- a/aruna/api/storage/services/v2/dataset_service.proto +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -96,18 +96,6 @@ service DatasetService { body : "*" }; } - - // UpdateDatasetExternalRelations - // - // Status: BETA - // - // Updates the dataset name. All (meta) data will be overwritten. - rpc UpdateDatasetExternalRelations(UpdateDatasetExternalRelationsRequest) returns (UpdateDatasetExternalRelationsResponse) { - option (google.api.http) = { - patch : "/v2/dataset/{dataset_id}/external_relations" - body : "*" - }; - } // UpdateDatasetDataClass // @@ -137,16 +125,18 @@ service DatasetService { message CreateDatasetRequest { // dataset name string name = 1; + // Description + string description = 2; // dataset specific labels / hooks - repeated storage.models.v2.KeyValue key_values = 2; + repeated storage.models.v2.KeyValue key_values = 3; // External relations (URLs / IDs from external sources) - repeated storage.models.v2.ExternalRelation external_relations = 3; + repeated storage.models.v2.ExternalRelation external_relations = 4; // DataClass - storage.models.v2.DataClass data_class = 4; + storage.models.v2.DataClass data_class = 5; // Parent_id MUST be dataset oneof parent { - string project_id = 5; - string collection_id = 6; + string project_id = 6; + string collection_id = 7; } } @@ -208,16 +198,6 @@ message UpdateDatasetKeyValueResponse { storage.models.v2.Dataset dataset = 1; } -message UpdateDatasetExternalRelationsRequest { - string dataset_id = 1; - repeated storage.models.v2.ExternalRelation add_relations = 2; - repeated storage.models.v2.ExternalRelation remove_relations = 3; -} - -message UpdateDatasetExternalRelationsResponse { - storage.models.v2.Dataset dataset = 1; -} - message UpdateDatasetDataClassRequest { string dataset_id = 1; storage.models.v2.DataClass data_class = 2; diff --git a/aruna/api/storage/services/v2/endpoint_service.proto b/aruna/api/storage/services/v2/endpoint_service.proto index a433e227..d74fc200 100644 --- a/aruna/api/storage/services/v2/endpoint_service.proto +++ b/aruna/api/storage/services/v2/endpoint_service.proto @@ -126,10 +126,7 @@ message DeleteEndpointRequest { message DeleteEndpointResponse {} -message GetDefaultEndpointRequest { - // (optional identifier) - string server_identifier = 1; -} +message GetDefaultEndpointRequest {} message GetDefaultEndpointResponse { // Default endpoint of the server instance diff --git a/aruna/api/storage/services/v2/object_service.proto b/aruna/api/storage/services/v2/object_service.proto index 2d2363ed..06b5a4ce 100644 --- a/aruna/api/storage/services/v2/object_service.proto +++ b/aruna/api/storage/services/v2/object_service.proto @@ -14,16 +14,14 @@ import "google/api/annotations.proto"; // Contains all methods that get/create or update Objects and associated resources service ObjectService { - // InitializeObject + // CreateObject // // Status: BETA // - // This initializes a new object + // This creates a new object // Initializing an object will put it in a staging area. - // Staged objects will get a separate staging id and need to be finished - // before they can be used. - rpc InitializeObject(InitializeObjectRequest) - returns (InitializeObjectResponse) { + rpc CreateObject(CreateObjectRequest) + returns (CreateObjectResponse) { option (google.api.http) = { post : "/v2/object" body : "*" @@ -40,7 +38,7 @@ service ObjectService { // part of the file / multipart upload. rpc GetUploadURL(GetUploadURLRequest) returns (GetUploadURLResponse) { option (google.api.http) = { - get : "/v2/object/{object_id}/staging/{upload_id}/upload" + get : "/v2/object/{object_id}/upload" }; } @@ -135,35 +133,6 @@ service ObjectService { get : "/v2/objects" }; } - - // GetObjectRevisions - // - // Status: BETA - // - // This returns the full list of revisions of a specified object - // With the optional with_url boolean a download link can automatically be - // requested for each Object This is by default a paginated request - rpc GetObjectRevisions(GetObjectRevisionsRequest) - returns (GetObjectRevisionsResponse) { - option (google.api.http) = { - get : "/v2/object/{object_id}/revisions" - }; - } - - // GetLatestObjectRevision - // - // Status: BETA - // - // This returns the latest revision of a specific object - // The returned `latest` object will have a different id if the current - // object is not the latest revision - rpc GetLatestObjectRevision(GetLatestObjectRevisionRequest) - returns (GetLatestObjectRevisionResponse) { - option (google.api.http) = { - get : "/v2/object/{object_id}/latest" - }; - } - } // Models @@ -171,25 +140,28 @@ service ObjectService { // gRPC best practises advice each Request and Response message in a RPC to be // called {rpc_name}Request and {rpc_name}Response. -message InitializeObjectRequest { +message CreateObjectRequest { // collection name string name = 1; + // description + string description = 2; // collection specific labels / hooks - repeated storage.models.v2.KeyValue key_values = 2; + repeated storage.models.v2.KeyValue key_values = 3; // External relations (URLs / IDs from external sources) - repeated storage.models.v2.ExternalRelation external_relations = 3; + repeated storage.models.v2.ExternalRelation external_relations = 4; // DataClass - storage.models.v2.DataClass data_class = 4; + storage.models.v2.DataClass data_class = 5; // Parent can be one of all other resources oneof parent { - string project_id = 5; - string collection_id = 6; - string dataset_id = 7; + string project_id = 6; + string collection_id = 7; + string dataset_id = 8; } - repeated storage.models.v2.Hash md5 = 8; + repeated storage.models.v2.Hash hashes = 9; + optional string preferred_endpoint_id = 10; } -message InitializeObjectResponse { +message CreateObjectResponse { storage.models.v2.Object object = 1; } @@ -233,7 +205,7 @@ message FinishObjectStagingRequest { // If the upload was multipart, this is the list of parts that were uploaded. // Should be empty if the upload was not multipart. // (optional) - repeated CompletedParts completed_parts = 4; + repeated CompletedParts completed_parts = 3; } message FinishObjectStagingResponse { @@ -252,10 +224,6 @@ message UpdateObjectRequest { repeated storage.models.v2.KeyValue add_key_values = 4; // key_values to remove repeated storage.models.v2.KeyValue remove_key_values = 5; - // External relations (URLs / IDs from external sources) to add - repeated storage.models.v2.ExternalRelation add_external_relations = 6; - // External relations to remove - // New DataClass optional storage.models.v2.DataClass data_class = 7; // Parent can be one of all other resources @@ -264,18 +232,14 @@ message UpdateObjectRequest { string collection_id = 9; string dataset_id = 10; } - optional storage.models.v2.Hash md5 = 12; - optional storage.models.v2.Hash sha256 = 13; - optional string preferred_endpoint_id = 14; + repeated storage.models.v2.Hash hashes = 12; } message UpdateObjectResponse { storage.models.v2.Object object = 1; - bool copied = 2; + bool new_revision = 2; } -message CreateObjectReferenceResponse {} - message CloneObjectRequest { // ObjectId string object_id = 1; diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto index e1ba8db6..bcecde0a 100644 --- a/aruna/api/storage/services/v2/project_service.proto +++ b/aruna/api/storage/services/v2/project_service.proto @@ -124,18 +124,6 @@ service ProjectService { body : "*" }; } - - // UpdateProjectExternalRelations - // - // Status: BETA - // - // Updates the project name. All (meta) data will be overwritten. - rpc UpdateProjectExternalRelations(UpdateProjectExternalRelationsRequest) returns (UpdateProjectExternalRelationsResponse) { - option (google.api.http) = { - patch : "/v2/project/{project_id}/external_relations" - body : "*" - }; - } // UpdateProjectDataClass // @@ -237,16 +225,6 @@ message UpdateProjectKeyValueResponse { storage.models.v2.Project project = 1; } -message UpdateProjectExternalRelationsRequest { - string project_id = 1; - repeated storage.models.v2.ExternalRelation add_relations = 2; - repeated storage.models.v2.ExternalRelation remove_relations = 3; -} - -message UpdateProjectExternalRelationsResponse { - storage.models.v2.Project project = 1; -} - message UpdateProjectDataClassRequest { string project_id = 1; storage.models.v2.DataClass data_class = 2; diff --git a/aruna/api/storage/services/v2/relations_service.proto b/aruna/api/storage/services/v2/relations_service.proto index e69de29b..1133aba7 100644 --- a/aruna/api/storage/services/v2/relations_service.proto +++ b/aruna/api/storage/services/v2/relations_service.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "RelationsService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + +// RelationsService +// +// Contains all methods to edit and change resource relations +service RelationsService { + // ModifyRelation + // + // Status: BETA + // + // Modifys all relations to / from a resource + rpc ModifyRelations(ModifyRelationsRequest) + returns (ModifyRelationsResponse) { + option (google.api.http) = { + post : "/v2/relation" + body : "*" + }; + } + + // GetHierachy + // + // Status: BETA + // + // Gets all downstream hierarchy relations from a resource + rpc GetHierachy(GetHierachyRequest) + returns (GetHierachyResponse) { + option (google.api.http) = { + get : "/v2/relation/hierarchy" + }; + } +} + +message ModifyRelationsRequest { + string resource_id = 1; + repeated storage.models.v2.Relation add_relations = 2; + repeated storage.models.v2.Relation remove_relations = 3; +} + +message ModifyRelationsResponse {} + +message GetHierachyRequest { + string resource_id = 1; +} + +message DatasetRelations { + string origin = 1; + repeated string object_children = 2; +} + +message CollectionRelations { + string origin = 1; + repeated DatasetRelations dataset_children = 2; + repeated string object_children = 3; +} + +message ProjectRelations { + string origin = 1; + repeated CollectionRelations collection_children = 2; + repeated DatasetRelations dataset_children = 3; + repeated string object_children = 4; +} + +message GetHierachyResponse { + oneof graph { + ProjectRelations project = 1; + CollectionRelations collection = 2; + DatasetRelations dataset = 3; + } +} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/user_service.proto b/aruna/api/storage/services/v2/user_service.proto index a6c54728..d5fab9d4 100644 --- a/aruna/api/storage/services/v2/user_service.proto +++ b/aruna/api/storage/services/v2/user_service.proto @@ -165,7 +165,7 @@ service UserService { // // Status: ALPHA // - // Get all users inkluding permissions (Admin only) + // Get all users including permissions (Admin only) rpc GetAllUsers(GetAllUsersRequest) returns (GetAllUsersResponse) { option (google.api.http) = { From 53eb921dfe0c0ab249df1d065ffa5145fa186f83 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 15:07:48 +0200 Subject: [PATCH 33/51] feat: Added DataProxy service --- .../services/v2/bundler_service.proto | 11 ++ .../services/v2/dataproxy_service.proto | 126 ++++++++++++++++++ .../services/v2/notification_service.proto | 5 +- 3 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 aruna/api/dataproxy/services/v2/bundler_service.proto create mode 100644 aruna/api/dataproxy/services/v2/dataproxy_service.proto diff --git a/aruna/api/dataproxy/services/v2/bundler_service.proto b/aruna/api/dataproxy/services/v2/bundler_service.proto new file mode 100644 index 00000000..57340e62 --- /dev/null +++ b/aruna/api/dataproxy/services/v2/bundler_service.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package aruna.api.dataproxy.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/dataproxy/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.services.v2"; +option java_outer_classname = "BundlerService"; + +import "google/api/visibility.proto"; +import "google/protobuf/timestamp.proto"; +import "aruna/api/storage/models/v2/models.proto"; \ No newline at end of file diff --git a/aruna/api/dataproxy/services/v2/dataproxy_service.proto b/aruna/api/dataproxy/services/v2/dataproxy_service.proto new file mode 100644 index 00000000..fc1ed12c --- /dev/null +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; + +package aruna.api.dataproxy.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/dataproxy/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.services.v2"; +option java_outer_classname = "DataProxyService"; + +import "google/api/visibility.proto"; +import "google/protobuf/timestamp.proto"; +import "aruna/api/storage/models/v2/models.proto"; + + + +service DataproxyService { + // InitReplication + // + // Status: BETA + // + // Creates a replication request + rpc RequestReplication(RequestReplicationRequest) returns (RequestReplicationResponse) {} + rpc InitReplication(InitReplicationRequest) returns (InitReplicationResponse) {} +} + +service DataproxyUserService { + rpc GetCredentials(GetCredentialsRequest) returns (GetCredentialsResponse) { + option (google.api.http) = { + post : "/v2/credentials" + body : "*" + }; + } + rpc PushReplica(PushReplicaRequest) returns (PushReplicaResponse) { + option (google.api.http) = { + post : "/v2/replica/push" + body : "*" + }; + } + rpc PullReplica(PullReplicaRequest) returns (PullReplicaResponse) { + option (google.api.http) = { + post : "/v2/replica/pull" + body : "*" + }; + } + rpc ReplicationStatus(ReplicationStatusRequest) returns (ReplicationStatusResponse) { + option (google.api.http) = { + get : "/v2/replica/status" + }; + } +} + +message DataProxyInfo { + string dataproxy_id = 1; + int64 available_space = 2; +} + +message RequestReplicationRequest { + DataProxyInfo info = 1; + bool user_initialized = 2; +} + +message RequestReplicationResponse { + oneof response { + string download_url = 1; + bool ack = 2; + } +} + +message InitReplicationRequest { + string url = 1; +} + +message InitReplicationResponse { + bool ack = 1; +} + +message GetCredentialsRequest {} + +message GetCredentialsResponse { + string access_key = 1; + string secret_key = 2; +} + +message S3Path { + string bucket = 1; + string key = 2; +} + +message PushReplicaRequest { + oneof resource { + string resource_id = 1; + S3Path s3_path = 2; + } + string target_location = 3; +} + +message PushReplicaResponse { + string replication_id = 1; +} + +message PullReplicaRequest { + oneof resource { + string resource_id = 1; + S3Path s3_path = 2; + } +} + +message PullReplicaResponse { + string replication_id = 1; +} + +message ReplicationStatusRequest { + string replication_id = 1; +} + +enum ReplicationStatus { + REPLICATION_STATUS_UNDEFINED = 0; + REPLICATION_STATUS_PENDING = 1; + REPLICATION_STATUS_RUNNING = 2; + REPLICATION_STATUS_FINISHED = 3; + REPLICATION_STATUS_ERROR = 4; +} + +message ReplicationStatusResponse { + ReplicationStatus status = 1; + string message = 2; +} \ No newline at end of file diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index 093cd8a3..ae472816 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -1,9 +1,9 @@ syntax = "proto3"; package aruna.api.notification.services.v2; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/notification/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.notification.services.v2"; option java_outer_classname = "UpdateNotificationServices"; import "google/api/visibility.proto"; @@ -17,7 +17,6 @@ import "aruna/api/storage/models/v2/models.proto"; // A service to receive events in the AOS storage service EventNotificationService { - option (google.api.api_visibility).restriction = "UNFINISHED"; // CreateEventStreamingGroup // // Creates a new EventStreamingGroup From e6ca3189c04b9bc32108c809cfebdca293a58786 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 15:17:59 +0200 Subject: [PATCH 34/51] feat: Added Bundler service --- .../services/v2/bundler_service.proto | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/aruna/api/dataproxy/services/v2/bundler_service.proto b/aruna/api/dataproxy/services/v2/bundler_service.proto index 57340e62..baf4d593 100644 --- a/aruna/api/dataproxy/services/v2/bundler_service.proto +++ b/aruna/api/dataproxy/services/v2/bundler_service.proto @@ -8,4 +8,37 @@ option java_outer_classname = "BundlerService"; import "google/api/visibility.proto"; import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v2/models.proto"; \ No newline at end of file +import "aruna/api/storage/models/v2/models.proto"; + + +service BundlerService { + rpc CreateBundle(CreateBundleRequest) returns (CreateBundleResponse) { + option (google.api.http) = { + post : "/v2/bundle" + body : "*" + }; + } + rpc DeleteBundle(DeleteBundleRequest) returns (DeleteBundleResponse) { + option (google.api.http) = { + delete : "/v2/bundle" + body : "*" + }; + } +} + + +message CreateBundleRequest { + repeated string resource_id = 1; + string filename = 2; // .tar.gz / .zip + google.protobuf.Timestamp expires_at = 3; // Default 1 Month +} + +message CreateBundleResponse { + string bundle_url = 1; +} + +message DeleteBundleRequest{ + string bundle_id = 1; +} + +message DeleteBundleResponse {} \ No newline at end of file From fb5e5035feb5518341f8385e78fc8bfa2c34dc21 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Wed, 12 Jul 2023 16:54:27 +0200 Subject: [PATCH 35/51] feat: First iteration of new notification subjects --- .../services/v2/dataproxy_service.proto | 9 +- .../services/v2/notification_service.proto | 83 +++++++++++++++---- .../storage/services/v2/user_service.proto | 2 - 3 files changed, 75 insertions(+), 19 deletions(-) diff --git a/aruna/api/dataproxy/services/v2/dataproxy_service.proto b/aruna/api/dataproxy/services/v2/dataproxy_service.proto index fc1ed12c..c69452db 100644 --- a/aruna/api/dataproxy/services/v2/dataproxy_service.proto +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -13,12 +13,19 @@ import "aruna/api/storage/models/v2/models.proto"; service DataproxyService { - // InitReplication + + // RequestReplication // // Status: BETA // // Creates a replication request rpc RequestReplication(RequestReplicationRequest) returns (RequestReplicationResponse) {} + + // InitReplication + // + // Status: BETA + // + // Creates a replication request rpc InitReplication(InitReplicationRequest) returns (InitReplicationResponse) {} } diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index ae472816..b2d2a672 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -111,11 +111,67 @@ message StreamFromDate { google.protobuf.Timestamp timestamp = 1; } message StreamAll {} -message EventNotificationMessage { +enum ResourceEventType { + RESOURCE_EVENT_TYPE_UNSPECIFIED = 0; + RESOURCE_EVENT_TYPE_CREATED = 1; + RESOURCE_EVENT_TYPE_AVAILABLE = 2; + RESOURCE_EVENT_TYPE_UPDATED = 3; + RESOURCE_EVENT_TYPE_DELETED = 4; +} + +message RelationUpdate { + repeated storage.models.v2.Relation add_relations = 2; + repeated storage.models.v2.Relation remove_relations = 3; +} + +message Fields { + repeated string updated_fields = 1; +} + +message ResourceEventContext { + oneof event { + Fields updated_fields = 1; + RelationUpdate relation_updates = 2; + string custom_context = 3; + } +} + +message ResourceEvent { aruna.api.storage.models.v2.ResourceType resource = 1; string resource_id = 2; - EventType updated_type = 3; - Reply reply = 4; + string resource_name = 3; + ResourceEventType event_type = 4; + optional ResourceEventContext context = 5; + Reply reply = 6; +} + +enum UserEventType { + USER_EVENT_TYPE_UNSPECIFIED = 0; + USER_EVENT_TYPE_CREATED = 1; + USER_EVENT_TYPE_UPDATED = 2; + USER_EVENT_TYPE_DELETED = 3; +} + +message Token { + string id = 1; + optional aruna.api.storage.models.v2.Permission permission = 2; +} + +message UserEventContext { + oneof event { + string updated_field = 1; + bool admin = 2; + Token token = 3; + aruna.api.storage.models.v2.Permission permission = 4; + } +} + +message UserEvent { + string user_id = 1; + string user_name = 2; + UserEventType event_type = 3; + optional UserEventContext context = 4; + Reply reply = 5; } message Reply { @@ -124,16 +180,11 @@ message Reply { string hmac = 3; } -enum EventType { - EVENT_TYPE_UNSPECIFIED = 0; - EVENT_TYPE_CREATED = 1; - EVENT_TYPE_AVAILABLE = 2; - EVENT_TYPE_UPDATED = 3; - EVENT_TYPE_METADATA_UPDATED = 4; - EVENT_TYPE_DELETED = 5; - EVENT_TYPE_ALL = 6; -} - - -PROJECT > COLLECTION > DATASET > OBJECT -PROJECT > OBJECT \ No newline at end of file +message AnouncementEvent { + // New dataproxy + // Removed dataproxy + // Updated dataproxy + // Scheduled downtime (location + component) + // New version (component) + // ... +} \ No newline at end of file diff --git a/aruna/api/storage/services/v2/user_service.proto b/aruna/api/storage/services/v2/user_service.proto index d5fab9d4..378cf2e7 100644 --- a/aruna/api/storage/services/v2/user_service.proto +++ b/aruna/api/storage/services/v2/user_service.proto @@ -265,8 +265,6 @@ message UpdateUserDisplayNameResponse { message ActivateUserRequest { // User to activate string user_id = 1; - // (optional) add user to project - storage.models.v2.ProjectPermission project_perms = 2; } message ActivateUserResponse {} From b37a86587166e0e675a2a5b475fc425d8c379e42 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:11:02 +0200 Subject: [PATCH 36/51] feat: Update dataproxy service to include more data information --- .../services/v2/dataproxy_service.proto | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/aruna/api/dataproxy/services/v2/dataproxy_service.proto b/aruna/api/dataproxy/services/v2/dataproxy_service.proto index c69452db..8508e960 100644 --- a/aruna/api/dataproxy/services/v2/dataproxy_service.proto +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -25,29 +25,50 @@ service DataproxyService { // // Status: BETA // - // Creates a replication request + // Provides the necessary url to init replication rpc InitReplication(InitReplicationRequest) returns (InitReplicationResponse) {} } service DataproxyUserService { + // GetCredentials + // + // Status: BETA + // + // Authorized method that needs a aruna-token to exchange for dataproxy + // specific S3AccessKey and S3SecretKey rpc GetCredentials(GetCredentialsRequest) returns (GetCredentialsResponse) { option (google.api.http) = { post : "/v2/credentials" body : "*" }; } + // PushReplica + // + // Status: BETA + // + // Manually transfers a replica to another data-proxy rpc PushReplica(PushReplicaRequest) returns (PushReplicaResponse) { option (google.api.http) = { post : "/v2/replica/push" body : "*" }; } + // PullReplica + // + // Status: BETA + // + // Manually request data to be transferred to this data-proxy rpc PullReplica(PullReplicaRequest) returns (PullReplicaResponse) { option (google.api.http) = { post : "/v2/replica/pull" body : "*" }; } + // PullReplica + // + // Status: BETA + // + // Status of the previous replication request rpc ReplicationStatus(ReplicationStatusRequest) returns (ReplicationStatusResponse) { option (google.api.http) = { get : "/v2/replica/status" @@ -65,15 +86,26 @@ message RequestReplicationRequest { bool user_initialized = 2; } +message DataInfo { + string object_id = 1; + string download_url = 2; + string encryption_key = 3; + bool is_compressed = 4; +} + +message DataInfos { + repeated DataInfo data_info = 1; +} + message RequestReplicationResponse { oneof response { - string download_url = 1; + DataInfos data_infos = 1; bool ack = 2; } } message InitReplicationRequest { - string url = 1; + DataInfos data_infos = 1; } message InitReplicationResponse { From 4d59adc019c7844aba5265a27e0cd9dd25cff626 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:20:02 +0200 Subject: [PATCH 37/51] feat: Update workspace api --- .../services/v2/workspace_service.proto | 54 ++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/aruna/api/storage/services/v2/workspace_service.proto b/aruna/api/storage/services/v2/workspace_service.proto index a4b6fad0..a3e9cc62 100644 --- a/aruna/api/storage/services/v2/workspace_service.proto +++ b/aruna/api/storage/services/v2/workspace_service.proto @@ -1,7 +1,29 @@ -/ WorkspaceService -// +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "WorkspaceService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + // Service to manage "special" anonymous collections / workspaces service WorkspaceService { + + // CreatesNewWorkspaceTemplate + // + // Status: ALPHA + // + // This will create a new template for workspaces (admin only) + rpc CreateWorkspaceTemplate(CreateWorkspaceTemplateRequest) + returns (CreateWorkspaceTemplateResponse) { + option (google.api.http) = { + post : "/v2/workspace/template" + body : "*" + }; + } + // CreateWorkspace // // Status: ALPHA @@ -10,7 +32,7 @@ service WorkspaceService { rpc CreateWorkspace(CreateWorkspaceRequest) returns (CreateWorkspaceResponse) { option (google.api.http) = { - post : "/v1/workspace" + post : "/v2/workspace" body : "*" }; } @@ -24,7 +46,7 @@ service WorkspaceService { rpc DeleteWorkspace(DeleteWorkspaceRequest) returns (DeleteWorkspaceResponse) { option (google.api.http) = { - delete : "/v1/workspace/{workspace_id}" + delete : "/v2/workspace/{workspace_id}" body : "*" }; } @@ -37,7 +59,7 @@ service WorkspaceService { rpc ClaimWorkspace(ClaimWorkspaceRequest) returns (ClaimWorkspaceResponse) { option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/claim" + post : "/v2/workspace/{workspace_id}/claim" body : "*" }; } @@ -50,7 +72,7 @@ service WorkspaceService { rpc MoveWorkspaceData(MoveWorkspaceDataRequest) returns (MoveWorkspaceDataResponse) { option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/move/{collection_id}" + post : "/v2/workspace/{workspace_id}/move/{project_id}" body : "*" }; } @@ -58,8 +80,23 @@ service WorkspaceService { // Models: +message CreateWorkspaceTemplateRequest { + // The user id of the template owner (will be automatically added as "admin" to each associated workspace) + string owner_id = 1; + // Short prefix for each workspace_project (will be prepended by a random id) example: test-i12ashj9g2 + string prefix = 2; + // The name of the workspace template + string name = 3; + // Key values / hooks that must be added to each participant of the workspace + repeated storage.models.v2.KeyValue key_values = 4; +} + +message CreateWorkspaceTemplateResponse { + string template_name = 1; +} + message CreateWorkspaceRequest { - string project_name = 1; + string workspace_template = 1; } message CreateWorkspaceResponse{ @@ -86,8 +123,9 @@ message ClaimWorkspaceRequest { message ClaimWorkspaceResponse {} message MoveWorkspaceDataRequest { + // This will update all objects as "non_workspace" and move the root to another project string workspace_id = 1; - string collection_id = 2; + string project_id = 2; } message MoveWorkspaceDataResponse {} \ No newline at end of file From 38650ec77dd04087c40ddd8009dc0ef1e79c9fe2 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:20:54 +0200 Subject: [PATCH 38/51] feat: Added Workspace dataclass --- aruna/api/storage/models/v2/models.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index bbda3ebd..977cace9 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -11,7 +11,8 @@ enum DataClass { DATA_CLASS_UNSPECIFIED = 0; DATA_CLASS_PUBLIC = 1; DATA_CLASS_PRIVATE = 2; - DATA_CLASS_CONFIDENTIAL = 3; + DATA_CLASS_WORKSPACE = 4; + DATA_CLASS_CONFIDENTIAL = 5; } // Which kind of endpoint @@ -152,7 +153,7 @@ message Token { google.protobuf.Timestamp created_at = 4; google.protobuf.Timestamp expires_at = 5; // Tokens can either be personal or resource "specific" - optional Permission permission = 6; + optional Permission permission = 6; google.protobuf.Timestamp used_at = 7; } @@ -267,9 +268,9 @@ message Project { message Collection { - string id = 1; - string name = 2; - string description = 3; + string id = 1; // ASDASDASDOPASKIDPO + string name = 2; // my_mags + string description = 3; // ENA asda234928349028 MAG 1293819203819028i V1 // Collection specific labels / hooks repeated KeyValue key_values = 4; // Relations to internal and external sources From 89d74e492aafebec929f9ce4608d19c8530cd98e Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:28:10 +0200 Subject: [PATCH 39/51] feat: Updated service_account_service --- .../services/v2/service_account_service.proto | 95 ++++++++----------- 1 file changed, 41 insertions(+), 54 deletions(-) diff --git a/aruna/api/storage/services/v2/service_account_service.proto b/aruna/api/storage/services/v2/service_account_service.proto index 6b951c04..9080b7ce 100644 --- a/aruna/api/storage/services/v2/service_account_service.proto +++ b/aruna/api/storage/services/v2/service_account_service.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package aruna.api.storage.services.v1; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v1"; +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; option java_multiple_files = true; -option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v1"; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "ServiceAccountService"; -import "aruna/api/storage/models/v1/auth.proto"; +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; @@ -19,108 +19,111 @@ service ServiceAccountService { // CreateServiceAccount // + // Status: BETA + // // Creates a service account for a given project // If the service account has permissions for the global Admin project // it will be a global service account that can interact with any resource rpc CreateServiceAccount(CreateServiceAccountRequest) returns (CreateServiceAccountResponse){ option (google.api.http) = { - post : "/v1/service_account" + post : "/v2/service_account" body : "*" }; } // CreateServiceAccountToken // + // Status: BETA + // // Creates a token for a service account // Each service account can only have one permission -> The token will have the same permission as the // service account rpc CreateServiceAccountToken(CreateServiceAccountTokenRequest) returns (CreateServiceAccountTokenResponse){ option (google.api.http) = { - post : "/v1/service_account/{svc_account_id}/token" + post : "/v2/service_account/{svc_account_id}/token" body : "*" }; } // SetServiceAccountPermission // + // Status: BETA + // // Overwrites the project specific permissions for a service account rpc SetServiceAccountPermission(SetServiceAccountPermissionRequest) returns (SetServiceAccountPermissionResponse){ option (google.api.http) = { - put : "/v1/service_account/{svc_account_id}/permissions" + put : "/v2/service_account/{svc_account_id}/permissions" body : "*" }; } // GetServiceAccountToken // + // Status: BETA + // // This requests the overall information about a specifc service account token (by id) // it will not contain the token itself. rpc GetServiceAccountToken(GetServiceAccountTokenRequest) returns (GetServiceAccountTokenResponse){ option (google.api.http) = { - get : "/v1/service_account/{svc_account_id}/token/{token_id}" + get : "/v2/service_account/{svc_account_id}/token/{token_id}" }; } // GetServiceAccountTokens // + // Status: BETA + // // This requests the overall information about all service account tokens // it will not contain the token itself. rpc GetServiceAccountTokens(GetServiceAccountTokensRequest) returns (GetServiceAccountTokensResponse){ option (google.api.http) = { - get : "/v1/service_account/{svc_account_id}/tokens" - }; - } - - // GetServiceAccountsByProject - // - // Will request all service_accounts for a given project - // each service account is bound to a specific project - rpc GetServiceAccountsByProject(GetServiceAccountsByProjectRequest) returns (GetServiceAccountsByProjectResponse){ - option (google.api.http) = { - get : "/v1/service_account/project/{project_id}" + get : "/v2/service_account/{svc_account_id}/tokens" }; } // DeleteServiceAccountToken - // + // + // Status: BETA + // // Deletes one service account token by ID rpc DeleteServiceAccountToken(DeleteServiceAccountTokenRequest) returns (DeleteServiceAccountTokenResponse){ option (google.api.http) = { - delete : "/v1/service_account/{svc_account_id}/token/{token_id}" + delete : "/v2/service_account/{svc_account_id}/token/{token_id}" }; } // DeleteServiceAccountTokens - // + // + // Status: BETA + // // Deletes all service account tokens rpc DeleteServiceAccountTokens(DeleteServiceAccountTokensRequest) returns (DeleteServiceAccountTokensResponse){ option (google.api.http) = { - delete : "/v1/service_account/{svc_account_id}/tokens" + delete : "/v2/service_account/{svc_account_id}/tokens" }; } // DeleteServiceAccount - // + // + // Status: BETA + // // Deletes a service account (by id) rpc DeleteServiceAccount(DeleteServiceAccountRequest) returns (DeleteServiceAccountResponse){ option (google.api.http) = { - delete : "/v1/service_account/{svc_account_id}" + delete : "/v2/service_account/{svc_account_id}" }; } } - message CreateServiceAccountRequest { string name = 1; - string project_id = 2; - storage.models.v1.Permission permission = 3; + storage.models.v2.Permission permission = 3; } message ServiceAccount { string svc_account_id = 1; - string project_id = 2; - string name = 3; - storage.models.v1.Permission permission = 4; + string name = 2; + storage.models.v2.Permission permission = 3; } message CreateServiceAccountResponse { @@ -130,31 +133,23 @@ message CreateServiceAccountResponse { message CreateServiceAccountTokenRequest { string svc_account_id = 1; // Identify the associated project (should always be provided) - string project_id = 2; - // Collection id, will be empty if permission should be on project level - string collection_id = 3; + storage.models.v2.Permission permission = 2; // (optional) Token name - string name = 4; + string name = 3; // (optional) Token expiry - google.protobuf.Timestamp expires_at = 5; - // Token permissions, must be less than or equal user permissions - storage.models.v1.Permission permission = 6; + google.protobuf.Timestamp expires_at = 4; } message CreateServiceAccountTokenResponse { // This contains only the token description - storage.models.v1.Token token = 1; + storage.models.v2.Token token = 1; // This is the actual secret API token string token_secret = 2; - // S3 Access Key - string s3_access_key = 3; - // S3 Secret Key - string s3_secret_key = 4; } message SetServiceAccountPermissionRequest { string svc_account_id = 1; - storage.models.v1.Permission new_permission = 2; + storage.models.v2.Permission permission = 2; } message SetServiceAccountPermissionResponse { @@ -168,7 +163,7 @@ message GetServiceAccountTokenRequest { message GetServiceAccountTokenResponse { // This contains only the token description - storage.models.v1.Token token = 1; + storage.models.v2.Token token = 1; } message GetServiceAccountTokensRequest { @@ -177,15 +172,7 @@ message GetServiceAccountTokensRequest { message GetServiceAccountTokensResponse { // This contains only the token description - repeated storage.models.v1.Token token = 1; -} - -message GetServiceAccountsByProjectRequest { - string project_id = 1; -} - -message GetServiceAccountsByProjectResponse { - repeated ServiceAccount svc_accounts = 1; + repeated storage.models.v2.Token token = 1; } message DeleteServiceAccountTokenRequest { From e6bf93223f4f0012a06837feca64418b3d872dfa Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:35:19 +0200 Subject: [PATCH 40/51] feat: Update hook service --- .../api/hooks/services/v2/hooks_service.proto | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/aruna/api/hooks/services/v2/hooks_service.proto b/aruna/api/hooks/services/v2/hooks_service.proto index 4e6ef1cf..7c4c42d3 100644 --- a/aruna/api/hooks/services/v2/hooks_service.proto +++ b/aruna/api/hooks/services/v2/hooks_service.proto @@ -5,6 +5,7 @@ option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "HooksService"; +import "google/api/annotations.proto"; import "aruna/api/storage/models/v2/models.proto"; @@ -14,10 +15,27 @@ import "aruna/api/storage/models/v2/models.proto"; // // 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) {} + rpc CreateHook(CreateHookRequest) returns (CreateHookResponse) { + option (google.api.http) = { + post : "/v2/hook" + body : "*" + }; + } + rpc ListHooks(ListHooksRequest) returns (ListHooksResponse) { + option (google.api.http) = { + get : "/v2/hooks/project/{project_id}" + }; + } + rpc DeleteHook(DeleteHookRequest) returns (DeleteHookResponse) { + option (google.api.http) = { + delete : "/v2/hook/{hook_id}" + }; + } + rpc HookCallback(HookCallbackRequest) returns (HookCallbackResponse) { + option (google.api.http) = { + delete : "/v2/hook/callback" + }; + } } enum TriggerType { @@ -83,8 +101,8 @@ message DeleteHookResponse {} message HookCallbackRequest { bool success = 1; - repeated aruna.api.storage.models.v2.KeyValue labels = 2; - repeated aruna.api.storage.models.v2.KeyValue hooks = 3; + repeated aruna.api.storage.models.v2.KeyValue add_key_values = 2; + repeated aruna.api.storage.models.v2.KeyValue remove_key_values = 3; } message HookCallbackResponse{} @@ -93,7 +111,6 @@ message ListHooksRequest{ string project_id = 1; } - message HookInfo { string hook_id = 1; Hook hook = 2; From 0fe16d26002f5e2215cf599902797fdcf204b1e1 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:47:14 +0200 Subject: [PATCH 41/51] feat: Rudimentary search service --- .../storage/services/v2/search_service.proto | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/aruna/api/storage/services/v2/search_service.proto b/aruna/api/storage/services/v2/search_service.proto index e69de29b..5b1c1995 100644 --- a/aruna/api/storage/services/v2/search_service.proto +++ b/aruna/api/storage/services/v2/search_service.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; + +package aruna.api.storage.services.v2; +option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/services/v2"; +option java_multiple_files = true; +option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; +option java_outer_classname = "SearchService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + + +service SearchService { + + // SearchResources + // + // Status: BETA + // + // Searches the index for applicable resources (only public + private can be searched) + rpc SearchResources(SearchResourcesRequest) returns (SearchResourcesResponse){ + option (google.api.http) = { + post : "/v2/search" + body : "*" + }; + } + +} + +message SearchResourcesRequest { + string query = 1; + string filter = 2; + string start_after = 3; +} + + +message SearchResourcesResponse { + // Json list for each found resource + repeated string resource_info = 1; + // How many results are expected to be found ? + int64 estimated_total = 2; +} \ No newline at end of file From 55222e930c1f326fb40429413c45329506cc92a6 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 08:59:44 +0200 Subject: [PATCH 42/51] feat: Added generic resource to meili / search --- aruna/api/storage/services/v2/search_service.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aruna/api/storage/services/v2/search_service.proto b/aruna/api/storage/services/v2/search_service.proto index 5b1c1995..10350a3e 100644 --- a/aruna/api/storage/services/v2/search_service.proto +++ b/aruna/api/storage/services/v2/search_service.proto @@ -35,7 +35,7 @@ message SearchResourcesRequest { message SearchResourcesResponse { // Json list for each found resource - repeated string resource_info = 1; + repeated storage.models.v2.GenericResource resources = 1; // How many results are expected to be found ? int64 estimated_total = 2; } \ No newline at end of file From fc9f986b7fb38b43f0335cf3a85aa58e1917adf0 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 10:16:33 +0200 Subject: [PATCH 43/51] tests: Update tests --- tests/build.rs | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/tests/build.rs b/tests/build.rs index 2423281a..bdac6543 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -10,61 +10,49 @@ fn main() -> Result<(), Box> { fn compile_services() -> Result<(), Box> { let mut protos: Vec = Vec::new(); - let service_entries = fs::read_dir("aruna/api/storage/services/v1/")?; + let service_entries = fs::read_dir("aruna/api/dataproxy/services/v2/")?; for entry in service_entries { let dir = entry?; let rel_path = format!( "{}{}", - "aruna/api/storage/services/v1/", + "aruna/api/dataproxy/services/v2/", dir.file_name().to_str().unwrap().to_string() ); protos.push(rel_path); } - let service_entries = fs::read_dir("aruna/api/notification/services/v1/")?; + let service_entries = fs::read_dir("aruna/api/hooks/services/v2/")?; for entry in service_entries { let dir = entry?; let rel_path = format!( "{}{}", - "aruna/api/notification/services/v1/", + "aruna/api/hooks/services/v2/", dir.file_name().to_str().unwrap().to_string() ); protos.push(rel_path); } - let service_entries = fs::read_dir("aruna/api/bundler/services/v1/")?; + let service_entries = fs::read_dir("aruna/api/notification_service/services/v2/")?; for entry in service_entries { let dir = entry?; let rel_path = format!( "{}{}", - "aruna/api/bundler/services/v1/", + "aruna/api/notification_service/services/v2/", dir.file_name().to_str().unwrap().to_string() ); protos.push(rel_path); } - let service_entries = fs::read_dir("aruna/api/hooks/services/v1/")?; + let service_entries = fs::read_dir("aruna/api/storage/services/v2/")?; 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 { - let dir = entry?; - let rel_path = format!( - "{}{}", - "aruna/api/internal/v1/", + "aruna/api/storage/services/v2/", dir.file_name().to_str().unwrap().to_string() ); protos.push(rel_path); From dabf6e78380e01ea7a693b35dc7ecb94fe9c8d89 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 10:54:31 +0200 Subject: [PATCH 44/51] feat: Update endpoint_type --- .../api/dataproxy/services/v2/bundler_service.proto | 2 +- .../dataproxy/services/v2/dataproxy_service.proto | 2 +- aruna/api/storage/models/v2/models.proto | 5 ++--- aruna/api/storage/services/v2/search_service.proto | 4 +++- aruna/api/storage/services/v2/user_service.proto | 13 +++---------- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/aruna/api/dataproxy/services/v2/bundler_service.proto b/aruna/api/dataproxy/services/v2/bundler_service.proto index baf4d593..1adf28f2 100644 --- a/aruna/api/dataproxy/services/v2/bundler_service.proto +++ b/aruna/api/dataproxy/services/v2/bundler_service.proto @@ -6,9 +6,9 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.services.v2"; option java_outer_classname = "BundlerService"; -import "google/api/visibility.proto"; import "google/protobuf/timestamp.proto"; import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; service BundlerService { diff --git a/aruna/api/dataproxy/services/v2/dataproxy_service.proto b/aruna/api/dataproxy/services/v2/dataproxy_service.proto index 8508e960..4399aa36 100644 --- a/aruna/api/dataproxy/services/v2/dataproxy_service.proto +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -6,9 +6,9 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.services.v2"; option java_outer_classname = "DataProxyService"; -import "google/api/visibility.proto"; import "google/protobuf/timestamp.proto"; import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index 977cace9..d3200a63 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -18,9 +18,8 @@ enum DataClass { // Which kind of endpoint enum EndpointType { ENDPOINT_TYPE_UNSPECIFIED = 0; - ENDPOINT_TYPE_S3 = 1; - ENDPOINT_TYPE_FILE = 2; - ENDPOINT_TYPE_MEMCACHED = 3; + ENDPOINT_TYPE_PERSISTENT = 1; + ENDPOINT_TYPE_VOLATILE = 2; } // Which features does the endpoint have diff --git a/aruna/api/storage/services/v2/search_service.proto b/aruna/api/storage/services/v2/search_service.proto index 10350a3e..73b5bef0 100644 --- a/aruna/api/storage/services/v2/search_service.proto +++ b/aruna/api/storage/services/v2/search_service.proto @@ -29,7 +29,7 @@ service SearchService { message SearchResourcesRequest { string query = 1; string filter = 2; - string start_after = 3; + int64 offset = 3; } @@ -38,4 +38,6 @@ message SearchResourcesResponse { repeated storage.models.v2.GenericResource resources = 1; // How many results are expected to be found ? int64 estimated_total = 2; + // The last index returned + int64 last_index = 3; } \ No newline at end of file diff --git a/aruna/api/storage/services/v2/user_service.proto b/aruna/api/storage/services/v2/user_service.proto index 378cf2e7..70b7f2c9 100644 --- a/aruna/api/storage/services/v2/user_service.proto +++ b/aruna/api/storage/services/v2/user_service.proto @@ -194,7 +194,7 @@ message CreateAPITokenRequest { // Token name string name = 1; // Personal or resource specific - storage.models.v2.ResourcePermission permission = 2; + storage.models.v2.Permission permission = 2; // Token expiry google.protobuf.Timestamp expires_at = 3; } @@ -276,17 +276,10 @@ message GetNotActivatedUsersResponse { repeated storage.models.v2.User users = 1; } -message GetAllUsersRequest { - bool include_permissions = 1; -} - -message UserWithPerms { - storage.models.v2.User user = 1; - repeated storage.models.v2.ProjectPermission project_perms = 2; -} +message GetAllUsersRequest {} message GetAllUsersResponse { - repeated UserWithPerms user_with_perms = 1; + repeated storage.models.v2.User user = 1; } From 4dc18876070e5f51513aad4d59b32e6e50296604 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:01:45 +0200 Subject: [PATCH 45/51] feat: Added onboard endpoint request --- .../services/v2/endpoint_service.proto | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/aruna/api/storage/services/v2/endpoint_service.proto b/aruna/api/storage/services/v2/endpoint_service.proto index d74fc200..0b15342d 100644 --- a/aruna/api/storage/services/v2/endpoint_service.proto +++ b/aruna/api/storage/services/v2/endpoint_service.proto @@ -29,6 +29,19 @@ service EndpointService { }; } + + // OnboardEndpoint + // + // Status: BETA + // + // Registers a new Endpoint (Aruna DataProxy) to the server + // Needs admin permissions + rpc OnboardEndpoint(OnboardEndpointRequest) returns (OnboardEndpointResponse) { + option (google.api.http) = { + get : "/v2/endpoint/onboard" + }; + } + // GetEndpoint // // Status: BETA @@ -95,6 +108,12 @@ message CreateEndpointResponse { storage.models.v2.Endpoint endpoint = 1; } +message OnboardEndpointRequest {} + +message OnboardEndpointResponse { + string url = 1; +} + message GetEndpointRequest { // Either endpoint_name or id oneof endpoint { From 4763b0b8490666e5c1d1d3aceb6b1004c035f9cb Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:28:40 +0200 Subject: [PATCH 46/51] feat: Updated notification service --- .../services/v2/notification_service.proto | 112 ++++++++++++------ aruna/api/storage/models/v2/models.proto | 9 -- 2 files changed, 76 insertions(+), 45 deletions(-) diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index b2d2a672..6bc459f8 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -20,8 +20,8 @@ service EventNotificationService { // CreateEventStreamingGroup // // Creates a new EventStreamingGroup - rpc CreateEventStreamingGroup(CreateEventStreamingGroupRequest) - returns (CreateEventStreamingGroupResponse) {} + rpc CreateStreamConsumer(CreateStreamConsumerRequest) + returns (CreateStreamConsumerResponse) {} // GetEventMessageBatch // @@ -53,26 +53,29 @@ service EventNotificationService { returns (DeleteEventStreamingGroupResponse) {} } -message CreateEventStreamingGroupRequest { - aruna.api.storage.models.v2.ResourceType resource = 1; - string resource_id = 2; - bool include_subresource = 3; - oneof stream_type { - StreamAll stream_all = 4; - StreamFromDate stream_from_date = 5; - StreamFromSequence stream_from_sequence = 6; - }; - EventStreamingGroupHierarchy hierarchy = 7; +message StreamResource { + oneof resource { + string project_id = 1; + string collection_id = 2; + string dataset_id = 3; + string object_id = 4; + bool user = 5; + bool anouncements = 6; + bool all = 7; + } } -message EventStreamingGroupHierarchy { - string project_id = 1; - string collection_id = 2; - string object_id = 3; - string object_group_id = 4; +message CreateStreamConsumerRequest { + StreamResource resource = 1; + bool include_subresources = 2; + oneof stream_type { + StreamAll stream_all = 3; + StreamFromDate stream_from_date = 4; + StreamFromSequence stream_from_sequence = 5; + }; } -message CreateEventStreamingGroupResponse { string stream_group_id = 1; } +message CreateStreamConsumerResponse { string stream_group_id = 1; } message GetEventMessageBatchRequest { string stream_group_id = 1; @@ -80,7 +83,7 @@ message GetEventMessageBatchRequest { } message GetEventMessageBatchResponse { - repeated EventNotificationMessage messages = 1; + repeated EventMessage messages = 1; } message GetEventMessageBatchStreamRequest { @@ -89,7 +92,7 @@ message GetEventMessageBatchStreamRequest { } message GetEventMessageBatchStreamResponse { - repeated EventNotificationMessage messages = 1; + repeated EventMessage messages = 1; } message AcknowledgeMessageBatchRequest { @@ -135,16 +138,6 @@ message ResourceEventContext { string custom_context = 3; } } - -message ResourceEvent { - aruna.api.storage.models.v2.ResourceType resource = 1; - string resource_id = 2; - string resource_name = 3; - ResourceEventType event_type = 4; - optional ResourceEventContext context = 5; - Reply reply = 6; -} - enum UserEventType { USER_EVENT_TYPE_UNSPECIFIED = 0; USER_EVENT_TYPE_CREATED = 1; @@ -166,6 +159,23 @@ message UserEventContext { } } +message EventMessage { + oneof message_variant { + ResourceEvent resource_event = 1; + UserEvent user_event = 2; + AnouncementEvent announcement_event = 3; + } +} + +message ResourceEvent { + aruna.api.storage.models.v2.ResourceType resource = 1; + string resource_id = 2; + string resource_name = 3; + ResourceEventType event_type = 4; + optional ResourceEventContext context = 5; + Reply reply = 6; +} + message UserEvent { string user_id = 1; string user_name = 2; @@ -180,11 +190,41 @@ message Reply { string hmac = 3; } + + +message DataproxyInfo { + string endpoint_id = 1; + // Endpoint name + string name = 2; + // Endpoint type + storage.models.v2.EndpointType ep_type = 3; + // Is this endpoint public + bool is_public = 4; + // required public_key + string pubkey = 5; + // url + string url = 6; +} + +message ScheduledDowntime { + string location = 1; + string component = 2; + google.protobuf.Timestamp from = 3; + google.protobuf.Timestamp to = 4; +} + +message NewVersion { + string location = 1; + string component = 2; + string new_version = 3; +} + message AnouncementEvent { - // New dataproxy - // Removed dataproxy - // Updated dataproxy - // Scheduled downtime (location + component) - // New version (component) - // ... + oneof event_variant { + DataproxyInfo new_data_proxy = 1; + DataproxyInfo remove_data_proxy = 2; + DataproxyInfo update_data_proxy = 3; + ScheduledDowntime downtime = 4; + NewVersion version = 5; + } } \ No newline at end of file diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto index d3200a63..ce401b0d 100644 --- a/aruna/api/storage/models/v2/models.proto +++ b/aruna/api/storage/models/v2/models.proto @@ -71,15 +71,6 @@ enum RelationDirection { RELATION_DIRECTION_OUTBOUND = 2; } -// resourcetype -enum ResourceType { - RESOURCE_TYPE_UNSPECIFIED = 0; - RESOURCE_TYPE_PROJECT = 1; - RESOURCE_TYPE_COLLECTION = 2; - RESOURCE_TYPE_DATASET = 3; - RESOURCE_TYPE_OBJECT = 4; -} - // Used for the internal associated services to validate permissions // Actions are similar to HTTP verbs enum ResourceAction { From a9e5fedec69c2e9daac9d63c85c0cae9ce450d6a Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:36:10 +0200 Subject: [PATCH 47/51] fix: Update resource_events added reply to anouncement --- .../services/v2/notification_service.proto | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index 6bc459f8..44014445 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -53,20 +53,33 @@ service EventNotificationService { returns (DeleteEventStreamingGroupResponse) {} } -message StreamResource { - oneof resource { - string project_id = 1; - string collection_id = 2; - string dataset_id = 3; - string object_id = 4; - bool user = 5; - bool anouncements = 6; - bool all = 7; + +enum ResourceVariant { + RESOURCE_VARIANT_UNSPECIFIED = 0; + RESOURCE_VARIANT_PROJECT = 1; + RESOURCE_VARIANT_COLLECTION = 2; + RESOURCE_VARIANT_DATASET = 3; + RESOURCE_VARIANT_OBJECT = 4; +} + + +message Resource{ + string resource_id = 1; + string resource_name = 2; + ResourceVariant resource_variant = 3; +} + +message StreamTarget { + oneof target { + Resource resource = 1; + bool user = 2; + bool anouncements = 3; + bool all = 4; } } message CreateStreamConsumerRequest { - StreamResource resource = 1; + StreamTarget target = 1; bool include_subresources = 2; oneof stream_type { StreamAll stream_all = 3; @@ -168,12 +181,10 @@ message EventMessage { } message ResourceEvent { - aruna.api.storage.models.v2.ResourceType resource = 1; - string resource_id = 2; - string resource_name = 3; - ResourceEventType event_type = 4; - optional ResourceEventContext context = 5; - Reply reply = 6; + Resource resource = 1; + ResourceEventType event_type = 2; + optional ResourceEventContext context = 3; + Reply reply = 4; } message UserEvent { @@ -227,4 +238,5 @@ message AnouncementEvent { ScheduledDowntime downtime = 4; NewVersion version = 5; } + Reply reply = 6; } \ No newline at end of file From eab0b6cb7e08afce89a3e541ec403bd62ae09f39 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:42:15 +0200 Subject: [PATCH 48/51] fix: Fix linting --- aruna/api/dataproxy/services/v2/bundler_service.proto | 1 - aruna/api/dataproxy/services/v2/dataproxy_service.proto | 4 +--- aruna/api/notification/services/v2/notification_service.proto | 1 - aruna/api/storage/services/v2/collection_service.proto | 4 ++-- aruna/api/storage/services/v2/dataset_service.proto | 4 ++-- aruna/api/storage/services/v2/info_service.proto | 1 - aruna/api/storage/services/v2/project_service.proto | 4 ++-- aruna/api/storage/services/v2/search_service.proto | 2 -- 8 files changed, 7 insertions(+), 14 deletions(-) diff --git a/aruna/api/dataproxy/services/v2/bundler_service.proto b/aruna/api/dataproxy/services/v2/bundler_service.proto index 1adf28f2..275eff97 100644 --- a/aruna/api/dataproxy/services/v2/bundler_service.proto +++ b/aruna/api/dataproxy/services/v2/bundler_service.proto @@ -7,7 +7,6 @@ option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.serv option java_outer_classname = "BundlerService"; import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; diff --git a/aruna/api/dataproxy/services/v2/dataproxy_service.proto b/aruna/api/dataproxy/services/v2/dataproxy_service.proto index 4399aa36..9bef3064 100644 --- a/aruna/api/dataproxy/services/v2/dataproxy_service.proto +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -6,8 +6,6 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.dataproxy.services.v2"; option java_outer_classname = "DataProxyService"; -import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; @@ -152,7 +150,7 @@ message ReplicationStatusRequest { } enum ReplicationStatus { - REPLICATION_STATUS_UNDEFINED = 0; + REPLICATION_STATUS_UNSPECIFIED = 0; REPLICATION_STATUS_PENDING = 1; REPLICATION_STATUS_RUNNING = 2; REPLICATION_STATUS_FINISHED = 3; diff --git a/aruna/api/notification/services/v2/notification_service.proto b/aruna/api/notification/services/v2/notification_service.proto index 44014445..7dccd2c3 100644 --- a/aruna/api/notification/services/v2/notification_service.proto +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -6,7 +6,6 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.notification.services.v2"; option java_outer_classname = "UpdateNotificationServices"; -import "google/api/visibility.proto"; import "google/protobuf/timestamp.proto"; import "aruna/api/storage/models/v2/models.proto"; diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index abce02db..8f494167 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -90,7 +90,7 @@ service CollectionService { // Status: BETA // // Updates the collection key values. - rpc UpdatecollectionKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValueResponse) { + rpc UpdateCollectionKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValuesResponse) { option (google.api.http) = { patch : "/v2/collection/{collection_id}/key_values" body : "*" @@ -193,7 +193,7 @@ message UpdateCollectionKeyValuesRequest { repeated storage.models.v2.KeyValue remove_key_values = 3; } -message UpdateCollectionKeyValueResponse { +message UpdateCollectionKeyValuesResponse { storage.models.v2.Collection collection = 1; } diff --git a/aruna/api/storage/services/v2/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto index 635313f9..b4b4d4c5 100644 --- a/aruna/api/storage/services/v2/dataset_service.proto +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -90,7 +90,7 @@ service DatasetService { // Status: BETA // // Updates the dataset key values. - rpc UpdateDatasetKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValueResponse) { + rpc UpdateDatasetKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValuesResponse) { option (google.api.http) = { patch : "/v2/dataset/{dataset_id}/key_values" body : "*" @@ -194,7 +194,7 @@ message UpdateDatasetKeyValuesRequest { repeated storage.models.v2.KeyValue remove_key_values = 3; } -message UpdateDatasetKeyValueResponse { +message UpdateDatasetKeyValuesResponse { storage.models.v2.Dataset dataset = 1; } diff --git a/aruna/api/storage/services/v2/info_service.proto b/aruna/api/storage/services/v2/info_service.proto index e23c3ccf..dd1ec00d 100644 --- a/aruna/api/storage/services/v2/info_service.proto +++ b/aruna/api/storage/services/v2/info_service.proto @@ -6,7 +6,6 @@ option java_multiple_files = true; option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.services.v2"; option java_outer_classname = "StorageStatusService"; import "aruna/api/storage/models/v2/models.proto"; -import "google/api/visibility.proto"; import "google/api/annotations.proto"; diff --git a/aruna/api/storage/services/v2/project_service.proto b/aruna/api/storage/services/v2/project_service.proto index bcecde0a..9e893f2c 100644 --- a/aruna/api/storage/services/v2/project_service.proto +++ b/aruna/api/storage/services/v2/project_service.proto @@ -118,7 +118,7 @@ service ProjectService { // Status: BETA // // Updates the project key values. - rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValueResponse) { + rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValuesResponse) { option (google.api.http) = { patch : "/v2/project/{project_id}/key_values" body : "*" @@ -221,7 +221,7 @@ message UpdateProjectKeyValuesRequest { repeated storage.models.v2.KeyValue remove_key_values = 3; } -message UpdateProjectKeyValueResponse { +message UpdateProjectKeyValuesResponse { storage.models.v2.Project project = 1; } diff --git a/aruna/api/storage/services/v2/search_service.proto b/aruna/api/storage/services/v2/search_service.proto index 73b5bef0..9e7b597e 100644 --- a/aruna/api/storage/services/v2/search_service.proto +++ b/aruna/api/storage/services/v2/search_service.proto @@ -7,8 +7,6 @@ option java_package = "com.github.ArunaStorage.java_api.aruna.api.storage.servic option java_outer_classname = "SearchService"; import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; -import "google/protobuf/timestamp.proto"; - service SearchService { From efe2025f532f4c3b69df8811fa1f8b4b709e8146 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:46:10 +0200 Subject: [PATCH 49/51] fix: Fix test build.rs --- tests/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/build.rs b/tests/build.rs index bdac6543..eb5e0eb8 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -40,7 +40,7 @@ fn compile_services() -> Result<(), Box> { let dir = entry?; let rel_path = format!( "{}{}", - "aruna/api/notification_service/services/v2/", + "aruna/api/notification/services/v2/", dir.file_name().to_str().unwrap().to_string() ); protos.push(rel_path); From 23ce6deed064556ae5bb3232b0392bb6f8b7a2d6 Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:52:46 +0200 Subject: [PATCH 50/51] feat: Update all to v2 --- aruna/api/storage/services/v2/collection_service.proto | 2 +- aruna/api/storage/services/v2/dataset_service.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aruna/api/storage/services/v2/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto index 8f494167..55764683 100644 --- a/aruna/api/storage/services/v2/collection_service.proto +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -57,7 +57,7 @@ service CollectionService { rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse) { option (google.api.http) = { - delete : "/v1/collection/{collection_id}" + delete : "/v2/collection/{collection_id}" }; } diff --git a/aruna/api/storage/services/v2/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto index b4b4d4c5..e7c192cc 100644 --- a/aruna/api/storage/services/v2/dataset_service.proto +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -57,7 +57,7 @@ service DatasetService { rpc DeleteDataset(DeleteDatasetRequest) returns (DeleteDatasetResponse) { option (google.api.http) = { - delete : "/v1/dataset/{dataset_id}" + delete : "/v2/dataset/{dataset_id}" }; } From e8274235ab8ff24fa4fa92b89c32a21223dcd37c Mon Sep 17 00:00:00 2001 From: St4NNi Date: Thu, 13 Jul 2023 11:57:25 +0200 Subject: [PATCH 51/51] feat: Fix tests --- tests/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/build.rs b/tests/build.rs index eb5e0eb8..d362d046 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -34,7 +34,7 @@ fn compile_services() -> Result<(), Box> { protos.push(rel_path); } - let service_entries = fs::read_dir("aruna/api/notification_service/services/v2/")?; + let service_entries = fs::read_dir("aruna/api/notification/services/v2/")?; for entry in service_entries { let dir = entry?;