This repository was archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsecrethub.i
More file actions
47 lines (40 loc) · 1.4 KB
/
secrethub.i
File metadata and controls
47 lines (40 loc) · 1.4 KB
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
%module SecretHubXGO
// Add ExportEnv method
%typemap(cscode) struct Client %{
public void ExportEnv(System.Collections.Generic.Dictionary<string,string> env) {
foreach(System.Collections.Generic.KeyValuePair<string, string> envVar in env) {
System.Environment.SetEnvironmentVariable(envVar.Key, envVar.Value);
}
}
%}
// Map the time type to System.DateTime.
%apply long long { time };
%typemap(cstype) time "System.DateTime"
%typemap(csvarout, excode=SWIGEXCODE) time %{
get {
System.DateTime ret = System.DateTimeOffset.FromUnixTimeSeconds($imcall).UtcDateTime;$excode
return ret;
}
%}
// Map the uuid type to System.Guid.
%apply char* { uuid };
%typemap(cstype) uuid "System.Guid"
%typemap(csvarout, excode=SWIGEXCODE) uuid %{
get {
System.Guid ret = System.Guid.Parse($imcall);$excode
return ret;
}
%}
// Map return value of ResolveEnv to Dictionary<string, string>.
%typemap(cstype) char* ResolveEnv "System.Collections.Generic.Dictionary<string,string>"
%typemap(csout, excode=SWIGEXCODE) char* ResolveEnv {
var jsonEnv = $imcall;
$excode
var res = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>>(jsonEnv);
$excode
return res;
}
%typemap(csvarin) SWIGTYPE, char*, uuid, time %{
// properties of Secret and SecretVersion are read only
%}
%include secrethub-xgo/secrethub.i