diff --git a/cryptlex/lexfloatclient/lexfloatclient.py b/cryptlex/lexfloatclient/lexfloatclient.py index 13f2e2c..292316d 100644 --- a/cryptlex/lexfloatclient/lexfloatclient.py +++ b/cryptlex/lexfloatclient/lexfloatclient.py @@ -267,6 +267,28 @@ def GetFloatingClientMeterAttributeUses(name): else: raise LexFloatClientException(status) + @staticmethod + def GetFloatingClientMetadata(key): + """Gets the value of the floating client metadata. + + Args: + key (str): metadata key to retrieve the value + + Raises: + LexFloatClientException + + Returns: + str: value of the floating client metadata + """ + cstring_key = LexFloatClientNative.get_ctype_string(key) + buffer_size = 4096 + buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size) + status = LexFloatClientNative.GetFloatingClientMetadata( + cstring_key, buffer, buffer_size) + if status != LexFloatStatusCodes.LF_OK: + raise LexFloatClientException(status) + return LexFloatClientNative.byte_to_string(buffer.value) + @staticmethod def RequestFloatingLicense(): """Sends the request to lease the license from the LexFloatServer. diff --git a/cryptlex/lexfloatclient/lexfloatclient_native.py b/cryptlex/lexfloatclient/lexfloatclient_native.py index e116d62..53a025d 100644 --- a/cryptlex/lexfloatclient/lexfloatclient_native.py +++ b/cryptlex/lexfloatclient/lexfloatclient_native.py @@ -159,6 +159,10 @@ def byte_to_string(input): GetFloatingClientMeterAttributeUses.argtypes = [CSTRTYPE, POINTER(c_uint32)] GetFloatingClientMeterAttributeUses.restype = c_int +GetFloatingClientMetadata = library.GetFloatingClientMetadata +GetFloatingClientMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32] +GetFloatingClientMetadata.restype = c_int + RequestFloatingLicense = library.RequestFloatingLicense RequestFloatingLicense.argtypes = [] RequestFloatingLicense.restype = c_int