10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
FluentLicenseCheckoutBuilder.h
1#ifndef TENDUKE_EE_LICENSING_FLUENTCHECKOUTBUILDER_H
2#define TENDUKE_EE_LICENSING_FLUENTCHECKOUTBUILDER_H
3
4#include "../../config/ClientProperties.h"
5#include "./LicenseCheckoutParameters.h"
6
7#include <string>
8#include <utility>
9#include <vector>
10
11namespace tenduke { namespace ee { namespace licensing {
12
17template<typename BUILDER>
19{
20public:
26 : clientProperties(std::move(clientProperties))
27 , consumeCount(tenduke::ee::licensing::LicenseCheckoutParameters::DEFAULT_CONSUME_COUNT)
28 , consumeDuration(tenduke::ee::licensing::LicenseCheckoutParameters::DEFAULT_CONSUME_DURATION)
29 , consumptionMode(tenduke::ee::licensing::LicenseCheckoutParameters::ConsumptionMode::DEFAULT)
30 , entitlementId("")
31 , organizationId("")
32 {}
33
52 BUILDER & seat(
53 const std::string &productName,
54 const std::string &requestedVersion = "",
55 const std::string &licenseId = ""
56 ) {
57 return item(productName, requestedVersion, licenseId);
58 }
59
74 BUILDER & item(
75 const std::string &itemName,
76 const std::string &requestedVersion = "",
77 const std::string &licenseId = ""
78 ) {
79 items.emplace_back(itemName, requestedVersion, licenseId);
80 return static_cast<BUILDER&>(*this);
81 }
82
88
89 BUILDER & count(std::uint64_t pConsumeCount)
90 {
91 this->consumeCount = pConsumeCount;
92 return static_cast<BUILDER&>(*this);
93 }
94
95
101 BUILDER & duration(std::uint64_t pConsumeDuration)
102 {
103 this->consumeDuration = pConsumeDuration;
104 return static_cast<BUILDER&>(*this);
105 }
106
107
115 BUILDER & fromEntitlement(const std::string &pEntitlementId)
116 {
117 this->entitlementId = pEntitlementId;
118 return static_cast<BUILDER&>(*this);
119 }
120
121
129 BUILDER & fromOrganization(const std::string &pOrganizationId)
130 {
131 this->organizationId = pOrganizationId;
132 return static_cast<BUILDER&>(*this);
133 }
134
135
143 {
144 this->consumptionMode = pConsumptionMode;
145 return static_cast<BUILDER&>(*this);
146 }
147
148
156 BUILDER & version(const std::string &pGlobalVersion)
157 {
158 this->globalVersion = pGlobalVersion;
159 return static_cast<BUILDER&>(*this);
160 }
161
162
163protected:
169 {
171 items,
172 consumptionMode,
173 globalVersion,
174 clientProperties,
175 consumeDuration,
176 consumeCount,
177 entitlementId,
178 organizationId
179 );
180 }
181
182private:
183 ::tenduke::ee::ClientProperties clientProperties;
184 std::uint64_t consumeCount;
185 std::uint64_t consumeDuration;
187 std::string entitlementId;
188 std::string globalVersion;
189 std::string organizationId;
190 std::vector<tenduke::ee::licensing::LicenseCheckoutItem> items;
191};
192
193}}}
194
195#endif //TENDUKE_EE_LICENSING_FLUENTCHECKOUTBUILDER_H
BUILDER & count(std::uint64_t pConsumeCount)
Sets "The requested number of units to be consumed from the license’s use count.".
Definition FluentLicenseCheckoutBuilder.h:89
FluentLicenseCheckoutBuilder(::tenduke::ee::ClientProperties clientProperties)
Constructs new instance.
Definition FluentLicenseCheckoutBuilder.h:25
BUILDER & mode(enum tenduke::ee::licensing::LicenseCheckoutParameters::ConsumptionMode pConsumptionMode)
Sets "The license consumption mode requested." (See the enumeration for the documentation of the valu...
Definition FluentLicenseCheckoutBuilder.h:142
BUILDER & fromEntitlement(const std::string &pEntitlementId)
Sets id of the Entitlement, from which the licenses will be checked from.
Definition FluentLicenseCheckoutBuilder.h:115
BUILDER & item(const std::string &itemName, const std::string &requestedVersion="", const std::string &licenseId="")
Adds an item to checkout.
Definition FluentLicenseCheckoutBuilder.h:74
BUILDER & duration(std::uint64_t pConsumeDuration)
Sets "The requested duration of the license token (and the lease) in milliseconds....
Definition FluentLicenseCheckoutBuilder.h:101
BUILDER & version(const std::string &pGlobalVersion)
Sets default version to checkout.
Definition FluentLicenseCheckoutBuilder.h:156
virtual tenduke::ee::licensing::LicenseCheckoutParameters buildParameters()
Builds the parameters.
Definition FluentLicenseCheckoutBuilder.h:168
BUILDER & seat(const std::string &productName, const std::string &requestedVersion="", const std::string &licenseId="")
Adds "checkout one seat for product" to the request.
Definition FluentLicenseCheckoutBuilder.h:52
BUILDER & fromOrganization(const std::string &pOrganizationId)
Sets id of the Organization, from which the licenses will be checked from.
Definition FluentLicenseCheckoutBuilder.h:129
Parameters for license checkout request.
Definition LicenseCheckoutParameters.h:18
ConsumptionMode
License consumption modes.
Definition LicenseCheckoutParameters.h:21
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
Client properties.
Definition ClientProperties.h:14