1#ifndef TENDUKE_EE_LICENSING_AUTZHAPI_ABSTRACTLICENSETOKENAUTHZAPIREQUEST_H
2#define TENDUKE_EE_LICENSING_AUTZHAPI_ABSTRACTLICENSETOKENAUTHZAPIREQUEST_H
4#include "./AbstractAuthzApiRequest.h"
5#include "../../LicenseTokenParser.h"
7#include "http/HTTPClient.h"
8#include "http/HTTPRequestAuthenticator.h"
9#include "http/HTTPResponseToException.h"
37 const std::shared_ptr<const ::tenduke::http::HTTPClient> &httpClient,
38 const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> &httpRequestAuthenticator,
39 const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> &throwException,
40 const std::shared_ptr<const ::tenduke::ee::licensing::impl::LicenseTokenParser> &licenseTokenParser,
41 const std::shared_ptr<::tenduke::log::Logger> logger
43 , parseLicenseToken(licenseTokenParser)
56 std::map<std::string, ::tenduke::ee::licensing::Lease> items;
57 std::map<std::string, ::tenduke::ee::licensing::LicensingError> failedItems;
62 std::size_t payloadLength = payload.length();
63 for (
int i = 0; i < payloadLength; i++) {
64 if (payload.at(i) ==
'&') {
66 parseLicenseToken->from(payload.substr(startOfToken, i - startOfToken)),
75 if (startOfToken < payloadLength) {
77 parseLicenseToken->from(payload.substr(startOfToken)),
82 return {items, failedItems};
86 void handleParsedResult(
87 const ::tenduke::ee::licensing::impl::LeaseOrError &leaseOrError,
88 std::map<std::string, ::tenduke::ee::licensing::Lease> &items,
89 std::map<std::string, ::tenduke::ee::licensing::LicensingError> &failedItems
92 if (leaseOrError.isLease()) {
93 items.emplace(leaseOrError.lease.name, leaseOrError.lease);
96 failedItems.emplace(leaseOrError.error.getItemName(), leaseOrError.error);
101 const std::shared_ptr<const ::tenduke::ee::licensing::impl::LicenseTokenParser> parseLicenseToken;
AbstractLicenseTokenAuthzApiRequest(const std::shared_ptr< const ::tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > &httpRequestAuthenticator, const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr< const ::tenduke::ee::licensing::impl::LicenseTokenParser > &licenseTokenParser, const std::shared_ptr<::tenduke::log::Logger > logger)
Constructs new instance.g.
Definition AbstractLicenseTokenAuthzApiRequest.h:36
Base class for authz-API HTTP requests.
Definition AbstractAuthzApiRequest.h:24
AbstractAuthzApiRequest(const std::shared_ptr< const ::tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > &httpRequestAuthenticator, const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr<::tenduke::log::Logger > &logger)
Constructs new instance.
Definition AbstractAuthzApiRequest.h:34
T parseResponsePayload(const std::string &payload) const override
Parses the response payload.
Definition AbstractLicenseTokenAuthzApiRequest.h:54
AbstractLicenseTokenAuthzApiRequest(const std::shared_ptr< const ::tenduke::http::HTTPClient > &httpClient, const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > &httpRequestAuthenticator, const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > &throwException, const std::shared_ptr< const ::tenduke::ee::licensing::impl::LicenseTokenParser > &licenseTokenParser, const std::shared_ptr<::tenduke::log::Logger > logger)
Constructs new instance.g.
Definition AbstractLicenseTokenAuthzApiRequest.h:36
Low-level client for licensing operations using 10Duke authz-API.
Definition AuthzLicensingClient.h:13
Classes, functions and globals related to 10Duke Enterprise licensing.
Definition AuthzLicensingClient.h:13
Classes, functions and globals of 10Duke Enterprise C++ Client.
Definition APIRequest.h:4
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4