Added keys to S3Cmd.cs
This commit is contained in:
parent
3484d4bca3
commit
47c8d438d1
|
@ -13,9 +13,9 @@ public class S3Cmd
|
||||||
|
|
||||||
private const String? S3CmdPath = "Resources/s3cmd.py";
|
private const String? S3CmdPath = "Resources/s3cmd.py";
|
||||||
private const String S3Prefix = "s3://";
|
private const String S3Prefix = "s3://";
|
||||||
|
|
||||||
public String Key { get; init;}
|
public String Key { get; init; } = S3Access.ReadWrite.Key;
|
||||||
public String Secret { get; init;}
|
public String Secret { get; init; } = S3Access.ReadWrite.Secret;
|
||||||
public String Region { get; init; } = "sos-ch-dk-2.exo.io";
|
public String Region { get; init; } = "sos-ch-dk-2.exo.io";
|
||||||
|
|
||||||
// private String?[] DefaultArgs { get; }
|
// private String?[] DefaultArgs { get; }
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
|
|
||||||
|
namespace InnovEnergy.Lib.Victron.VictronVRM;
|
||||||
|
|
||||||
|
|
||||||
|
public readonly partial record struct Installation
|
||||||
|
{
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<String>> GetAlarms()
|
||||||
|
{
|
||||||
|
var reply = await VrmAccount.AlarmsRequest(IdSite).TryGetJson();
|
||||||
|
|
||||||
|
var vrmReply = new Reply(reply);
|
||||||
|
if (!vrmReply.Success)
|
||||||
|
throw new Exception(nameof(GetAlarms) + " failed");
|
||||||
|
|
||||||
|
return vrmReply.Alarms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Boolean> SetAlarms(JsonObject tags)
|
||||||
|
{
|
||||||
|
var reply = await VrmAccount.AlarmsRequest(IdSite).TryPostJson(tags);
|
||||||
|
var vrmReply = new Reply(reply);
|
||||||
|
if (!vrmReply.Success)
|
||||||
|
throw new Exception(nameof(SetAlarms) + " failed");
|
||||||
|
|
||||||
|
return vrmReply.Success;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ public readonly record struct Reply(JsonNode Json)
|
||||||
public Boolean Success => Json.TryGetBoolean("success") is not null or true;
|
public Boolean Success => Json.TryGetBoolean("success") is not null or true;
|
||||||
|
|
||||||
public IReadOnlyList<String> Tags => Json.GetArray<String>("tags");
|
public IReadOnlyList<String> Tags => Json.GetArray<String>("tags");
|
||||||
|
public IReadOnlyList<String> Alarms => Json.GetArray<String>("alarms");
|
||||||
public JsonArray Records => Json.GetArray("records");
|
public JsonArray Records => Json.GetArray("records");
|
||||||
|
|
||||||
public IReadOnlyList<Device> Devices => Json["records"]!
|
public IReadOnlyList<Device> Devices => Json["records"]!
|
||||||
|
|
|
@ -22,6 +22,12 @@ public static class Requests
|
||||||
.AppendPathSegment("diagnostics")
|
.AppendPathSegment("diagnostics")
|
||||||
.SetQueryParams(new { count = nDetails });
|
.SetQueryParams(new { count = nDetails });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IFlurlRequest AlarmsRequest(this VrmAccount account, UInt64 installationId)
|
||||||
|
{
|
||||||
|
return InstallationRequest(account, installationId)
|
||||||
|
.AppendPathSegment("alarms");
|
||||||
|
}
|
||||||
|
|
||||||
public static IFlurlRequest InstallationRequest(this VrmAccount account, UInt64 installationId)
|
public static IFlurlRequest InstallationRequest(this VrmAccount account, UInt64 installationId)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue