Skip to content

Commit 4f1a8cf

Browse files
committed
Optimizer API
1 parent 9d47d58 commit 4f1a8cf

11 files changed

Lines changed: 26 additions & 193 deletions

File tree

‎Samples/REST Services/MIO/mio.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@
273273

274274
// URL for making calls to the NVIDIA optimizer service.
275275
//var optimizerUrl = 'https://api.nvcf.nvidia.com/v2/nvcf/exec/functions/4bb2668d-c877-4b89-aabf-1630ed9b32c3/versions/471b94dc-931e-4aa1-99f4-935f5f352737';
276-
var optimizerUrl = 'https://samples.azuremaps.com/api/optimizer'; // this is just demo data, use the real NVIDIA optimizer service
276+
var optimizerUrl = 'https://samples.azuremaps.com/api/Optimizer'; // this is just demo data, use the real NVIDIA optimizer service
277277

278278
// Bearer token for the NVIDIA optimizer service.
279-
var tokenResponse = await fetch('https://samples.azuremaps.com/api/GetMIOKey');
279+
var tokenResponse = await fetch('https://samples.azuremaps.com/api/OptimizerKey');
280280
var token = await tokenResponse.text();
281281

282282
// Initiate an request to the NVIDIA optimizer service.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Azure.Functions.Worker;
4+
5+
namespace SampleFunctions;
6+
7+
public class Elevation
8+
{
9+
[Function("Elevation")]
10+
public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
11+
{
12+
return new OkObjectResult("Welcome to Elevation Functions!");
13+
}
14+
}

‎Services/SampleFunctions/GetAzureMapsToken.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public class GetAzureMapsToken()
3535
];
3636

3737
[Function("GetAzureMapsToken")]
38-
public async Task<IActionResult> RunAsync(
39-
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
38+
public async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
4039
{
4140
// Check if the referer header is present and if the domain is allowed
4241
if (req.Headers.TryGetValue("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))

‎Services/SampleFunctions/GetBingMapsKey.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public class GetBingMapsKey()
1212
];
1313

1414
[Function("GetBingMapsKey")]
15-
public static IActionResult Run(
16-
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
15+
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
1716
{
1817
// Check if the referer header is present and if the domain is allowed
1918
if (req.Headers.TryGetValue("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))

‎Services/SampleFunctions/GetDataFromUrl.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public class GetDataFromUrl()
1414
private static readonly HttpClient _HttpClient = new();
1515

1616
[Function("GetDataFromUrl")]
17-
public static async Task<HttpResponseData> RunAsync(
18-
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
17+
public static async Task<HttpResponseData> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req)
1918
{
2019
// Check if the referer header is present and if the domain is allowed
2120
if (req.Headers.TryGetValues("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))

‎Services/SampleFunctions/GetGeolocation.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public static class GeolocationService
1818
private static readonly HttpClient HttpClient = new();
1919

2020
[Function("GetGeolocation")]
21-
public static async Task<IActionResult> RunAsync(
22-
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
21+
public static async Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
2322
{
2423
// Check if the referer header is present and if the domain is allowed
2524
if (req.Headers.TryGetValue("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
namespace SampleFunctions;
66

7-
public class GetMIOKey
7+
public class OptimizerKey
88
{
99
private static readonly string[] AllowedDomains = [
1010
"https://samples.azuremaps.com/",
1111
"http://localhost:58035/" // For local testing
1212
];
1313

14-
[Function("GetMIOKey")]
15-
public static IActionResult Run(
16-
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
14+
[Function("OptimizerKey")]
15+
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
1716
{
1817
// Check if the referer header is present and if the domain is allowed
1918
if (req.Headers.TryGetValue("Referer", out var referer) && AllowedDomains.Any(domain => referer.ToString().StartsWith(domain)))

‎Services/SampleFunctions/Properties/ServiceDependencies/azuremaps-restapi - Zip Deploy/appInsights1.arm.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
"contentVersion": "1.0.0.0",
5050
"resources": [
5151
{
52+
"kind": "web",
5253
"name": "azuremaps-restapi",
5354
"type": "microsoft.insights/components",
5455
"location": "[parameters('resourceLocation')]",
55-
"kind": "web",
5656
"properties": {},
5757
"apiVersion": "2015-05-01"
5858
}

‎Services/SampleFunctions/Properties/ServiceDependencies/azuremaps-restapi - Zip Deploy/profile.arm.json‎

Lines changed: 0 additions & 174 deletions
This file was deleted.

‎Services/SampleFunctions/Properties/launchSettings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"SampleFunctions": {
44
"commandName": "Project",
5-
"commandLineArgs": "--port 7273",
5+
"commandLineArgs": "--port 7231",
66
"launchBrowser": false
77
}
88
}

0 commit comments

Comments
 (0)