10Duke Scale C++ Client
Loading...
Searching...
No Matches
AbstractLicenseRequest.h
1#ifndef TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
2#define TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
3
4#include "../../../rest/RESTConfiguration.h"
5#include "../../../config/ClientProperties.h"
6#include "http/HTTPClient.h"
7#include "http/HTTPRequestAuthenticator.h"
8#include "http/HTTPResponseToException.h"
9#include "json/JSONParser.h"
10
11#include <memory>
12
13
14namespace tenduke { namespace se { namespace licensing { namespace rest {
15
20{
21public:
23 static const std::string NO_LICENSE_KEY;
24
26 static const bool METERED;
28 static const bool NON_METERED;
29
30public:
43 std::string licenseKey,
44 bool metered,
45 const std::shared_ptr<const ::tenduke::se::ClientProperties> &clientProperties,
46 const std::shared_ptr<const ::tenduke::se::rest::RESTConfiguration> &configuration,
47 const std::shared_ptr<const ::tenduke::http::HTTPClient> &httpClient,
48 const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> &httpRequestAuthenticator,
49 const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> &throwException,
50 const std::shared_ptr<const ::tenduke::json::JSONParser> &jsonParser
51 );
52
53protected:
58 std::string getLicenseKey() const;
59
64 bool hasLicenseKey() const;
65
67 bool isMetered() const;
68
74
75private:
76 // parameters
77 const std::string licenseKey; // If empty, then this is non-licensekey request
78 const bool metered; // metered or not
79
80protected:
81 // configuration
83 const std::shared_ptr<const ::tenduke::se::ClientProperties> clientProperties;
85 const std::shared_ptr<const ::tenduke::se::rest::RESTConfiguration> configuration;
86
87 // services required
89 const std::shared_ptr<const ::tenduke::http::HTTPClient> http;
91 const std::shared_ptr<const ::tenduke::http::HTTPRequestAuthenticator> httpRequestAuthenticator;
93 const std::shared_ptr<const ::tenduke::http::HTTPResponseToException> throwException;
95 const std::shared_ptr<const ::tenduke::json::JSONParser> parseJSON;
96};
97
98}}}}
99
100#endif //TENDUKE_SE_LICENSING_REST_ABSTRACTLICENSEREQUEST_H
AbstractLicenseRequest(std::string licenseKey, bool metered, const std::shared_ptr< const ::tenduke::se::ClientProperties > &clientProperties, const std::shared_ptr< const ::tenduke::se::rest::RESTConfiguration > &configuration, 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::json::JSONParser > &jsonParser)
Constructs new instance.
Definition AbstractLicenseRequest.cpp:52
Builds HTTPRequest.
Definition HTTPRequestBuilder.h:23
static const bool NON_METERED
Magic value to indicate that this is normal (not metered) license request.
Definition AbstractLicenseRequest.h:28
void setClientClaims(::tenduke::http::HTTPRequestBuilder &request) const
Sets client claims to the request.
Definition AbstractLicenseRequest.cpp:34
static const std::string NO_LICENSE_KEY
Magic value to indicate that this is not a license key request.
Definition AbstractLicenseRequest.h:23
static const bool METERED
Magic value to indicate that this is metered license request.
Definition AbstractLicenseRequest.h:26
const std::shared_ptr< const ::tenduke::http::HTTPClient > http
HTTP-client.
Definition AbstractLicenseRequest.h:89
const std::shared_ptr< const ::tenduke::http::HTTPRequestAuthenticator > httpRequestAuthenticator
HTTP-request authenticator.
Definition AbstractLicenseRequest.h:91
const std::shared_ptr< const ::tenduke::http::HTTPResponseToException > throwException
Throw-exception.
Definition AbstractLicenseRequest.h:93
bool isMetered() const
Checks if this metered-request.
std::string getLicenseKey() const
Returns license key.
Definition AbstractLicenseRequest.cpp:16
bool hasLicenseKey() const
Checks if this is license-key request.
Definition AbstractLicenseRequest.cpp:22
const std::shared_ptr< const ::tenduke::se::ClientProperties > clientProperties
Client properties.
Definition AbstractLicenseRequest.h:83
AbstractLicenseRequest(std::string licenseKey, bool metered, const std::shared_ptr< const ::tenduke::se::ClientProperties > &clientProperties, const std::shared_ptr< const ::tenduke::se::rest::RESTConfiguration > &configuration, 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::json::JSONParser > &jsonParser)
Constructs new instance.
Definition AbstractLicenseRequest.cpp:52
const std::shared_ptr< const ::tenduke::json::JSONParser > parseJSON
Parses JSON.
Definition AbstractLicenseRequest.h:95
const std::shared_ptr< const ::tenduke::se::rest::RESTConfiguration > configuration
Config.
Definition AbstractLicenseRequest.h:85
Low-level services for performing licensing REST-requests.
Definition DefaultDescribeLicenseConsumerClientBindingsRequest.h:9
Licensing operations for 10Duke Scale.
Definition LicenseConsumerClientBindingStatus.h:8
Classes, functions and globals of 10Duke Scale C++ Client.
Definition AbstractClientFactory.h:16
Root for classes, functions and globals of 10Duke C++ Client.
Definition AbstractClientFactory.h:16