2using System.Collections.Generic;
3using System.Threading.Tasks;
19 : base(
"/UpdateBackupSettings")
53 if (!(Obj is Dictionary<string, object> Form))
56 if (!Form.TryGetValue(
"AutomaticBackups", out Obj) || !
CommonTypes.
TryParse(Obj.ToString().Trim(), out
bool AutomaticBackups))
58 Response.StatusCode = 400;
59 Response.StatusMessage =
"Bad Request";
61 await Response.
Write(
"Automatic backups value invalid.");
66 if (!Form.TryGetValue(
"BackupTime", out Obj) || !TimeSpan.TryParse(Obj.ToString().Trim(), out TimeSpan BackupTime))
68 Response.StatusCode = 400;
69 Response.StatusMessage =
"Bad Request";
71 await Response.
Write(
"Backup time invalid.");
76 if (!Form.TryGetValue(
"KeepDays", out Obj) || !
int.TryParse(Obj.ToString().Trim(), out
int KeepDays) || KeepDays < 0)
78 Response.StatusCode = 400;
79 Response.StatusMessage =
"Bad Request";
81 await Response.
Write(
"Invalid number of days specified.");
86 if (!Form.TryGetValue(
"KeepMonths", out Obj) || !
int.TryParse(Obj.ToString().Trim(), out
int KeepMonths) || KeepMonths < 0)
88 Response.StatusCode = 400;
89 Response.StatusMessage =
"Bad Request";
91 await Response.
Write(
"Invalid number of months specified.");
96 if (!Form.TryGetValue(
"KeepYears", out Obj) || !
int.TryParse(Obj.ToString().Trim(), out
int KeepYears) || KeepYears < 0)
98 Response.StatusCode = 400;
99 Response.StatusMessage =
"Bad Request";
101 await Response.
Write(
"Invalid number of years specified.");
112 Response.StatusCode = 200;
113 Response.StatusMessage =
"OK";
Helps with parsing of commong data types.
static bool TryParse(string s, out double Value)
Tries to decode a string encoded double.
Plain text encoder/decoder.
const string DefaultContentType
text/plain
Static class managing data export.
static async Task SetKeepDaysAsync(long Value)
For how many days backups are kept.
static async Task SetKeepMonthsAsync(long Value)
For how many months the monthly backups are kept.
static async Task SetAutomaticBackupsAsync(bool Value)
If automatic backups are activated
static async Task SetBackupTimeAsync(TimeSpan Value)
Time of day to start performing backups.
static async Task SetKeepYearsAsync(long Value)
For how many years the yearly backups are kept.
Static class managing the runtime environment of the IoT Gateway.
static IUser AssertUserAuthenticated(HttpRequest Request, string Privilege)
Makes sure a request is being made from a session with a successful user login.
Web Resource for updating backup settings.
async Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
bool AllowsPOST
If the POST method is allowed.
UpdateBackupSettings()
Web Resource for updating backup settings.
override bool UserSessions
If the resource uses user sessions.
override bool HandlesSubPaths
If the resource handles sub-paths.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
bool HasData
If the request has data.
async Task< object > DecodeDataAsync()
Decodes data sent in request.
Represets a response of an HTTP client request.
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
async Task Write(byte[] Data)
Returns binary data in the response.
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
POST Interface for HTTP resources.