Skip to content

Commit 1aedc50

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
varlink: add a varlink interface file for a keybridge service
Define a simple-ish interface for fetching data blobs from a peer service. The intent is that the backing service can be a basic key-value store or a more complex secret store. The keybridge server encapsulates the complexity of talking to a web-service or whatnot requiring the client to only deal with identifying the scope and key to fetch the value. Plus debugging and introspection stuff. Signed-off-by: John Mulligan <[email protected]>
1 parent 6c33475 commit 1aedc50

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

sambacc/varlink/__init__.py

Whitespace-only changes.

sambacc/varlink/interfaces/__init__.py

Whitespace-only changes.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
interface org.samba.containers.keybridge
2+
3+
4+
# Scopes define some subset of entries - all entries are part of some
5+
# scope. Different scopes might map to different servers.
6+
7+
# ScopeInfo contains basic information about a scope.
8+
type ScopeInfo (
9+
name: string,
10+
default: bool,
11+
kind: string,
12+
description: string
13+
)
14+
15+
# Scopes lists known scopes.
16+
method Scopes() -> (scopes: []ScopeInfo)
17+
18+
# HasScope reports on the given scope name if it is known.
19+
method HasScope(name: string) -> (scope: ?ScopeInfo)
20+
21+
22+
# Entries are the main form of data exchange. A scope may or may not
23+
# support setting entries. Every entry has a EntryKind that determines
24+
# how data is passed to and from the API.
25+
26+
27+
# EntryKind determines how the data is encoded in the Entry object and
28+
# *may* affect what field the data will appear in the Entry object in
29+
# the future. A scope *may* translate between kinds, but does not have
30+
# to. In other words, if you store a B64 but request a VALUE the
31+
# scope is permitted to translate it but can instead return an InvalidKind
32+
# error.
33+
#
34+
# The B64 kind means that data is a single base64 encoded string.
35+
# The VALUE kind means that data is a single JSON-safe unicode string.
36+
type EntryKind (B64, VALUE)
37+
38+
# Entry contains the entry's identity and data.
39+
type Entry (
40+
name: string,
41+
scope: string,
42+
kind: EntryKind,
43+
data: ?string
44+
)
45+
46+
# Get an entry from the server.
47+
method Get(
48+
name: string,
49+
scope: string,
50+
kind: EntryKind
51+
) -> (entry: Entry)
52+
53+
# Set will create or update an entry on the server.
54+
method Set(entry: Entry) -> ()
55+
56+
# Delete will remove an entry on the server.
57+
method Delete(name: string, scope: string) -> ()
58+
59+
60+
# ScopeNotFound may be returned if a request refers to an unknown scope.
61+
error ScopeNotFound (scope: string)
62+
63+
# EntryNotFound may be returned if a request refers to an unknown entry.
64+
error EntryNotFound (name: string, scope: string)
65+
66+
# InvalidKind may be returned if a request refers to an unknown entry kind or a
67+
# kind is not supported by the scope.
68+
error InvalidKind ()
69+
70+
# ReadOnlyScope may be returned if a Set or Delete request is sent to a read
71+
# only scope.
72+
error ReadOnlyScope (name: string)
73+
74+
# OperationNotSupported may be returned if an entry method is not supported by
75+
# the given scope.
76+
error OperationNotSupported (op: string, entry: string, scope: string)

0 commit comments

Comments
 (0)