|
10Duke Scale C++ Client
|
For overview of using License Key to authenticate requests, see following sections in 10 Duke Scale Documentation:
One way to authenticate device or user is to use license key, which might be embedded to a device or prompted from the user. Following licensing operations can be executed with the license key without having to do login:
tenduke::se::licensing::LicensingClient::checkoutLicensesWithKey(const std::string &) const and tenduke::se::licensing::LicensingClient::checkoutLicensesWithKey(const std::string &,const tenduke::se::licensing::LicenseCheckoutParameters &) consttenduke::se::licensing::LicensingClient::heartbeatLicenses() const and tenduke::se::licensing::LicensingClient::heartbeatLicenses(const tenduke::se::licensing::LicenseHeartbeatParameters &) consttenduke::se::licensing::LicensingClient::releaseLicenses() const and tenduke::se::licensing::LicensingClient::releaseLicenses(const tenduke::se::licensing::LicenseReleaseParameters &) consttenduke::se::licensing::LicensingClient::describeLicenseKey(const std::string &) const and tenduke::se::licensing::LicensingClient::describeLicenseKey(const std::string &,const tenduke::se::Paging &,bool) constNote that you don't need to provide the license key to heartbeat or release: The client remembers that the lease was checked out with license key and will automatically fill-in the license key.
If you only need the above operations, you can use tenduke::se::TendukeClient: This service works with license keys only. To create instance of the service, use factory function tenduke::se::createTendukeClientForLicenseKeyUsage(const std::string &,const tenduke::se::BackendConfiguration &,const tenduke::se::ClientProperties &,const std::string &initialStateAsJson,const ::tenduke::ServiceConfiguration &).
See also client concepts.
Following examples demonstrate, how to perform typical operations with license key.
Create the client:
Checkout licenses:
Heartbeart the lease (note how you don't need to provide the license key)
NOTE: Heartbeat generates new ids for the leases.
To release the licenses after heartbeat (note how you don't need to provide the license key):
The licensing client has a memory cache, which holds leases of checked out licenses and manages the leases automatically after heartbeat or release request. To list all leases currently in cache:
The client allows you to only operate (heartbeat or release) on leases, which are present in the cache. If you want to release all checked out licenses, you can do:
For all available services, see tenduke::se::TendukeClient.