Esempio n. 1
0
        public static async Task <ConnectToStateResponse> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req, ILogger log,
                                                              ClaimsPrincipal claimsPrincipal, //[LCUStateDetails]StateDetails stateDetails,
                                                              [SignalR(HubName = AmblOnState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages,
                                                              [SignalR(HubName = AmblOnState.HUB_NAME)] IAsyncCollector <SignalRGroupAction> signalRGroupActions,
                                                              [Blob("state-api/{headers.lcu-ent-lookup}/{headers.lcu-hub-name}/{headers.x-ms-client-principal-id}/{headers.lcu-state-key}", FileAccess.ReadWrite)] CloudBlockBlob stateBlob)
        {
            var stateDetails = StateUtils.LoadStateDetails(req);

            if (stateDetails.StateKey == "users")
            {
                return(await signalRMessages.ConnectToState <UsersState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else if (stateDetails.StateKey == "itineraries")
            {
                return(await signalRMessages.ConnectToState <ItinerariesState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else if (stateDetails.StateKey == "locations")
            {
                return(await signalRMessages.ConnectToState <LocationsState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else
            {
                throw new Exception("A valid State Key must be provided (amblon, itineraries, locations).");
            }
        }
        public static async Task <ConnectToStateResponse> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req, ILogger log,
                                                              ClaimsPrincipal claimsPrincipal, //[LCUStateDetails]StateDetails stateDetails,
                                                              [SignalR(HubName = LimitedTrialState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages,
                                                              [SignalR(HubName = LimitedTrialState.HUB_NAME)] IAsyncCollector <SignalRGroupAction> signalRGroupActions,
                                                              [Blob("state-api/{headers.lcu-ent-lookup}/{headers.lcu-hub-name}/{headers.x-ms-client-principal-id}/{headers.lcu-state-key}", FileAccess.ReadWrite)] CloudBlockBlob stateBlob)
        {
            var stateDetails = StateUtils.LoadStateDetails(req);

            if (stateDetails.StateKey == "data-apps")
            {
                return(await signalRMessages.ConnectToState <LimitedDataAppsManagementState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else if (stateDetails.StateKey == "data-flow")
            {
                return(await signalRMessages.ConnectToState <LimitedDataFlowManagementState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else if (stateDetails.StateKey == "journeys")
            {
                return(await signalRMessages.ConnectToState <LimitedJourneysManagementState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else
            {
                throw new Exception("A valid State Key must be provided (data-apps, data-flow).");
            }
        }
Esempio n. 3
0
 public static async Task <ConnectToStateResponse> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req, ILogger log,
                                                       ClaimsPrincipal claimsPrincipal, //[LCUStateDetails]StateDetails stateDetails,
                                                       [SignalR(HubName = InfrastructureManagementState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages,
                                                       [SignalR(HubName = InfrastructureManagementState.HUB_NAME)] IAsyncCollector <SignalRGroupAction> signalRGroupActions,
                                                       [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 signalRMessages.ConnectToState <InfrastructureManagementState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
 }
Esempio n. 4
0
        public async Task <ConnectToStateResponse> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequest req,
                                                       ClaimsPrincipal claimsPrincipal, //[LCUStateDetails]StateDetails stateDetails,
                                                       [SignalR(HubName = IoTEnsembleState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages,
                                                       [SignalR(HubName = IoTEnsembleState.HUB_NAME)] IAsyncCollector <SignalRGroupAction> signalRGroupActions,
                                                       [Blob("state-api/{headers.lcu-ent-lookup}/{headers.lcu-hub-name}/{headers.x-ms-client-principal-id}/{headers.lcu-state-key}", FileAccess.ReadWrite)] CloudBlockBlob stateBlob)
        {
            var stateDetails = StateUtils.LoadStateDetails(req);

            if (stateDetails.StateKey.StartsWith("admin"))
            {
                return(await signalRMessages.ConnectToState <IoTEnsembleAdminState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
            else
            {
                return(await signalRMessages.ConnectToState <IoTEnsembleSharedState>(req, log, claimsPrincipal, stateBlob, signalRGroupActions));
            }
        }