-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeleteItineraries.cs
57 lines (50 loc) · 2.05 KB
/
DeleteItineraries.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
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 AmblOn.State.API.Users.Graphs;
namespace AmblOn.State.API.Users
{
[DataContract]
public class DeleteItinerariesRequest
{
[DataMember]
public virtual List<Guid> ItineraryIDs { get; set; }
}
public class DeleteItineraries
{
#region Fields
protected AmblOnGraph amblGraph;
#endregion
#region Constructors
public DeleteItineraries(AmblOnGraph amblGraph)
{
this.amblGraph = amblGraph;
}
#endregion
[FunctionName("DeleteItineraries")]
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, DeleteItinerariesRequest, UsersStateHarness>(req, signalRMessages, log,
async (harness, reqData, actReq) =>
{
log.LogInformation($"DeleteItineraries");
var stateDetails = StateUtils.LoadStateDetails(req);
await harness.DeleteItineraries(amblGraph, stateDetails.Username, stateDetails.EnterpriseAPIKey, reqData.ItineraryIDs);
return Status.Success;
});
}
}
}