Skip to content

Commit a4e5a34

Browse files
authored
Merge pull request #10 from cryptlex/muneeb/floating-client-metadata
feat: Add GetFloatingClientMetadata method
2 parents 8f456ca + 60a6b13 commit a4e5a34

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

cryptlex/lexfloatclient/lexfloatclient.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,28 @@ def GetFloatingClientMeterAttributeUses(name):
285285
else:
286286
raise LexFloatClientException(status)
287287

288+
@staticmethod
289+
def GetFloatingClientMetadata(key):
290+
"""Gets the value of the floating client metadata.
291+
292+
Args:
293+
key (str): metadata key to retrieve the value
294+
295+
Raises:
296+
LexFloatClientException
297+
298+
Returns:
299+
str: value of the floating client metadata
300+
"""
301+
cstring_key = LexFloatClientNative.get_ctype_string(key)
302+
buffer_size = 4096
303+
buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size)
304+
status = LexFloatClientNative.GetFloatingClientMetadata(
305+
cstring_key, buffer, buffer_size)
306+
if status != LexFloatStatusCodes.LF_OK:
307+
raise LexFloatClientException(status)
308+
return LexFloatClientNative.byte_to_string(buffer.value)
309+
288310
@staticmethod
289311
def RequestFloatingLicense():
290312
"""Sends the request to lease the license from the LexFloatServer.

cryptlex/lexfloatclient/lexfloatclient_native.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ def byte_to_string(input):
163163
GetFloatingClientMeterAttributeUses.argtypes = [CSTRTYPE, POINTER(c_uint32)]
164164
GetFloatingClientMeterAttributeUses.restype = c_int
165165

166+
GetFloatingClientMetadata = library.GetFloatingClientMetadata
167+
GetFloatingClientMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32]
168+
GetFloatingClientMetadata.restype = c_int
169+
166170
RequestFloatingLicense = library.RequestFloatingLicense
167171
RequestFloatingLicense.argtypes = []
168172
RequestFloatingLicense.restype = c_int

0 commit comments

Comments
 (0)