From 9ea33470d3522f62706385887b064526cef8a2e5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 28 Aug 2015 13:30:06 +0200 Subject: Thrift API --- src/main/thrift/bwlp.thrift | 118 +++++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 35 deletions(-) (limited to 'src/main/thrift') diff --git a/src/main/thrift/bwlp.thrift b/src/main/thrift/bwlp.thrift index 113d6bc..c658952 100644 --- a/src/main/thrift/bwlp.thrift +++ b/src/main/thrift/bwlp.thrift @@ -131,21 +131,6 @@ struct OperatingSystem { 4: string architecture, } -// Sat <-> Master -struct ImagePublishData { - 1: UUID imageBaseId, - 2: UUID currentVersionId, - 3: string imageName, - 4: i32 osId, - 5: string virtId, - 6: UnixTimestamp baseCreateTime, - 7: UnixTimestamp versionCreateTime, - 8: UUID ownerId, - 9: UUID uploaderId, - 11: i64 fileSize, - 16: bool isTemplate, -} - struct ImagePermissions { 1: bool link 2: bool download @@ -227,6 +212,21 @@ struct ImageDetailsRead { 18: optional ImagePermissions userPermissions, } +struct ImagePublishData { + 1: UUID imageBaseId, + 2: UUID imageVersionId, + 3: string imageName, + 4: string description, + 5: UnixTimestamp createTime, + 6: UUID userId, + 7: i64 fileSize, + 8: list software, + 9: list tags, + 10: i32 osId, + 11: string virtId, + 12: bool isTemplate, +} + struct NetRule { 1: i32 ruleId, 2: NetDirection direction, @@ -387,26 +387,30 @@ service SatelliteServer { /* * File transfer related */ + + // Client wants to upload an image TransferInformation requestImageVersionUpload(1: Token userToken, 2: UUID imageBaseId, 3: i64 fileSize, 4: list blockHashes, 5: binary machineDescription) throws (1:TTransferRejectedException rejection, 2:TAuthorizationException authError, 3:TInvocationException ffff, 4:TNotFoundException sdf), + // Client updates block hashes of an upload void updateBlockHashes(1: Token uploadToken, 2: list blockHashes) throws (1:TInvalidTokenException ex1), + // Client cancels an upload void cancelUpload(1: Token uploadToken) throws (1:TInvalidTokenException ex1), + // Client queries server-side status of an upload TransferStatus queryUploadStatus(1: Token uploadToken) throws (1:TInvalidTokenException ex1), + // Client wants to download an image TransferInformation requestDownload(1: Token userToken, 2: UUID imageVersionId) throws (1:TTransferRejectedException rejection, 2:TAuthorizationException authError, 3:TInvocationException ffff, 4:TNotFoundException sdf), + // Client cancels a download void cancelDownload(1: string downloadToken) throws (1:TInvalidTokenException ex1), - - binary getMachineDescription(1: Token userToken, 2: UUID imageVersionId) - throws (1:TAuthorizationException authError, 2:TInvocationException ffff, 3:TNotFoundException sdf), /* * Auth/Session @@ -420,16 +424,19 @@ service SatelliteServer { WhoamiInfo whoami(1: Token userToken) throws (1:TAuthorizationException authError, 2:TInvocationException serverError), + // Logout - make server forget given token void invalidateSession(1: Token userToken) throws (1:TInvalidTokenException ex), // find a user in a given organization by a search term list getUserList(1:Token userToken, 2:i32 page) throws (1:TAuthorizationException failure, 2:TInvocationException serverError), - + + // Get user configurable options SatelliteUserConfig getUserConfig(1:Token userToken) throws (1:TAuthorizationException failure, 2:TInvocationException serverError), - + + // Set user configurable options void setUserConfig(1:Token userToken, 2:SatelliteUserConfig config) throws (1:TAuthorizationException failure, 2:TInvocationException serverError), @@ -446,65 +453,89 @@ service SatelliteServer { /* * Image related */ + // Get image list. tagSearch can be null, which disables this type of filtering and returns all list getImageList(1: Token userToken, 2: list tagSearch, 3: i32 page) throws (1:TAuthorizationException authError, 2:TInvocationException serverError), + // Query detailed information about an image ImageDetailsRead getImageDetails(1: Token userToken, 2: UUID imageBaseId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Create a new image; the image will have no versions, so the user needs to upload one and set meta data later on UUID createImage(1: Token userToken, 2: string imageName) throws (1:TAuthorizationException authError, 2:TInvocationException error), + // Update given image's base meta data void updateImageBase(1: Token userToken, 2: UUID imageBaseId 3: ImageBaseWrite image) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException imgError), + // Update a certain image version's meta data void updateImageVersion(1: Token userToken, 2: UUID imageVersionId 3: ImageVersionWrite image) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException imgError), + // Delete given image version. If the version is currently in use by a lecture, it will not be + // deleted and false is returned void deleteImageVersion(1: Token userToken, 2: UUID imageVersionId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Delete image and all its versions void deleteImageBase(1:Token userToken, 2:UUID imageBaseId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Write list of permissions for given image void writeImagePermissions(1: Token userToken, 2: UUID imageBaseId, 3: map permissions) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Get all user-permissions for given image map getImagePermissions(1: Token userToken, 2: UUID imageBaseId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Set new owner of image void setImageOwner(1: Token userToken, 2: UUID imageBaseId 3: UUID newOwnerId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), - // Set image version valid and change expiry date (super user action) + + // Set image version valid and change expire date (super user action) void setImageVersionExpiry(1: Token userToken, 2: UUID imageBaseId 3: UnixTimestamp expireTime) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError, 4:TInvalidDateParam dateError), - + + // Client asks server to replicate an image from the master server + UUID requestImageReplication(1:Token userToken, 2: UUID imageVersionId) + throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + /* * Lecture related */ + // Create new lecture UUID createLecture(1: Token userToken, 2: LectureWrite lecture) throws (1:TAuthorizationException authError, 2:TInvocationException serverError, 3:TInvalidDateParam dateError), + // Update existing lecture void updateLecture(1: Token userToken, 2: UUID lectureId, 3: LectureWrite lecture) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError, 4:TInvalidDateParam dateError), + // Get list of all lectures list getLectureList(1: Token userToken, 2: i32 page) throws (1:TAuthorizationException authError, 2:TInvocationException serverError), + // Get detailed lecture information LectureRead getLectureDetails(1: Token userToken, 2: UUID lectureId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Delete given lecture void deleteLecture(1: Token userToken, 2: UUID lectureId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Write list of permissions for given lecture void writeLecturePermissions(1: Token userToken, 2: UUID lectureId, 3: map permissions) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Get list of permissions for given lecture map getLecturePermissions(1: Token userToken, 2: UUID lectureId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), + // Set new owner of lecture void setLectureOwner(1: Token userToken, 2: UUID lectureId 3: UUID newOwnerId) throws (1:TAuthorizationException authError, 2:TNotFoundException notFound, 3:TInvocationException serverError), @@ -514,48 +545,60 @@ service SatelliteServer { service MasterServer { -/* - * Client (User's Desktop App) calls - */ - // Ping service + /* + * Client (User's Desktop App) calls + */ + + + // Ping service bool ping(), // Old style test-account login SessionData authenticate(1:string login, 2:string password) throws (1:TAuthorizationException failure, 2:TInvocationException error), + // New style test-account login ClientSessionData localAccountLogin(1:string login, 2:string password) throws (1:TAuthorizationException failure, 2:TInvocationException error), + // find a user in a given organization by a search term list findUser(1:Token sessionId, 2:string organizationId, 3:string searchTerm) throws (1:TAuthorizationException failure, 2:TInvocationException error), + // Get list of publicly available images list getPublicImages(1:Token sessionId, 2:i32 page) throws (1:TAuthorizationException failure, 2:TInvocationException error), + // Logout void invalidateSession(1: Token sessionId) throws (1:TInvalidTokenException ex), -/* - * Server (Satellite) calls - */ + /* + * Server (Satellite) calls + */ + // Verify a user by querying its meta data from the supplied token UserInfo getUserFromToken(1:Token token) throws (1:TInvalidTokenException failure), + // Check if the server is authenticated bool isServerAuthenticated(1:Token serverSessionId), + // Start authentication of server for given organization binary startServerAuthentication(1:string organizationId) throws (1: TAuthorizationException failure, 2:TInvocationException error), + // Reply to master server authentication challenge ServerSessionData serverAuthenticate(1:string organizationId, 2:binary challengeResponse) throws (1:TAuthorizationException failure, 2:TInvocationException errr), + + // Get image information (prior to download) + ImagePublishData getImageData(1:Token serverSessionId, 2:UUID imageVersionId) + throws (1:TAuthorizationException failure, 2: TInvocationException failure2, 3:TNotFoundException f3), + // Request upload of an image to the master server TransferInformation submitImage(1:Token serverSessionId, 2:ImagePublishData imageDescription, 3:list blockHashes) throws (1:TAuthorizationException failure, 2: TInvocationException failure2, 3: TTransferRejectedException failure3), - // Request download of an image - TransferInformation getImage(2:Token serverSessionId, 1:UUID imageVersionId) - throws (1:TAuthorizationException failure, 2:TInvocationException failure2), bool registerSatellite(1:string organizationId, 2:string address, 3:string modulus, 4:string exponent) throws (1:TInvocationException error), @@ -563,9 +606,14 @@ service MasterServer { bool updateSatelliteAddress(1:Token serverSessionId, 2:string address) throws (1:TAuthorizationException failure, 2:TInvocationException error), -/* - * Shared calls - */ + /* + * Shared calls + */ + + // Request download of an image (session id can be a client or a server session) + TransferInformation downloadImage(2:Token sessionId, 1:UUID imageVersionId) + throws (1:TAuthorizationException failure, 2:TInvocationException failure2, 3:TNotFoundException f3), + // Get list of known organizations with meta data list getOrganizations() throws (1:TInvocationException serverError), -- cgit v1.2.3-55-g7522