Repository: airavata Updated Branches: refs/heads/airavata-gov-registry a3f9b19c5 -> 43f228fc2
http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/thrift_models/sharing_cpi.thrift ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/thrift_models/sharing_cpi.thrift b/modules/sharing-registry/thrift_models/sharing_cpi.thrift new file mode 100644 index 0000000..d3cc54f --- /dev/null +++ b/modules/sharing-registry/thrift_models/sharing_cpi.thrift @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +namespace java org.apache.airavata.sharing.registry.service.cpi + +include "./sharing_models.thrift" + +service GovRegistryService { + + /** + * Domain Operations + **/ + string createDomain(1: required sharing_models.Domain domain) throws (1: sharing_models.GovRegistryException gre) + bool updateDomain(1: required sharing_models.Domain domain) throws (1: sharing_models.GovRegistryException gre) + bool deleteDomain(1: required string domainId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.Domain getDomain(1: required string domainId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.Domain> getDomains(1: required i32 offset, 2: required i32 limit) throws (1: sharing_models.GovRegistryException gre); + + /** + * User Operations + **/ + string createUser(1: required sharing_models.User user) throws (1: sharing_models.GovRegistryException gre) + bool updatedUser(1: required sharing_models.User user) throws (1: sharing_models.GovRegistryException gre) + bool deleteUser(1: required string userId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.User getUser(1: required string userId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.User> getUsers(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre); + + /** + * Group Operations + **/ + string createGroup(1: required sharing_models.UserGroup group) throws (1: sharing_models.GovRegistryException gre) + bool updateGroup(1: required sharing_models.UserGroup group) throws (1: sharing_models.GovRegistryException gre) + bool deleteGroup(1: required string groupId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.UserGroup getGroup(1: required string groupId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.UserGroup> getGroups(1: required string domain, 2: required i32 offset, 3: required i32 limit) + + bool addUsersToGroup(1: required list<string> userIds, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre); + bool removeUsersFromGroup(1: required list<string> userIds, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre); + map<string, sharing_models.GroupChildType> getGroupMembers(1: required string groupId, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre); + bool addChildGroupToParentGroup(1: required string childId, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre); + bool removeChildGroupFromParentGroup(1: required string childId, 2: required string groupId) throws (1: sharing_models.GovRegistryException gre); + + /** + * EntityType Operations + **/ + string createEntityType(1: required sharing_models.EntityType entityType) throws (1: sharing_models.GovRegistryException gre) + bool updateEntityType(1: required sharing_models.EntityType entityType) throws (1: sharing_models.GovRegistryException gre) + bool deleteEntityType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.EntityType getEntityType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.EntityType> getEntityTypes(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre); + + /** + * Entity Operations + **/ + string createEntity(1: required sharing_models.Entity entity) throws (1: sharing_models.GovRegistryException gre) + bool updateEntity(1: required sharing_models.Entity entity) throws (1: sharing_models.GovRegistryException gre) + bool deleteEntity(1: required string entityId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.Entity getEntity(1: required string entityId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.Entity> searchEntities(1: required string userId, 2: required string entityTypeId, 3: required map<sharing_models.EntitySearchFields, + string> filters, 4: required i32 offset, 5: required i32 limit) throws (1: sharing_models.GovRegistryException gre) + + /** + * Permission Operations + **/ + string createPermissionType(1: required sharing_models.PermissionType permissionType) throws (1: sharing_models.GovRegistryException gre) + bool updatePermissionType(1: required sharing_models.PermissionType permissionType) throws (1: sharing_models.GovRegistryException gre) + bool deletePermissionType(1: required string entityTypeId) throws (1: sharing_models.GovRegistryException gre) + sharing_models.PermissionType getPermissionType(1: required string permissionTypeId) throws (1: sharing_models.GovRegistryException gre) + list<sharing_models.PermissionType> getPermissionTypes(1: required string domain, 2: required i32 offset, 3: required i32 limit) throws (1: sharing_models.GovRegistryException gre) + + /** + * Sharing Entity with Users and Groups + **/ + bool shareEntityWithUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) + bool revokeEntitySharingFromUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) + bool shareEntityWithGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) + bool revokeEntitySharingFromGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) + bool userHasAccess(1: required string domainId, 2: required string userId, 3: required string entityId, 4: required string permissionTypeId) throws (1: sharing_models.GovRegistryException gre) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/thrift_models/sharing_models.thrift ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/thrift_models/sharing_models.thrift b/modules/sharing-registry/thrift_models/sharing_models.thrift new file mode 100644 index 0000000..5670c5e --- /dev/null +++ b/modules/sharing-registry/thrift_models/sharing_models.thrift @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + + namespace java org.apache.airavata.sharing.registry.models + +const string DO_NOT_SET_AT_CLIENTS_ID = "DO_NOT_SET_AT_CLIENTS_ID" + +struct Domain { + 1: optional string domainId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string name, + 3: optional string description, + 4: optional i64 createdTime, + 5: optional i64 updatedTime +} + + struct User { + 1: optional string userId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string domainId, + 3: optional string userName, + 4: optional i64 createdTime, + 5: optional i64 updatedTime + } + +enum GroupType { + SINGLE_USER, + MULTI_USER +} + + struct UserGroup { + 1: optional string groupId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string domainId, + 3: optional string name, + 6: optional string description, + 7: optional string ownerId, + 8: optional i64 createdTime, + 9: optional i64 updatedTime, + 10: optional GroupType groupType + } + + enum GroupChildType { + USER, + GROUP + } + + struct GroupMembership { + 1: optional string parentId, + 2: optional string childId, + 3: optional GroupChildType childType + 4: optional i64 createdTime, + 5: optional i64 updatedTime + } + + + +struct EntityType { + 1: optional string entityTypeId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string domainId, + 3: optional string name, + 4: optional string description, + 5: optional i64 createdTime, + 6: optional i64 updatedTime +} + +enum EntitySearchFields { + NAME, + DESCRIPTION, + FULL_TEXT +} + + +struct Entity { + 1: optional string entityId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string domainId, + 3: optional string entityTypeId, + 4: optional string ownerId, + 5: optional string parentEntityId, + 6: optional string name, + 7: optional string description, + 8: optional map<string,string> metadata, + 9: optional string fullText, + 10: optional i64 createdTime, + 11: optional i64 updatedTime +} + +struct PermissionType { + 1: optional string permissionTypeId = DO_NOT_SET_AT_CLIENTS_ID, + 2: optional string domainId, + 3: optional string name, + 4: optional string description, + 5: optional i64 createdTime, + 6: optional i64 updatedTime +} + +enum SharingType { + DIRECT, + INHERITED + } + +struct Sharing { + 1: optional string permissionTypeId, + 2: optional string entityId, + 3: optional string groupId, + 4: optional GroupType groupType, + 5: optional SharingType sharingType, + 6: optional string inheritedParentId, + 7: optional i64 createdTime, + 8: optional i64 updatedTime +} + +exception GovRegistryException { + 1: required string message +} http://git-wip-us.apache.org/repos/asf/airavata/blob/43f228fc/modules/sharing-registry/thrift_models/thrift-gen.sh ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/thrift_models/thrift-gen.sh b/modules/sharing-registry/thrift_models/thrift-gen.sh new file mode 100755 index 0000000..295be80 --- /dev/null +++ b/modules/sharing-registry/thrift_models/thrift-gen.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +thrift --gen java sharing_models.thrift +cd gen-java +rm -r ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/* +cp -r org/apache/airavata/sharing/registry/models/ ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/ + +cd .. +thrift --gen java sharing_cpi.thrift +cd gen-java +rm -r ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/* +cp -r org/apache/airavata/sharing/registry/service/cpi/ ../../airavata-sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/ + +cd .. + +rm -r gen-java \ No newline at end of file
