-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddUserInfo.cs
59 lines (52 loc) · 2.05 KB
/
AddUserInfo.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using AmblOn.State.API.Users.Models;
using Fathym;using Microsoft.Azure.WebJobs.Extensions.SignalRService;using AmblOn.State.API.Users.State;using Microsoft.WindowsAzure.Storage.Blob;using LCU.StateAPI.Utilities;
using Microsoft.WindowsAzure.Storage;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Drawing;
using LCU.Presentation;
using AmblOn.State.API.Users.Graphs;
namespace AmblOn.State.API.Users
{
[DataContract]
public class AddUserInfoRequest
{
[DataMember]
public virtual UserInfo UserInfo { get; set; }
}
public class AddUserInfo
{
#region Fields
protected AmblOnGraph amblGraph;
#endregion
#region Constructors
public AddUserInfo(AmblOnGraph amblGraph)
{
this.amblGraph = amblGraph;
}
#endregion
[FunctionName("AddUserInfo")]
public virtual async Task<Status> Run([HttpTrigger(AuthorizationLevel.Admin)] HttpRequest req, ILogger log,
[SignalR(HubName = UsersState.HUB_NAME)]IAsyncCollector<SignalRMessage> signalRMessages,
[Blob("state-api/{headers.lcu-ent-api-key}/{headers.lcu-hub-name}/{headers.x-ms-client-principal-id}/{headers.lcu-state-key}", FileAccess.ReadWrite)] CloudBlockBlob stateBlob)
{
return await stateBlob.WithStateHarness<UsersState, AddUserInfoRequest, UsersStateHarness>(req, signalRMessages, log,
async (harness, reqData, actReq) =>
{
log.LogInformation($"AddUserInfo");
var stateDetails = StateUtils.LoadStateDetails(req);
await harness.AddUserInfo(amblGraph, stateDetails.Username, stateDetails.EnterpriseAPIKey, reqData.UserInfo);
return Status.Success;
});
}
}
}