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 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..275eff97 --- /dev/null +++ b/aruna/api/dataproxy/services/v2/bundler_service.proto @@ -0,0 +1,43 @@ +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/protobuf/timestamp.proto"; +import "google/api/annotations.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 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..9bef3064 --- /dev/null +++ b/aruna/api/dataproxy/services/v2/dataproxy_service.proto @@ -0,0 +1,163 @@ +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/annotations.proto"; + + + +service DataproxyService { + + // RequestReplication + // + // Status: BETA + // + // Creates a replication request + rpc RequestReplication(RequestReplicationRequest) returns (RequestReplicationResponse) {} + + // InitReplication + // + // Status: BETA + // + // 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" + }; + } +} + +message DataProxyInfo { + string dataproxy_id = 1; + int64 available_space = 2; +} + +message RequestReplicationRequest { + DataProxyInfo info = 1; + 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 { + DataInfos data_infos = 1; + bool ack = 2; + } +} + +message InitReplicationRequest { + DataInfos data_infos = 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_UNSPECIFIED = 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/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 diff --git a/aruna/api/hooks/services/v1/hooks_service.proto b/aruna/api/hooks/services/v2/hooks_service.proto similarity index 69% rename from aruna/api/hooks/services/v1/hooks_service.proto rename to aruna/api/hooks/services/v2/hooks_service.proto index 16a4ca06..7c4c42d3 100644 --- a/aruna/api/hooks/services/v1/hooks_service.proto +++ b/aruna/api/hooks/services/v2/hooks_service.proto @@ -1,12 +1,13 @@ 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 "google/api/annotations.proto"; -import "aruna/api/storage/models/v1/models.proto"; +import "aruna/api/storage/models/v2/models.proto"; // HooksService // @@ -14,15 +15,33 @@ import "aruna/api/storage/models/v1/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 { TRIGGER_TYPE_UNSPECIFIED = 0; TRIGGER_TYPE_HOOK_ADDED = 1; + TRIGGER_TYPE_OBJECT_CREATED = 2; } message Trigger { @@ -41,8 +60,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 +78,7 @@ message Hook { } } -// Will be updated with additional credential types +// Will be expanded with additional credential types message Credentials { string token = 1; } @@ -83,8 +101,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 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; 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; -} - - 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 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 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; -} - diff --git a/aruna/api/notification/services/v1/notification_service.proto b/aruna/api/notification/services/v1/notification_service.proto deleted file mode 100644 index 77002459..00000000 --- a/aruna/api/notification/services/v1/notification_service.proto +++ /dev/null @@ -1,136 +0,0 @@ -syntax = "proto3"; - -package aruna.api.notification.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 = "UpdateNotificationServices"; - -import "google/api/visibility.proto"; -import "google/protobuf/timestamp.proto"; -import "aruna/api/storage/models/v1/models.proto"; - - - -// EventNotificationService -// -// A service to receive events in the AOS storage -service EventNotificationService { - - option (google.api.api_visibility).restriction = "UNFINISHED"; - // CreateEventStreamingGroup - // - // Creates a new EventStreamingGroup - rpc CreateEventStreamingGroup(CreateEventStreamingGroupRequest) - returns (CreateEventStreamingGroupResponse) {} - - // GetEventMessageBatch - // - // Reads a set of messages from a given stream group - // Each message contains a separate acknowledgement message that is protected by a salt and an hmac for verification - // The message can be send directly through the AcknowledgeMessageBatch call to acknowledge the message - rpc GetEventMessageBatch(GetEventMessageBatchRequest) - returns (GetEventMessageBatchResponse) {} - - // GetEventMessageBatch - // - // Reads a set of messages from a given stream group - // Each message contains a separate acknowledgement message that is protected by a salt and an hmac for verification - // The message can be send directly through the AcknowledgeMessageBatch call to acknowledge the message - rpc GetEventMessageBatchStream(GetEventMessageBatchStreamRequest) - returns (stream GetEventMessageBatchStreamResponse) {} - - // AcknowledgeMessageBatch - // - // List of messages to acknowledge - // Each reply is protected by a salt and and hmac that verifies the message - rpc AcknowledgeMessageBatch(AcknowledgeMessageBatchRequest) - returns (AcknowledgeMessageBatchResponse) {} - - // DeleteEventStreamingGroup - // - // Deletes a existing EventStreamingGroup by ID - rpc DeleteEventStreamingGroup(DeleteEventStreamingGroupRequest) - returns (DeleteEventStreamingGroupResponse) {} -} - -message CreateEventStreamingGroupRequest { - aruna.api.storage.models.v1.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 EventStreamingGroupHierarchy { - string project_id = 1; - string collection_id = 2; - string object_id = 3; - string object_group_id = 4; -} - -message CreateEventStreamingGroupResponse { string stream_group_id = 1; } - -message GetEventMessageBatchRequest { - string stream_group_id = 1; - uint32 batch_size = 2; -} - -message GetEventMessageBatchResponse { - repeated EventNotificationMessage messages = 1; -} - -message GetEventMessageBatchStreamRequest { - string stream_group_id = 1; - uint32 batch_size = 2; -} - -message GetEventMessageBatchStreamResponse { - repeated EventNotificationMessage messages = 1; -} - -message AcknowledgeMessageBatchRequest { - repeated Reply replies = 1; -} - -message AcknowledgeMessageBatchResponse {} - - -message DeleteEventStreamingGroupRequest { - string stream_group_id = 1; -} - -message DeleteEventStreamingGroupResponse {} - -message StreamFromSequence { uint64 sequence = 1; } - -message StreamFromDate { google.protobuf.Timestamp timestamp = 1; } - -message StreamAll {} - -message EventNotificationMessage { - aruna.api.storage.models.v1.ResourceType resource = 1; - string resource_id = 2; - EventType updated_type = 3; - Reply reply = 4; -} - -message Reply { - string reply = 1; - string salt = 2; - 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; -} \ 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 new file mode 100644 index 00000000..7dccd2c3 --- /dev/null +++ b/aruna/api/notification/services/v2/notification_service.proto @@ -0,0 +1,241 @@ +syntax = "proto3"; + +package aruna.api.notification.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.notification.services.v2"; +option java_outer_classname = "UpdateNotificationServices"; + +import "google/protobuf/timestamp.proto"; +import "aruna/api/storage/models/v2/models.proto"; + + + +// EventNotificationService +// +// A service to receive events in the AOS storage +service EventNotificationService { + + // CreateEventStreamingGroup + // + // Creates a new EventStreamingGroup + rpc CreateStreamConsumer(CreateStreamConsumerRequest) + returns (CreateStreamConsumerResponse) {} + + // GetEventMessageBatch + // + // Reads a set of messages from a given stream group + // Each message contains a separate acknowledgement message that is protected by a salt and an hmac for verification + // The message can be send directly through the AcknowledgeMessageBatch call to acknowledge the message + rpc GetEventMessageBatch(GetEventMessageBatchRequest) + returns (GetEventMessageBatchResponse) {} + + // GetEventMessageBatch + // + // Reads a set of messages from a given stream group + // Each message contains a separate acknowledgement message that is protected by a salt and an hmac for verification + // The message can be send directly through the AcknowledgeMessageBatch call to acknowledge the message + rpc GetEventMessageBatchStream(GetEventMessageBatchStreamRequest) + returns (stream GetEventMessageBatchStreamResponse) {} + + // AcknowledgeMessageBatch + // + // List of messages to acknowledge + // Each reply is protected by a salt and and hmac that verifies the message + rpc AcknowledgeMessageBatch(AcknowledgeMessageBatchRequest) + returns (AcknowledgeMessageBatchResponse) {} + + // DeleteEventStreamingGroup + // + // Deletes a existing EventStreamingGroup by ID + rpc DeleteEventStreamingGroup(DeleteEventStreamingGroupRequest) + returns (DeleteEventStreamingGroupResponse) {} +} + + +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 { + StreamTarget target = 1; + bool include_subresources = 2; + oneof stream_type { + StreamAll stream_all = 3; + StreamFromDate stream_from_date = 4; + StreamFromSequence stream_from_sequence = 5; + }; +} + +message CreateStreamConsumerResponse { string stream_group_id = 1; } + +message GetEventMessageBatchRequest { + string stream_group_id = 1; + uint32 batch_size = 2; +} + +message GetEventMessageBatchResponse { + repeated EventMessage messages = 1; +} + +message GetEventMessageBatchStreamRequest { + string stream_group_id = 1; + uint32 batch_size = 2; +} + +message GetEventMessageBatchStreamResponse { + repeated EventMessage messages = 1; +} + +message AcknowledgeMessageBatchRequest { + repeated Reply replies = 1; +} + +message AcknowledgeMessageBatchResponse {} + + +message DeleteEventStreamingGroupRequest { + string stream_group_id = 1; +} + +message DeleteEventStreamingGroupResponse {} + +message StreamFromSequence { uint64 sequence = 1; } + +message StreamFromDate { google.protobuf.Timestamp timestamp = 1; } + +message StreamAll {} + +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; + } +} +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 EventMessage { + oneof message_variant { + ResourceEvent resource_event = 1; + UserEvent user_event = 2; + AnouncementEvent announcement_event = 3; + } +} + +message ResourceEvent { + Resource resource = 1; + ResourceEventType event_type = 2; + optional ResourceEventContext context = 3; + Reply reply = 4; +} + +message UserEvent { + string user_id = 1; + string user_name = 2; + UserEventType event_type = 3; + optional UserEventContext context = 4; + Reply reply = 5; +} + +message Reply { + string reply = 1; + string salt = 2; + 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 { + oneof event_variant { + DataproxyInfo new_data_proxy = 1; + DataproxyInfo remove_data_proxy = 2; + DataproxyInfo update_data_proxy = 3; + ScheduledDowntime downtime = 4; + NewVersion version = 5; + } + Reply reply = 6; +} \ No newline at end of file diff --git a/aruna/api/storage/models/v1/auth.proto b/aruna/api/storage/models/v1/auth.proto deleted file mode 100644 index 76cff229..00000000 --- a/aruna/api/storage/models/v1/auth.proto +++ /dev/null @@ -1,99 +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_MODIFY = 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; - 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; -} - -message ProjectPermission { - string user_id = 1; - string project_id = 2; - Permission permission = 3; - bool service_account = 4; -} - -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 deleted file mode 100644 index 06a6545b..00000000 --- a/aruna/api/storage/models/v1/models.proto +++ /dev/null @@ -1,350 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/timestamp.proto"; -option go_package = "github.com/ArunaStorage/go-api/aruna/api/storage/models/v1"; - -package aruna.api.storage.models.v1; - -// A key value pair for hooks and labels -message KeyValue { - string key = 1; - 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; -} - -// 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_TRASH = 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 object_group_count = 2; - 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 { - int32 major = 1; - int32 minor = 2; - int32 patch = 3; -} - -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; -} - -message Hash { - Hashalgorithm alg = 1; - 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 { - // 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; - 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; - bool ssl = 3; - bool public = 4; - EndpointHostType host_type = 5; -} - -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; -} - -// 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 { - 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 -} - -// 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 -// 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 description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels - 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; - } - CollectionStats stats = 14; - bool is_public = 15; -} - -// Multiple Collections -message Collections { repeated Collection collections = 1; } - -// This is a representation of the Collection without the recursive nature of -// objectreferences -message CollectionOverview { - string id = 1; - string name = 2; - string description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels - google.protobuf.Timestamp created = 7; - oneof version { - Version semantic_version = 12; - bool latest = 13; - } - CollectionStats stats = 14; - bool is_public = 15; -} - -// Multiple CollectionOverviews -message CollectionOverviews { - repeated CollectionOverview collection_overviews = 1; -} - -// This is a representation of the Collection with only Resource RevisionIDs -// instead of full objects -message CollectionWithID { - string id = 1; - string name = 2; - string description = 3; - repeated KeyValue labels = 4; - repeated KeyValue hooks = 5; - LabelOntology label_ontology = 6; // Ontology for labels - google.protobuf.Timestamp created = 7; - repeated string objects = 8; - repeated string specifications = 9; - repeated string object_groups = 10; - oneof version { - Version semantic_version = 12; - bool latest = 13; - } - CollectionStats stats = 14; - bool is_public = 15; -} - -// Multiple CollectionWithIDs -message CollectionWithIDs { repeated CollectionWithID collection_with_ids = 1; } \ No newline at end of file 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; -} diff --git a/aruna/api/storage/models/v2/models.proto b/aruna/api/storage/models/v2/models.proto new file mode 100644 index 00000000..ce401b0d --- /dev/null +++ b/aruna/api/storage/models/v2/models.proto @@ -0,0 +1,308 @@ +syntax = "proto3"; +import "google/protobuf/timestamp.proto"; +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_WORKSPACE = 4; + DATA_CLASS_CONFIDENTIAL = 5; +} + +// Which kind of endpoint +enum EndpointType { + ENDPOINT_TYPE_UNSPECIFIED = 0; + ENDPOINT_TYPE_PERSISTENT = 1; + ENDPOINT_TYPE_VOLATILE = 2; +} + +// Which features does the endpoint have +enum EndpointHostType { + ENDPOINT_HOST_TYPE_UNSPECIFIED = 0; + ENDPOINT_HOST_TYPE_PROXY = 1; + ENDPOINT_HOST_TYPE_BUNDLER = 2; +} + +// Permission Levels +enum PermissionLevel { + PERMISSION_LEVEL_UNSPECIFIED = 0; + PERMISSION_LEVEL_NONE = 2; + PERMISSION_LEVEL_READ = 3; + PERMISSION_LEVEL_APPEND = 4; + PERMISSION_LEVEL_WRITE = 5; + PERMISSION_LEVEL_ADMIN = 6; +} + +// KeyValueVariants +enum KeyValueVariant { + KEY_VALUE_VARIANT_UNSPECIFIED = 0; + KEY_VALUE_VARIANT_LABEL = 1; + 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; + INTERNAL_RELATION_VARIANT_ORIGIN = 2; + INTERNAL_RELATION_VARIANT_DERIVED = 3; + INTERNAL_RELATION_VARIANT_METADATA = 4; + INTERNAL_RELATION_VARIANT_POLICY = 5; +} + +// internal object relation type (direction) +enum RelationDirection { + RELATION_DIRECTION_UNSPECIFIED = 0; + RELATION_DIRECTION_INBOUND = 1; + RELATION_DIRECTION_OUTBOUND = 2; +} + +// 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; // 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 +} + +// 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 { + HASHALGORITHM_UNSPECIFIED = 0; + HASHALGORITHM_MD5 = 1; + HASHALGORITHM_SHA256 = 2; +} + +// ------------- USERS & PERMISSIONS ----------------------- + +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 Permission { + oneof resource_id { + string project_id = 1; + string collection_id = 2; + string dataset_id = 3; + string object_id = 4; + } + PermissionLevel permission_level = 6; +} + +message Token { + string id = 1; + string name = 2; + string user_id = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp expires_at = 5; + // Tokens can either be personal or resource "specific" + optional Permission permission = 6; + google.protobuf.Timestamp used_at = 7; +} + + +message CustomAttributes { + string attribute_name = 1; + string attribute_value = 2; +} + +message UserAttributes { + bool global_admin = 1; + bool service_account = 2; + repeated CustomAttributes custom_attributes = 3; + repeated Permission personal_permissions = 4; +} + +// --------------- RELATION / KEYVALUES ------------------- + +// A key value pair for hooks and labels +message KeyValue { + string key = 1; + string value = 2; + KeyValueVariant variant = 3; +} + +message Relation { + oneof relation { + ExternalRelation external = 1; + InternalRelation internal = 2; + } +} + +message ExternalRelation { + string identifier = 1; + oneof variant { + ExternalRelationVariant defined_variant = 2; + string custom_variant = 3; + } +} + +message InternalRelation { + string resource_id = 1; + oneof variant { + InternalRelationVariant defined_variant = 2; + string custom_variant = 3; + } + RelationDirection direction = 4; +} + +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 +} + +// Stats for a set of objects +message Stats { + int64 count = 1; + int64 size = 2; + google.protobuf.Timestamp last_updated = 3; +} + +message Hash { + Hashalgorithm alg = 1; + string hash = 2; +} + +message EndpointHostConfig { + string url = 1; + bool is_primary = 2; + bool ssl = 3; + bool public = 4; + EndpointHostType host_type = 5; +} + +message Endpoint { + string id = 1; + EndpointType ep_type = 2; + string name = 3; + 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 + 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; + Status status = 10; + bool dynamic = 11; +} + + +message Collection { + 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 + repeated Relation relations = 5; + Stats stats = 6; + DataClass data_class = 7; + google.protobuf.Timestamp created_at = 8; + string created_by = 9; + Status status = 10; + bool dynamic = 11; +} + +message Dataset { + string id = 1; + string name = 2; + string description = 3; + // 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; + Status status = 10; + bool dynamic = 11; +} + +message Object { + string id = 1; + string name = 2; + string description = 3; + // 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; + Status status = 10; + bool dynamic = 11; + // Object specific attributes + repeated Hash hashes = 12; +} \ No newline at end of file diff --git a/aruna/api/storage/services/v1/collection_service.proto b/aruna/api/storage/services/v1/collection_service.proto deleted file mode 100644 index 797c39bf..00000000 --- a/aruna/api/storage/services/v1/collection_service.proto +++ /dev/null @@ -1,331 +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 = "CollectionService"; - -import "aruna/api/storage/models/v1/models.proto"; -import "aruna/api/storage/models/v1/query.proto"; - -import "google/api/annotations.proto"; - -// CollectionService -// -// Contains all methods that get/create or update Collection and associated resources -service CollectionService { - - // CreateNewCollection - // - // Status: STABLE - // - // creates a new Collection - rpc CreateNewCollection(CreateNewCollectionRequest) - returns (CreateNewCollectionResponse) { - option (google.api.http) = { - post : "/v1/collection" - body : "*" - }; - } - - // GetCollectionByID - // - // Status: STABLE - // - // 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) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}" - }; - } - - // GetCollections - // - // Status: STABLE - // - // 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 - rpc GetCollections(GetCollectionsRequest) returns (GetCollectionsResponse) { - option (google.api.http) = { - get : "/v1/collections/{project_id}" - }; - } - - // UpdateCollection - // - // Status: STABLE - // - // 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) = { - delete : "/v1/collection/{collection_id}" - body : "*" - }; - } - - // AddKeyValueToCollection - // - // Status: BETA - // - // Adds key values (labels / hooks) to a collection - rpc AddKeyValuesToCollection(AddKeyValuesToCollectionRequest) - returns (AddKeyValuesToCollectionResponse) { - option (google.api.http) = { - patch : "/v1/collection/{collection_id}/add_key_value" - body : "*" - }; - } -} - - -// WorkspaceService -// -// Service to manage "special" anonymous collections / workspaces -service WorkspaceService { - // CreateWorkspace - // - // Status: ALPHA - // - // A new request to create a personal anonymous workspace - rpc CreateWorkspace(CreateWorkspaceRequest) - returns (CreateWorkspaceResponse) { - option (google.api.http) = { - post : "/v1/workspace" - body : "*" - }; - } - - - // DeleteWorkspace - // - // Status: ALPHA - // - // Delete a workspace - rpc DeleteWorkspace(DeleteWorkspaceRequest) - returns (DeleteWorkspaceResponse) { - option (google.api.http) = { - delete : "/v1/workspace/{workspace_id}" - body : "*" - }; - } - - // DeleteWorkspace - // - // Status: ALPHA - // - // Claims an anonymous workspace, and transfers the owner to a regular user account. - rpc ClaimWorkspace(ClaimWorkspaceRequest) - returns (ClaimWorkspaceResponse) { - option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/claim" - body : "*" - }; - } - - // MoveWorkspaceData - // - // Status: ALPHA - // - // Claims an anonymous workspace - rpc MoveWorkspaceData(MoveWorkspaceDataRequest) - returns (MoveWorkspaceDataResponse) { - option (google.api.http) = { - post : "/v1/workspace/{workspace_id}/move/{collection_id}" - body : "*" - }; - } -} - -// Models: - -message CreateWorkspaceRequest { - string project_name = 1; -} - -message CreateWorkspaceResponse{ - string workspace_id = 1; - string token = 2; - string access_key = 3; - string secret_key = 4; -} - -message DeleteWorkspaceRequest { - string workspace_id = 1; -} - -message DeleteWorkspaceResponse {} - -message ClaimWorkspaceRequest { - // This can only be called by an registered user, - // that is in possesion of the workspace_id and workspace token - // It will remove the service account and claim all references "as" the user. - string workspace_id = 1; - string token = 2; -} - -message ClaimWorkspaceResponse {} - -message MoveWorkspaceDataRequest { - string workspace_id = 1; - string collection_id = 2; -} - -message MoveWorkspaceDataResponse {} - -message CreateNewCollectionRequest { - // Collection name - string name = 1; - // 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 LabelOntology with required labels - storage.models.v1.LabelOntology label_ontology = 6; - // Optional Dataclass - storage.models.v1.DataClass dataclass = 7; -} - -message CreateNewCollectionResponse { - // The new collection_id - string collection_id = 1; -} - -message GetCollectionByIDRequest { - // Requested id - string collection_id = 1; -} - -message GetCollectionByIDResponse { - // Overview of the requested collection - storage.models.v1.CollectionOverview collection = 1; -} - -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; -} - -message GetCollectionsResponse { - // List of collection overviews - storage.models.v1.CollectionOverviews collections = 1; -} - -// 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) LabelOntology - storage.models.v1.LabelOntology label_ontology = 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 - string collection_id = 1; - // New version - storage.models.v1.Version version = 2; -} - -message PinCollectionVersionResponse { - // New collection overview - storage.models.v1.CollectionOverview collection = 1; -} - -message DeleteCollectionRequest { - // Collection id - string collection_id = 1; - // Force delete - bool force = 3; -} - -message DeleteCollectionResponse {} - - -message AddKeyValuesToCollectionRequest { - 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; -} \ No newline at end of file diff --git a/aruna/api/storage/services/v1/info_service.proto b/aruna/api/storage/services/v1/info_service.proto deleted file mode 100644 index 0da94d6c..00000000 --- a/aruna/api/storage/services/v1/info_service.proto +++ /dev/null @@ -1,153 +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 = "InfoService"; - -import "aruna/api/storage/models/v1/models.proto"; - -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 -// -// 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 { - - // GetStorageVersion - // - // Status: ALPHA - // - // 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" - }; - } - - // GetStorageStatus - // - // Status: ALPHA - // - // 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" - }; - } -} - - - -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 {} - - -message SemanticVersion { - // Complete version string - string version_string = 1; - // Semver according to https://semver.org/ - int32 major = 2; - int32 minor = 3; - int32 patch = 4; - string labels = 5; -} - - -message LocationVersion { - // Status of a specific Location e.g Gießen / 0.5.0-beta.1 - string location = 1; - SemanticVersion 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; -} - - -message GetStorageVersionResponse { - repeated ComponentVersion component_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; -} - -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; -} - -message GetStorageStatusResponse { - // List of all components and their status - repeated ComponentStatus component_status = 1; -} \ No newline at end of file diff --git a/aruna/api/storage/services/v1/object_service.proto b/aruna/api/storage/services/v1/object_service.proto deleted file mode 100644 index 430ad4b9..00000000 --- a/aruna/api/storage/services/v1/object_service.proto +++ /dev/null @@ -1,838 +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 = "ObjectService"; - -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 resources -service ObjectService { - - // InitializeNewObject - // - // Status: STABLE - // - // 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) { - option (google.api.http) = { - post : "/v1/collection/{collection_id}/object" - body : "*" - }; - } - - // GetUploadURL - // - // Status: STABLE - // - // 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" - }; - } - - // GetDownloadUrl - // - // Status: STABLE - // - // This method 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 : "*" - }; - } - - // FinishObjectStaging - // - // Status: STABLE - // - // 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" - body : "*" - }; - } - - // UpdateObject - // - // Status: STABLE - // - // Objects are immutable! - // Updating an object will create a new revision for the object - // This method will put the new revision in a staging area. - // Staged objects will get a separate staging id and need to be finished - // 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}" - body : "*" - }; - } - - // CloneObject - // - // Status: STABLE - // - // 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" - body : "*" - }; - } - - // DeleteObject - // - // Status: STABLE - // - // 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" - body : "*" - }; - } - - // GetObjectByID - // - // Status: STABLE - // - // 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) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/object/{object_id}" - }; - } - - // GetObjects - // - // Status: STABLE - // - // 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 - rpc GetObjects(GetObjectsRequest) returns (GetObjectsResponse) { - option (google.api.http) = { - get : "/v1/collection/{collection_id}/objects" - }; - } - - // GetObjectRevisions - // - // Status: STABLE - // - // 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 : "/v1/collection/{collection_id}/object/{object_id}/revisions" - }; - } - // GetLatestObjectRevision - // - // Status: STABLE - // - // 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 : "/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" - }; - } - - // 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 - // - // Status: BETA - // - // Create collection_specific object_paths for an object - // !! Paths are collection specific !! - rpc CreateObjectPath(CreateObjectPathRequest) returns (CreateObjectPathResponse) { - 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 - // - // 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" - }; - } - - -} - -// Models -// These are the models for the above described requests and responses. -// 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 { - - reserved 2, 3; - - // Filename - string filename = 1; - - // Removed fields: - // string description = 2; - // string collection_id = 3; - - // Content length - int64 content_len = 4; - // Source of the object (e.g. wikipedia) - storage.models.v1.Source source = 5; - // Dataclass public / private - storage.models.v1.DataClass dataclass = 6; - // List of label key-values - repeated storage.models.v1.KeyValue labels = 7; - // List of hook key-values - repeated storage.models.v1.KeyValue hooks = 8; - // (collection specific) sub_path for file - // does not include file-, collection- or projectname - // final fully-qualified schema: //// - string sub_path = 9; -} - -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 = 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; - // (optional) Hash - storage.models.v1.Hash hash = 7; -} - -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; - // Is this a multipart upload? - bool multipart = 4; - // (optional) if multi was initialized - int32 part_number = 5; -} - -message GetUploadURLResponse { - // URL - URL url = 1; -} - -message CompletedParts { - // Multipart identifier - string etag = 1; - // Part number - int64 part = 2; -} - -message GetDownloadURLRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; -} - -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; -} - -message CreateDownloadLinksStreamRequest { - // CollectionID - string collection_id = 1; - // ObjectIds - repeated string objects = 2; -} - -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; - // 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; - - // 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; - - // Should the object be auto-updated in the collection? - // default: false - bool auto_update = 7; -} - -message FinishObjectStagingResponse { - // (new) Object overview - storage.models.v1.Object object = 1; -} - -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; - // (optional) Hash - storage.models.v1.Hash hash = 9; -} - -message UpdateObjectResponse { - // 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; -} - -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; -} - -message CreateObjectReferenceResponse {} - -message CloneObjectRequest { - // ObjectId - string object_id = 1; - // From CollectionID - string collection_id = 2; - // Target CollectionID - string target_collection_id = 3; -} - -message CloneObjectResponse { - // This describes the new object. - storage.models.v1.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; -} - -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.Object object = 1; - // This is a associated download URL - // Will be empty if request does not contain the associated with_url flag - string url = 2; - // collection specific paths of object - repeated string paths = 3; -} - -message GetObjectByIDRequest { - // Collection Id - string collection_id = 1; - // Object Id - string object_id = 2; - // With URL: Include URL in response ? - bool with_url = 4; -} - -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; -} - -message GetObjectsResponse { - // A List of objects with (optional) associated URLs - repeated ObjectWithURL objects = 1; -} - -message GetObjectRevisionsRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; - // Pagination info - storage.models.v1.PageRequest page_request = 3; - // Should the response include download urls ? - bool with_url = 4; -} - -message GetObjectRevisionsResponse { - // List of objects with (optional) URLs - repeated ObjectWithURL objects = 1; -} - -message GetLatestObjectRevisionRequest { - // Collection id - string collection_id = 1; - // Object id - string object_id = 2; - // Should the response include download urls ? - bool with_url = 3; -} - -message GetLatestObjectRevisionResponse { - // The object with the latest revision - ObjectWithURL object = 1; -} - -message GetObjectEndpointsRequest { - // Collection id - 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; -} - -message GetReferencesResponse { - // List of object references - 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 SetObjectPathVisibilityRequest { - string collection_id = 1; - string path = 2; - bool visibility = 3; -} - -message SetObjectPathVisibilityResponse { - Path path = 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.Object object = 3; -} - - -message GetObjectsAsListV2Request { - // Required - string bucket = 1; - optional string continuation_token = 2; - optional string delimiter = 3; - optional uint32 max_keys = 4; - optional string prefix = 5; - optional string start_after = 6; -} - -message CommonPrefix { - string prefix = 1; -} - -message GetObjectsAsListV2Response { - string name = 1; - bool is_truncated = 2; - uint32 max_keys = 4; - uint32 key_count = 5; - // Does not contain URLs, only paths - repeated ObjectWithURL contents = 6; - repeated CommonPrefix prefixes = 7; - optional string next_continuation_token = 8; -} - - - 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 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 6fcaf734..00000000 --- a/aruna/api/storage/services/v1/project_service.proto +++ /dev/null @@ -1,276 +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/auth.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" - }; - } - - // DestroyProject - // - // Status: STABLE - // - // Destroys the project and all its associated data. Must be empty - // (cannot contain any collections). - rpc DestroyProject(DestroyProjectRequest) returns (DestroyProjectResponse) { - option (google.api.http) = { - delete : "/v1/project/{project_id}" - }; - } - - // UpdateProject - // - // Status: STABLE - // - // Updates the project. All (meta) data will be overwritten. - rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) { - option (google.api.http) = { - put : "/v1/project/{project_id}" - }; - } - - // 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; - // Description for the project - string description = 2; - // Project binary flag(s) - int64 flag = 3; -} - -message CreateProjectResponse { - // The freshly created project_id - string project_id = 1; -} - -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; -} - -message AddUserToProjectResponse {} - -message GetProjectRequest { - // The id of the project to get - string project_id = 1; -} - -message GetProjectResponse { - // Overview of the projectroject - storage.models.v1.ProjectOverview project = 1; -} - -message GetProjectsRequest {} - -message GetProjectsResponse { - // Overview of the projects - repeated storage.models.v1.ProjectOverview projects = 1; -} - - -message DestroyProjectRequest { - // The id of the project to destroy - string project_id = 1; -} - -message DestroyProjectResponse {} - -message UpdateProjectRequest { - // Project id to update - string project_id = 1; - // Updated name - string name = 2; - // Update description - string description = 3; - // Project binary flag(s) - int64 flag = 4; -} - -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..41c4f78d --- /dev/null +++ b/aruna/api/storage/services/v2/authorization_service.proto @@ -0,0 +1,120 @@ +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 DeleteAuthorization(DeleteAuthorizationRequest) + returns (DeleteAuthorizationResponse) { + option (google.api.http) = { + delete : "/v2/auth" + body : "*" + }; + } + + // 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/auth" + 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 { + string resource_id = 1; + string user_id = 2; + string user_name = 3; + storage.models.v2.PermissionLevel permission_level = 4; +} + +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 DeleteAuthorizationResponse {} + +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/collection_service.proto b/aruna/api/storage/services/v2/collection_service.proto new file mode 100644 index 00000000..55764683 --- /dev/null +++ b/aruna/api/storage/services/v2/collection_service.proto @@ -0,0 +1,216 @@ +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 = "CollectionService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + +// CollectionService +// +// Contains all methods that get/create or update Collection and associated resources +service CollectionService { + + // CreateNewCollection + // + // Status: BETA + // + // creates a new Collection + rpc CreateCollection(CreateCollectionRequest) + returns (CreateCollectionResponse) { + option (google.api.http) = { + post : "/v2/collection" + body : "*" + }; + } + + // GetCollection + // + // Status: BETA + // + // Request a specific collection by ID + rpc GetCollection(GetCollectionRequest) + returns (GetCollectionResponse) { + option (google.api.http) = { + get : "/v2/collection/{collection_id}" + }; + } + + // GetCollections + // + // Status: BETA + // + // Queries multiple collections by ID + rpc GetCollections(GetCollectionsRequest) returns (GetCollectionsResponse) { + option (google.api.http) = { + get : "/v2/collections/" + }; + } + + // DeleteCollection + // + // Status: STABLE + // + // This request deletes the collection. + rpc DeleteCollection(DeleteCollectionRequest) + returns (DeleteCollectionResponse) { + option (google.api.http) = { + delete : "/v2/collection/{collection_id}" + }; + } + + // UpdateCollectionName + // + // Status: BETA + // + // Updates the collection name. Caveat! Will rename the "s3 bucket" for data proxies! + rpc UpdateCollectionName(UpdateCollectionNameRequest) returns (UpdateCollectionNameResponse) { + option (google.api.http) = { + patch : "/v2/collection/{collection_id}/name" + body : "*" + }; + } + + // 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 + // + // Updates the collection key values. + rpc UpdateCollectionKeyValues(UpdateCollectionKeyValuesRequest) returns (UpdateCollectionKeyValuesResponse) { + option (google.api.http) = { + patch : "/v2/collection/{collection_id}/key_values" + body : "*" + }; + } + + // UpdateCollectionDataClass + // + // Status: BETA + // + // Updates the collection name. All (meta) data will be overwritten. + rpc UpdateCollectionDataClass(UpdateCollectionDataClassRequest) returns (UpdateCollectionDataClassResponse) { + option (google.api.http) = { + patch : "/v2/collection/{collection_id}/data_class" + body : "*" + }; + } + + // SnapshotCollectionRequest + // + // Status: BETA + // + // Archives the full collection, rendering all downstream relations immutable + rpc SnapshotCollection(SnapshotCollectionRequest) returns (SnapshotCollectionResponse) { + option (google.api.http) = { + post : "/v2/collection/{collection_id}/snapshot" + body : "*" + }; + } +} + +message CreateCollectionRequest { + // collection name + string name = 1; + // description + string description = 2; + // collection 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; + // DataClass + storage.models.v2.DataClass data_class = 5; + // Parent_id MUST be collection + oneof parent { + string project_id = 6; + } +} + +message CreateCollectionResponse { + // The new collection_id + storage.models.v2.Collection collection = 1; +} + +message GetCollectionRequest { + // Requested id + string collection_id = 1; +} + +message GetCollectionResponse { + // Overview of the requested collection + storage.models.v2.Collection collection = 1; +} + +message GetCollectionsRequest { + repeated string collection_ids = 1; +} + +message GetCollectionsResponse { + // List of collection overviews + repeated storage.models.v2.Collection collections = 1; +} + +message DeleteCollectionRequest { + string collection_id = 1; +} + +message DeleteCollectionResponse {} + +message UpdateCollectionNameRequest { + string collection_id = 1; + string name = 2; +} + +message UpdateCollectionNameResponse { + storage.models.v2.Collection collection = 1; +} + +message UpdateCollectionDescriptionRequest { + string collection_id = 1; + string description = 2; +} + +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 UpdateCollectionKeyValuesResponse { + 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 SnapshotCollectionRequest { + string collection_id = 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/dataset_service.proto b/aruna/api/storage/services/v2/dataset_service.proto new file mode 100644 index 00000000..e7c192cc --- /dev/null +++ b/aruna/api/storage/services/v2/dataset_service.proto @@ -0,0 +1,217 @@ +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 : "/v2/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 UpdateDatasetKeyValues(UpdateDatasetKeyValuesRequest) returns (UpdateDatasetKeyValuesResponse) { + option (google.api.http) = { + patch : "/v2/dataset/{dataset_id}/key_values" + 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 { + // dataset name + string name = 1; + // Description + string description = 2; + // dataset 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; + // DataClass + storage.models.v2.DataClass data_class = 5; + // Parent_id MUST be dataset + oneof parent { + string project_id = 6; + string collection_id = 7; + } +} + +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 UpdateDatasetKeyValuesResponse { + 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 diff --git a/aruna/api/storage/services/v1/endpoint_service.proto b/aruna/api/storage/services/v2/endpoint_service.proto similarity index 65% rename from aruna/api/storage/services/v1/endpoint_service.proto rename to aruna/api/storage/services/v2/endpoint_service.proto index 8f4e1d33..0b15342d 100644 --- a/aruna/api/storage/services/v1/endpoint_service.proto +++ b/aruna/api/storage/services/v2/endpoint_service.proto @@ -1,13 +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"; @@ -17,19 +16,32 @@ 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 : "*" }; } + + // 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 @@ -37,7 +49,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" }; } @@ -48,7 +60,7 @@ service EndpointService { // Gets all available endpoints rpc GetEndpoints(GetEndpointsRequest) returns (GetEndpointsResponse) { option (google.api.http) = { - get : "/v1/endpoints" + get : "/v2/endpoints" }; } @@ -60,7 +72,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}" }; } @@ -73,32 +85,33 @@ 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; - // (optional) ED25519 Pubkey -> Pubkey to validate endpoint authenticated tokens - string pubkey = 7; - // Added option to make a Dataproxy a bundler - bool is_bundler = 8; + bool is_public = 3; + // required public_key + string pubkey = 4; // List of EndpointHostConfigs - repeated storage.models.v1.EndpointHostConfig host_configs = 9; + repeated storage.models.v2.EndpointHostConfig host_configs = 5; } -message AddEndpointResponse { - // Overview of the requested endpoint - storage.models.v1.Endpoint endpoint = 1; - int64 pubkey_serial = 2; +message CreateEndpointResponse { + // Overview of the created endpoint + storage.models.v2.Endpoint endpoint = 1; +} + +message OnboardEndpointRequest {} + +message OnboardEndpointResponse { + string url = 1; } message GetEndpointRequest { @@ -113,7 +126,7 @@ message GetEndpointRequest { message GetEndpointResponse { // Overview of the requested endpoint - storage.models.v1.Endpoint endpoint = 1; + storage.models.v2.Endpoint endpoint = 1; } message GetEndpointsRequest { @@ -122,7 +135,7 @@ message GetEndpointsRequest { message GetEndpointsResponse { // List of endpoints - repeated storage.models.v1.Endpoint endpoints = 1; + repeated storage.models.v2.Endpoint endpoints = 1; } message DeleteEndpointRequest { @@ -136,5 +149,5 @@ message GetDefaultEndpointRequest {} 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 new file mode 100644 index 00000000..dd1ec00d --- /dev/null +++ b/aruna/api/storage/services/v2/info_service.proto @@ -0,0 +1,92 @@ +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 = "StorageStatusService"; +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + + +// 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 StorageStatusService { + + // GetStorageVersion + // + // 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 : "/v2/info/version" + }; + } + + // GetStorageStatus + // + // Status: ALPHA + // + // A request to get the current status of the storage components by location(s) + rpc GetStorageStatus(GetStorageStatusRequest) returns (GetStorageStatusResponse) { + option (google.api.http) = { + get : "/v2/info/status" + }; + } +} + + +message GetStorageVersionRequest {} + + +message SemanticVersion { + // Complete version string + string version_string = 1; + // Semver according to https://semver.org/ + int32 major = 2; + int32 minor = 3; + int32 patch = 4; + string labels = 5; +} + + +message LocationVersion { + // Status of a specific Location e.g Gießen / dataproxy / 0.5.0-beta.1 + string location = 1; + repeated ComponentVersion version = 2; +} + +message ComponentVersion { + // Name of a specific component e.g. server, dataproxy etc. and their status by location + string name = 1; + SemanticVersion version = 2; +} + +// Version of each component by location +message GetStorageVersionResponse { + repeated LocationVersion location_version = 1; +} + +message GetStorageStatusRequest {} + +message LocationStatus { + // Status of a specific Location e.g Gießen / AVAILABLE + string location = 1; + repeated ComponentStatus component_status = 2; +} + +message ComponentStatus { + // Name of a specific component e.g. server, dataproxy etc. and their status by location + string name = 1; + storage.models.v2.ComponentStatus status = 2; +} + +message GetStorageStatusResponse { + // List of all locations and their component / status + repeated LocationStatus location_status = 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 new file mode 100644 index 00000000..06b5a4ce --- /dev/null +++ b/aruna/api/storage/services/v2/object_service.proto @@ -0,0 +1,310 @@ +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 = "ObjectService"; + +import "aruna/api/storage/models/v2/models.proto"; +import "google/api/annotations.proto"; + +// ObjectService +// +// Contains all methods that get/create or update Objects and associated resources +service ObjectService { + + // CreateObject + // + // Status: BETA + // + // This creates a new object + // Initializing an object will put it in a staging area. + rpc CreateObject(CreateObjectRequest) + returns (CreateObjectResponse) { + option (google.api.http) = { + post : "/v2/object" + body : "*" + }; + } + + // GetUploadURL + // + // 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 : "/v2/object/{object_id}/upload" + }; + } + + // GetDownloadUrl + // + // Status: BETA + // + // 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 : "/v2/object/{object_id}/download" + }; + } + + // FinishObjectStaging + // + // Status: BETA + // + // This method completes the staging of an object. + rpc FinishObjectStaging(FinishObjectStagingRequest) + returns (FinishObjectStagingResponse) { + option (google.api.http) = { + patch : "/v2/object/{object_id}/finish" + body : "*" + }; + } + + // UpdateObject + // + // Status: BETA + // + // Objects are immutable! + // Updating an object will create a new revision for the object + // This method will put the new revision in a staging area. + // Staged objects will get a separate staging id and need to be finished + // before they can be used. + rpc UpdateObject(UpdateObjectRequest) returns (UpdateObjectResponse) { + option (google.api.http) = { + post : "/v2/object/{object_id}" + body : "*" + }; + } + + // CloneObject + // + // 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 : "/v2/{object_id}/clone" + body : "*" + }; + } + + // DeleteObject + // + // Status: BETA + // + // Deletes the object with the complete revision history. + rpc DeleteObject(DeleteObjectRequest) returns (DeleteObjectResponse) { + option (google.api.http) = { + delete : "/v2/object/{object_id}" + body : "*" + }; + } + + // GetObject + // + // 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 GetObject(GetObjectRequest) returns (GetObjectResponse) { + option (google.api.http) = { + get : "/v2/object/{object_id}" + }; + } + + // GetObjects + // + // Status: BETA + // + // Get multiple objects by ID at once + rpc GetObjects(GetObjectsRequest) returns (GetObjectsResponse) { + option (google.api.http) = { + get : "/v2/objects" + }; + } +} + +// Models +// These are the models for the above described requests and responses. +// gRPC best practises advice each Request and Response message in a RPC to be +// called {rpc_name}Request and {rpc_name}Response. + +message CreateObjectRequest { + // collection name + string name = 1; + // description + string description = 2; + // collection 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; + // DataClass + storage.models.v2.DataClass data_class = 5; + // Parent can be one of all other resources + oneof parent { + string project_id = 6; + string collection_id = 7; + string dataset_id = 8; + } + repeated storage.models.v2.Hash hashes = 9; + optional string preferred_endpoint_id = 10; +} + +message CreateObjectResponse { + storage.models.v2.Object object = 1; +} + +message GetUploadURLRequest { + // ObjectId + string object_id = 1; + // Is this a multipart upload? + bool multipart = 2; + // (optional) if multi was initialized + int32 part_number = 3; +} + +message GetUploadURLResponse { + // URL + string url = 1; +} + +message GetDownloadURLRequest { + string object_id = 1; +} + +message GetDownloadURLResponse { + // URL + string url = 1; +} + +message CompletedParts { + // Multipart identifier + string etag = 1; + // Part number + int64 part = 2; +} + +message FinishObjectStagingRequest { + // ObjectId + string object_id = 1; + // Hash of the uploaded data - used to verify the data integrity. + // This supports multiple hashing algorithms. + 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 = 3; +} + +message FinishObjectStagingResponse { + // (new) Object overview + storage.models.v2.Object object = 1; +} + +message UpdateObjectRequest { + // Existing object ID + string object_id = 1; + // 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; + // 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; + } + repeated storage.models.v2.Hash hashes = 12; +} + +message UpdateObjectResponse { + storage.models.v2.Object object = 1; + bool new_revision = 2; +} + +message CloneObjectRequest { + // ObjectId + string object_id = 1; + // + oneof parent { + string project_id = 2; + string collection_id = 3; + string dataset_id = 4; + } +} + +message CloneObjectResponse { + // This describes the new object. + storage.models.v2.Object object = 1; +} + +message DeleteObjectRequest { + // ObjectId + string object_id = 1; + // Delete including revisions + bool with_revisions = 2; +} + +message DeleteObjectResponse {} + +message GetObjectRequest { + // Object Id + string object_id = 1; +} + +message GetObjectResponse { storage.models.v2.Object object = 1; } + +message GetObjectsRequest { + // Object ids + repeated string object_ids = 1; +} + +message GetObjectsResponse { + // A List of objects + repeated storage.models.v2.Object objects = 1; +} + +message GetObjectRevisionsRequest { + // Object id + string object_id = 2; +} + +message GetObjectRevisionsResponse { + // List of objects + repeated storage.models.v2.Object objects = 1; +} + +message GetLatestObjectRevisionRequest { + // Object id + string object_id = 1; +} + +message GetLatestObjectRevisionResponse { + // The object with the latest revision + storage.models.v2.Object object = 1; +} + +message GetObjectEndpointsRequest { + // Collection id + string collection_id = 1; + // Object id + string object_id = 2; +} \ 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 new file mode 100644 index 00000000..9e893f2c --- /dev/null +++ b/aruna/api/storage/services/v2/project_service.proto @@ -0,0 +1,244 @@ +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" + body : "*" + }; + } + + // UpdateProjectDescription + // + // Status: BETA + // + // Updates the project name. + rpc UpdateProjectDescription(UpdateProjectDescriptionRequest) returns (UpdateProjectDescriptionResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/description" + body : "*" + }; + } + + // UpdateProjectKeyValues + // + // Status: BETA + // + // Updates the project key values. + rpc UpdateProjectKeyValues(UpdateProjectKeyValuesRequest) returns (UpdateProjectKeyValuesResponse) { + option (google.api.http) = { + patch : "/v2/project/{project_id}/key_values" + body : "*" + }; + } + + // 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" + body : "*" + }; + } + + // ArchiveProjectRequest + // + // Status: BETA + // + // Archives the full project, rendering all downstream relations immutable + rpc ArchiveProject(ArchiveProjectRequest) returns (ArchiveProjectResponse) { + option (google.api.http) = { + post : "/v2/project/{project_id}/archive" + body : "*" + }; + } +} + +message CreateProjectRequest { + // Project name + string name = 1; + // Description + string description = 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; + // DataClass + storage.models.v2.DataClass data_class = 5; +} + +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 project_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 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; + repeated storage.models.v2.KeyValue remove_key_values = 3; +} + +message UpdateProjectKeyValuesResponse { + 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; +} + +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..1133aba7 --- /dev/null +++ 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/search_service.proto b/aruna/api/storage/services/v2/search_service.proto new file mode 100644 index 00000000..9e7b597e --- /dev/null +++ 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"; + +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; + int64 offset = 3; +} + + +message SearchResourcesResponse { + // Json list for each found resource + 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/v1/service_account_service.proto b/aruna/api/storage/services/v2/service_account_service.proto similarity index 70% rename from aruna/api/storage/services/v1/service_account_service.proto rename to aruna/api/storage/services/v2/service_account_service.proto index 6b951c04..9080b7ce 100644 --- a/aruna/api/storage/services/v1/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 { diff --git a/aruna/api/storage/services/v1/user_service.proto b/aruna/api/storage/services/v2/user_service.proto similarity index 66% rename from aruna/api/storage/services/v1/user_service.proto rename to aruna/api/storage/services/v2/user_service.proto index c5b6d4fb..70b7f2c9 100644 --- a/aruna/api/storage/services/v1/user_service.proto +++ b/aruna/api/storage/services/v2/user_service.proto @@ -1,13 +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/auth.proto"; - +import "aruna/api/storage/models/v2/models.proto"; import "google/api/annotations.proto"; import "google/protobuf/timestamp.proto"; @@ -21,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 + // 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}" }; } @@ -85,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" }; } @@ -96,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" }; } @@ -120,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" }; } @@ -132,7 +131,7 @@ service UserService { rpc UpdateUserDisplayName(UpdateUserDisplayNameRequest) returns (UpdateUserDisplayNameResponse) { option (google.api.http) = { - patch : "/v1/user/display_name" + patch : "/v2/user/{user_id}/display_name" body : "*" }; } @@ -145,23 +144,11 @@ service UserService { rpc UpdateUserEmail(UpdateUserEmailRequest) returns (UpdateUserEmailResponse) { option (google.api.http) = { - patch : "/v1/user/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 @@ -170,7 +157,7 @@ service UserService { rpc GetNotActivatedUsers(GetNotActivatedUsersRequest) returns (GetNotActivatedUsersResponse) { option (google.api.http) = { - get : "/v1/user/not_activated" + get : "/v2/user/not_activated" }; } @@ -178,26 +165,21 @@ 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) = { - get : "/v1/user/all" + get : "/v2/user/all" }; } } -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; } @@ -206,35 +188,24 @@ 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 - // Project id - string project_id = 1; - // Collection id - string collection_id = 2; + +message CreateAPITokenRequest { // Token name - string name = 3; + string name = 1; + // Personal or resource specific + storage.models.v2.Permission permission = 2; // Token expiry - ExpiresAt expires_at = 4; - // Token permissions - storage.models.v1.Permission permission = 5; - // Session token - bool is_session = 6; + 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 string token_secret = 2; - // S3 Access Key - string s3_access_key = 3; - // S3 Secret Key - string s3_secret_key = 4; } message GetAPITokenRequest { @@ -244,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 { @@ -278,43 +249,22 @@ message GetUserRequest { message GetUserResponse { // User info - storage.models.v1.User user = 1; - // User permissions per project - repeated storage.models.v1.ProjectPermission project_permissions = 2; + storage.models.v2.User user = 1; } message UpdateUserDisplayNameRequest { // New display name string new_display_name = 1; } + 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; } message ActivateUserResponse {} @@ -323,20 +273,13 @@ 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 { - bool include_permissions = 1; -} - -message UserWithPerms { - storage.models.v1.User user = 1; - repeated storage.models.v1.ProjectPermission project_perms = 2; -} +message GetAllUsersRequest {} message GetAllUsersResponse { - repeated UserWithPerms user_with_perms = 1; + repeated storage.models.v2.User user = 1; } @@ -355,5 +298,5 @@ message UpdateUserEmailRequest { } message UpdateUserEmailResponse { - storage.models.v1.User user = 1; + storage.models.v2.User user = 1; } \ No newline at end of file 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..a3e9cc62 --- /dev/null +++ b/aruna/api/storage/services/v2/workspace_service.proto @@ -0,0 +1,131 @@ +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 + // + // A new request to create a personal anonymous workspace + rpc CreateWorkspace(CreateWorkspaceRequest) + returns (CreateWorkspaceResponse) { + option (google.api.http) = { + post : "/v2/workspace" + body : "*" + }; + } + + + // DeleteWorkspace + // + // Status: ALPHA + // + // Delete a workspace + rpc DeleteWorkspace(DeleteWorkspaceRequest) + returns (DeleteWorkspaceResponse) { + option (google.api.http) = { + delete : "/v2/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 : "/v2/workspace/{workspace_id}/claim" + body : "*" + }; + } + + // MoveWorkspaceData + // + // Status: ALPHA + // + // Claims an anonymous workspace + rpc MoveWorkspaceData(MoveWorkspaceDataRequest) + returns (MoveWorkspaceDataResponse) { + option (google.api.http) = { + post : "/v2/workspace/{workspace_id}/move/{project_id}" + body : "*" + }; + } +} + +// 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 workspace_template = 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 { + // This will update all objects as "non_workspace" and move the root to another project + string workspace_id = 1; + string project_id = 2; +} + +message MoveWorkspaceDataResponse {} \ No newline at end of file diff --git a/tests/build.rs b/tests/build.rs index 2423281a..d362d046 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/services/v2/")?; for entry in service_entries { let dir = entry?; let rel_path = format!( "{}{}", - "aruna/api/bundler/services/v1/", + "aruna/api/notification/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);