Class LicenseService
java.lang.Object
dev.demeng.sentinel.client.license.LicenseService
Facade for all license operations against the Sentinel API.
Obtain an instance via SentinelClient.licenses().
-
Constructor Summary
ConstructorsConstructorDescriptionLicenseService(dev.demeng.sentinel.client.internal.SentinelHttpClient httpClient, dev.demeng.sentinel.client.internal.ApiResponseParser apiResponseParser, dev.demeng.sentinel.client.internal.LicenseResponseParser licenseResponseParser, dev.demeng.sentinel.client.internal.PageResponseParser pageResponseParser, com.google.gson.Gson gson, @Nullable dev.demeng.sentinel.client.internal.SignatureVerifier signatureVerifier, @Nullable dev.demeng.sentinel.client.internal.ReplayProtector replayProtector) -
Method Summary
Modifier and TypeMethodDescriptionReturns the operations handle for managing license connections.create(CreateLicenseRequest request) Creates a new license.voidDeletes a license.Retrieves a license by key.ips()Returns the operations handle for managing license IP addresses.list(ListLicensesRequest request) Lists licenses matching the given criteria.regenerateKey(String key) Regenerates the key for a license, assigning a random new key.regenerateKey(String key, @Nullable String newKey) Regenerates the key for a license, optionally specifying the new key.servers()Returns the operations handle for managing license server identifiers.subUsers()Returns the operations handle for managing license sub-users.update(String key, UpdateLicenseRequest request) Partially updates a license.validate(ValidationRequest request) Validates a license key against the Sentinel API.
-
Constructor Details
-
LicenseService
public LicenseService(dev.demeng.sentinel.client.internal.SentinelHttpClient httpClient, dev.demeng.sentinel.client.internal.ApiResponseParser apiResponseParser, dev.demeng.sentinel.client.internal.LicenseResponseParser licenseResponseParser, dev.demeng.sentinel.client.internal.PageResponseParser pageResponseParser, com.google.gson.Gson gson, @Nullable dev.demeng.sentinel.client.internal.SignatureVerifier signatureVerifier, @Nullable dev.demeng.sentinel.client.internal.ReplayProtector replayProtector)
-
-
Method Details
-
connections
Returns the operations handle for managing license connections.- Returns:
- the connection operations
-
subUsers
Returns the operations handle for managing license sub-users.- Returns:
- the sub-user operations
-
servers
Returns the operations handle for managing license server identifiers.- Returns:
- the server operations
-
ips
Returns the operations handle for managing license IP addresses.- Returns:
- the IP operations
-
validate
Validates a license key against the Sentinel API.On validation failure (e.g. expired or blacklisted license), this method returns a
ValidationResultwithValidationResult.isValid()returningfalserather than throwing an exception. UseValidationResult.requireValid()to throw on failure instead.If signature verification is enabled, the response signature and nonce are verified before returning. Tampered or replayed responses will throw the appropriate exception.
- Parameters:
request- the validation request containing the license key and context- Returns:
- the validation result
- Throws:
SentinelException- if a network, API, signature, or replay error occurs
-
create
Creates a new license.- Parameters:
request- the creation parameters- Returns:
- the created license
- Throws:
SentinelException- if a network or API error occurs
-
get
Retrieves a license by key.- Parameters:
key- the license key- Returns:
- the license
- Throws:
SentinelException- if a network or API error occurs
-
list
Lists licenses matching the given criteria.- Parameters:
request- the filter and pagination parameters- Returns:
- a page of licenses
- Throws:
SentinelException- if a network or API error occurs
-
update
Partially updates a license.- Parameters:
key- the license keyrequest- the fields to update- Returns:
- the updated license
- Throws:
SentinelException- if a network or API error occurs
-
delete
Deletes a license.- Parameters:
key- the license key- Throws:
SentinelException- if a network or API error occurs
-
regenerateKey
Regenerates the key for a license, assigning a random new key.- Parameters:
key- the current license key- Returns:
- the license with its new key
- Throws:
SentinelException- if a network or API error occurs
-
regenerateKey
Regenerates the key for a license, optionally specifying the new key.- Parameters:
key- the current license keynewKey- the desired new key, ornullfor a random key- Returns:
- the license with its new key
- Throws:
SentinelException- if a network or API error occurs
-