Skip to content

Commit 3b9322f

Browse files
committed
feat: add floating client metadata
1 parent 6f28501 commit 3b9322f

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

cryptlex/lexfloatclient/lexfloatclient.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,28 @@ def GetFloatingClientMeterAttributeUses(name):
267267
else:
268268
raise LexFloatClientException(status)
269269

270+
@staticmethod
271+
def GetFloatingClientMetadata(key):
272+
"""Gets the value of the floating client metadata.
273+
274+
Args:
275+
key (str): metadata key to retrieve the value
276+
277+
Raises:
278+
LexFloatClientException
279+
280+
Returns:
281+
str: value of metadata for the key
282+
"""
283+
cstring_key = LexFloatClientNative.get_ctype_string(key)
284+
buffer_size = 256
285+
buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size)
286+
status = LexFloatClientNative.GetFloatingClientMetadata(
287+
cstring_key, buffer, buffer_size)
288+
if status != LexFloatStatusCodes.LF_OK:
289+
raise LexFloatClientException(status)
290+
return LexFloatClientNative.byte_to_string(buffer.value)
291+
270292
@staticmethod
271293
def RequestFloatingLicense():
272294
"""Sends the request to lease the license from the LexFloatServer.

cryptlex/lexfloatclient/lexfloatclient_native.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ def byte_to_string(input):
159159
GetFloatingClientMeterAttributeUses.argtypes = [CSTRTYPE, POINTER(c_uint32)]
160160
GetFloatingClientMeterAttributeUses.restype = c_int
161161

162+
GetFloatingClientMetadata = library.GetFloatingClientMetadata
163+
GetFloatingClientMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32]
164+
GetFloatingClientMetadata.restype = c_int
165+
166+
162167
RequestFloatingLicense = library.RequestFloatingLicense
163168
RequestFloatingLicense.argtypes = []
164169
RequestFloatingLicense.restype = c_int

0 commit comments

Comments
 (0)