sentry_policy_service.thrift 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #!/usr/local/bin/thrift -java
  2. /**
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #
  20. # Thrift Service that the MetaStore is built on
  21. #
  22. include "share/fb303/if/fb303.thrift"
  23. include "sentry_common_service.thrift"
  24. namespace java org.apache.sentry.provider.db.service.thrift
  25. namespace php sentry.provider.db.service.thrift
  26. namespace cpp Apache.Sentry.Provider.Db.Service.Thrift
  27. # Represents a Privilege in transport from the client to the server
  28. struct TSentryPrivilege {
  29. 1: required string privilegeScope, # Valid values are SERVER, DATABASE, TABLE
  30. 2: optional string privilegeName, # Generated on server side
  31. 3: required string serverName,
  32. 4: optional string dbName,
  33. 5: optional string tableName,
  34. 6: optional string URI,
  35. 7: required string action,
  36. 8: optional i64 createTime, # Set on server side
  37. 9: optional string grantorPrincipal # Set on server side
  38. }
  39. # TODO can this be deleted? it's not adding value to TAlterSentryRoleAddGroupsRequest
  40. struct TSentryGroup {
  41. 1: required string groupName
  42. }
  43. # CREATE ROLE r1
  44. struct TCreateSentryRoleRequest {
  45. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  46. 2: required string requestorUserName, # user on whose behalf the request is issued
  47. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  48. 4: required string roleName, # TSentryRole is not required for this request
  49. }
  50. struct TCreateSentryRoleResponse {
  51. 1: required sentry_common_service.TSentryResponseStatus status
  52. }
  53. # DROP ROLE r1
  54. struct TDropSentryRoleRequest {
  55. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  56. 2: required string requestorUserName, # user on whose behalf the request is issued
  57. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  58. 4: required string roleName # role to drop
  59. }
  60. struct TDropSentryRoleResponse {
  61. 1: required sentry_common_service.TSentryResponseStatus status
  62. }
  63. # GRANT ROLE r1 TO GROUP g1
  64. struct TAlterSentryRoleAddGroupsRequest {
  65. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  66. 2: required string requestorUserName, # user on whose behalf the request is issued
  67. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  68. 4: required string roleName,
  69. 5: required set<TSentryGroup> groups
  70. }
  71. struct TAlterSentryRoleAddGroupsResponse {
  72. 1: required sentry_common_service.TSentryResponseStatus status
  73. }
  74. # REVOLE ROLE r1 FROM GROUP g1
  75. struct TAlterSentryRoleDeleteGroupsRequest {
  76. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  77. 2: required string requestorUserName, # user on whose behalf the request is issued
  78. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  79. 4: required string roleName,
  80. 5: required set<TSentryGroup> groups
  81. }
  82. struct TAlterSentryRoleDeleteGroupsResponse {
  83. 1: required sentry_common_service.TSentryResponseStatus status
  84. }
  85. # GRANT ... ON ... TO ROLE ...
  86. struct TAlterSentryRoleGrantPrivilegeRequest {
  87. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  88. 2: required string requestorUserName, # user on whose behalf the request is issued
  89. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  90. 4: required string roleName,
  91. 5: required TSentryPrivilege privilege
  92. }
  93. struct TAlterSentryRoleGrantPrivilegeResponse {
  94. 1: required sentry_common_service.TSentryResponseStatus status
  95. }
  96. # REVOKE ... ON ... FROM ROLE ...
  97. struct TAlterSentryRoleRevokePrivilegeRequest {
  98. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  99. 2: required string requestorUserName, # user on whose behalf the request is issued
  100. 3: required set<string> requestorGroupNames # groups the requesting user belongs to
  101. 4: required string roleName,
  102. 5: required TSentryPrivilege privilege
  103. }
  104. struct TAlterSentryRoleRevokePrivilegeResponse {
  105. 1: required sentry_common_service.TSentryResponseStatus status
  106. }
  107. # SHOW ROLE GRANT
  108. struct TListSentryRolesRequest {
  109. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  110. 2: required string requestorUserName, # user on whose behalf the request is issued
  111. 3: required set<string> requestorGroupNames,# groups the requesting user belongs to
  112. 4: optional string groupName # for this group, or all roles for all groups if null
  113. }
  114. # used only for TListSentryRolesResponse
  115. struct TSentryRole {
  116. 1: required string roleName,
  117. 2: required set<TSentryGroup> groups,
  118. 3: required string grantorPrincipal
  119. }
  120. struct TListSentryRolesResponse {
  121. 1: required sentry_common_service.TSentryResponseStatus status
  122. 2: required set<TSentryRole> roles
  123. }
  124. # SHOW GRANT
  125. struct TListSentryPrivilegesRequest {
  126. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  127. 2: required string requestorUserName, # user on whose behalf the request is issued
  128. 3: required set<string> requestorGroupNames,# groups the requesting user belongs to
  129. 4: required string roleName # get privileges assigned for this role
  130. }
  131. struct TListSentryPrivilegesResponse {
  132. 1: required sentry_common_service.TSentryResponseStatus status
  133. 2: required set<TSentryPrivilege> privileges
  134. }
  135. # This API was created specifically for ProviderBackend.getPrivileges
  136. # and is not mean for general purpose privilege retrieval.
  137. # This request/response pair are created specifically so we can
  138. # efficiently obtain the specific privilges for a user query
  139. struct TSentryActiveRoleSet {
  140. 1: required bool all,
  141. 2: required set<string> roles,
  142. }
  143. struct TListSentryPrivilegesForProviderRequest {
  144. 1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1,
  145. 2: required set<string> groups,
  146. 3: required TSentryActiveRoleSet roleSet,
  147. }
  148. struct TListSentryPrivilegesForProviderResponse {
  149. 1: required sentry_common_service.TSentryResponseStatus status
  150. 2: required set<string> privileges
  151. }
  152. service SentryPolicyService
  153. {
  154. TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request)
  155. TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request)
  156. TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request)
  157. TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request)
  158. TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request)
  159. TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request)
  160. TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request)
  161. TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request)
  162. # For use with ProviderBackend.getPrivileges only
  163. TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request)
  164. }