3using System.Threading.Tasks;
27 : base(
"Storage/StoreInVault",
28 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
48 string Type = (string)Parameters[
"PType"].AssociatedObjectValue;
49 string ClientId = (string)Parameters[
"PClientId"]?.AssociatedObjectValue;
50 string VaultId = (string)Parameters[
"PVaultId"]?.AssociatedObjectValue;
51 object[] TagNames = (
object[])Parameters[
"PTagName"].AssociatedObjectValue;
52 object[] TagValues = (
object[])Parameters[
"PTagValue"].AssociatedObjectValue;
53 object[] TagMaskedValues = (
object[])Parameters[
"PTagMaskedValue"].AssociatedObjectValue;
56 int i, c = TagNames?.Length ?? 0;
57 if ((TagValues?.Length ?? 0) != c || (TagMaskedValues?.Length ?? 0) != c)
60 for (i = 0; i < c; i++)
62 if (!(TagNames[i] is
string TagName) ||
string.IsNullOrEmpty(TagName))
65 if (!(TagValues[i] is
string TagValue))
68 if (!(TagMaskedValues[i] is
string TagMaskedValue))
70 if (TagMaskedValues[i] is
null)
71 TagMaskedValue =
null;
82 if (
string.IsNullOrEmpty(VaultId))
92 ClientId = ClientId ??
string.Empty,
95 Created = DateTime.UtcNow
115 VaultIdBin = Convert.FromBase64String(VaultId);
129 if (Item.
Type != Type)
132 if (Item.
ClientId != (ClientId ??
string.Empty))
134 if (
string.IsNullOrEmpty(ClientId))
140 Item.Updated = DateTime.UtcNow;
148 {
"created", Item.Created },
149 {
"updated", Item.Updated },
150 {
"vaultId", Convert.ToBase64String(Item.
VaultId) }
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing the runtime environment of the IoT Gateway.
static byte[] NextBytes(int NrBytes)
Generates an array of random bytes.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Represents an HTTP request.
Represets a response of an HTTP client request.
Task Return(Exception ex)
Returns an error to the client.
The server has not found anything matching the Request-URI. No indication is given of whether the con...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
This filter selects objects that have a named field equal to a given value.
A chunked list is a linked list of chunks of objects of type T .
void Add(T Item)
Adds an item to the collection.
T[] ToArray()
Returns an array containing all elements of the collection.
Static class managing loading of resources stored as embedded resources or in content files.
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
Class managing a script expression.
Contains information about a broker account.
string UserName
User Name.
Abstract base class for agent resources supporting the POST method.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd
Stores information in the Encrypted Vault.
StoreInVault()
Stores information in the Encrypted Vault.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
Contains information about an item in the Vault.
string ClientId
Client ID (as defined by the agent).
string Type
Vault item type.
byte[] VaultId
ID given to the Vault item.
string Account
Account name.
DateTime Created
When item was created.
Contains information about a tag in a vault item.