-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathGetSecrets.cs
39 lines (29 loc) · 1.14 KB
/
GetSecrets.cs
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
using Fnproject.Fn.Fdk;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using System;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Oci.SecretsService;
using Oci.SecretsService.Models;
namespace GetSecrets
{
class Function
{
public string function_handler()
{
Dictionary<string, List<SecretContent>> output = new Dictionary<string, List<SecretContent>>();
var secret_details_list = new List<SecretContent>();
string secret_ocid = Environment.GetEnvironmentVariable("secret_ocid");
SecretsClient client = SecretsClientHelper.GetSecretsClient();
Task<string> secret_value = GetSecretsHelper.getSecretValue(client, secret_ocid);
var secret_detail = new SecretContent();
secret_detail.secret_content = secret_value.Result;
secret_details_list.Add(secret_detail);
output.Add("secret_content", secret_details_list);
return System.Text.Json.JsonSerializer.Serialize(output);
}
static void Main(string[] args) { Fdk.Handle(args[0]); }
}
}