forked from Azure/azure-batch-software-entitlement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoftwareEntitlementClient.h
69 lines (52 loc) · 1.3 KB
/
SoftwareEntitlementClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#include <string>
#include <exception>
#include <memory>
namespace Microsoft {
namespace Azure {
namespace Batch {
namespace SoftwareEntitlement {
//
// The following initialization function must be invoked from the program's
// entry function (e.g. 'main'), as this library uses libcurl which has an
// absurd requirement that no other threads exist in the application when it
// is initialized. See https://curl.haxx.se/libcurl/c/curl_global_init.html.
//
// Returns 0 if successful.
//
int Init();
void Cleanup();
class Exception : public std::runtime_error
{
public:
explicit Exception(const std::string& message);
explicit Exception(const char *message);
};
class Entitlement
{
private:
std::string m_id;
std::string m_vmId;
public:
Entitlement(const std::string& response);
virtual ~Entitlement();
const std::string& Id() const;
const std::string& VmId() const;
};
//
// Returns an Entitlement object, throws an Exception providing details of
// entitlement validation failure.
//
std::unique_ptr<Entitlement> GetEntitlement(
std::string& url,
const std::string& entitlement_token,
const std::string& requested_entitlement
);
void AddSslCertificate(
const std::string& ssl_cert_thumbprint,
const std::string& ssl_cert_common_name
);
}
}
}
}