10Duke Enterprise C++ SDK
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 <stdexcept>
11#include <string>
12#include <vector>
13
14namespace tenduke { namespace ee { namespace licensing {
15
16class LicensingClient;
17
21template <typename BUILDER>
23{
24public:
31 BUILDER & leaseId(const std::string &leaseId)
32 {
33 if (leaseId.empty()) {
34 throw std::invalid_argument("FluentLicenseReleaseBuilder: a lease id must not be empty");
35 }
36 leaseIds.push_back(leaseId);
37 return static_cast<BUILDER &>(*this);
38 }
39
47 BUILDER & leases(const std::map<std::string, tenduke::ee::licensing::Lease>& items)
48 {
49 for (const auto &item : items) {
50 leaseId(item.second.leaseId);
51 }
52 return static_cast<BUILDER &>(*this);
53 }
54
55
62 BUILDER & leases(const std::vector<tenduke::ee::licensing::Lease>& items)
63 {
64 for (const auto &item : items) {
65 leaseId(item.leaseId);
66 }
67 return static_cast<BUILDER &>(*this);
68 }
69
70
77 BUILDER & lease(const tenduke::ee::licensing::Lease &license)
78 {
79 return leaseId(license.leaseId);
80 }
81
82protected:
91
92private:
94 std::vector<std::string> leaseIds;
95};
96
97}}}
98
99#endif //TENDUKE_EE_LICENSING_FLUENTLICENSERELEASEBEUILDER_H
Utility for building tenduke::ee::licensing::LicenseReleaseRequest.
Definition FluentLicenseReleaseBuilder.h:23
BUILDER & leaseId(const std::string &leaseId)
Adds a lease-id to release.
Definition FluentLicenseReleaseBuilder.h:31
BUILDER & leases(const std::vector< tenduke::ee::licensing::Lease > &items)
Adds multiple leases to release from a vector.
Definition FluentLicenseReleaseBuilder.h:62
BUILDER & lease(const tenduke::ee::licensing::Lease &license)
Adds single lease to release from tenduke::ee::licensing::LicenseCheckoutItem.
Definition FluentLicenseReleaseBuilder.h:77
tenduke::ee::licensing::LicenseReleaseParameters buildParameters()
Builds tenduke::ee::licensing::LicenseReleaseParameters.
Definition FluentLicenseReleaseBuilder.h:87
BUILDER & leases(const std::map< std::string, tenduke::ee::licensing::Lease > &items)
Adds multiple leases to release from a map.
Definition FluentLicenseReleaseBuilder.h:47
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:14
High-level client for licensing operations.
Definition LicensingClient.h:47
Classes, functions and globals related to 10Duke Enterprise licensing.
Definition AuthzLicensingClient.h:13
const std::vector< std::string > leaseIds
Id's of successfully released leases.
Definition LicenseReleaseResponse.h:44
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