10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
FluentLicenseReleaseBuilder.h
1#ifndef TENDUKE_EE_LICENSING_FLUENTLICENSERELEASEBEUILDER_H
2#define TENDUKE_EE_LICENSING_FLUENTLICENSERELEASEBEUILDER_H
3
4#include "../Lease.h"
5#include "../release/LicenseReleaseParameters.h"
6#include "../release/LicenseReleaseResponse.h"
7
8#include <map>
9#include <memory>
10#include <string>
11#include <vector>
12
13namespace tenduke { namespace ee { namespace licensing {
14
15class LicensingClient;
16
20template <typename BUILDER>
22{
23public:
29 BUILDER & leaseId(const std::string &leaseId)
30 {
31 leaseIds.push_back(leaseId);
32 return static_cast<BUILDER &>(*this);
33 }
34
41 BUILDER & leases(const std::map<std::string, tenduke::ee::licensing::Lease>& items)
42 {
43 for (const auto &item : items) {
44 leaseIds.push_back(item.second.leaseId);
45 }
46 return static_cast<BUILDER &>(*this);
47 }
48
49
55 BUILDER & leases(const std::vector<tenduke::ee::licensing::Lease>& items)
56 {
57 for (const auto &item : items) {
58 leaseIds.push_back(item.leaseId);
59 }
60 return static_cast<BUILDER &>(*this);
61 }
62
63
69 BUILDER & lease(const tenduke::ee::licensing::Lease &license)
70 {
71 return leaseId(license.leaseId);
72 }
73
74protected:
83
84private:
86 std::vector<std::string> leaseIds;
87};
88
89}}}
90
91#endif //TENDUKE_EE_LICENSING_FLUENTLICENSERELEASEBEUILDER_H
Utility for building tenduke::ee::licensing::LicenseReleaseRequest.
Definition FluentLicenseReleaseBuilder.h:22
BUILDER & leaseId(const std::string &leaseId)
Adds a lease-id to release.
Definition FluentLicenseReleaseBuilder.h:29
BUILDER & leases(const std::vector< tenduke::ee::licensing::Lease > &items)
Adds multiple leases to release from a vector.
Definition FluentLicenseReleaseBuilder.h:55
BUILDER & lease(const tenduke::ee::licensing::Lease &license)
Adds single lease to release from tenduke::ee::licensing::LicenseCheckoutItem.
Definition FluentLicenseReleaseBuilder.h:69
tenduke::ee::licensing::LicenseReleaseParameters buildParameters()
Builds tenduke::ee::licensing::LicenseReleaseParameters.
Definition FluentLicenseReleaseBuilder.h:79
BUILDER & leases(const std::map< std::string, tenduke::ee::licensing::Lease > &items)
Adds multiple leases to release from a map.
Definition FluentLicenseReleaseBuilder.h:41
Describes checked out licensed item.
Definition Lease.h:21
const std::string leaseId
Id of the lease.
Definition Lease.h:109
Parameters for license-release request.
Definition LicenseReleaseParameters.h:13
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4