Compare commits
3 Commits
f38afd75b8
...
1ee556eb4e
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ee556eb4e | |||
| 159bbf399c | |||
| d478291c6b |
@@ -1,7 +1,6 @@
|
|||||||
using AS1024.CommunityDocumentationPage.Models;
|
using AS1024.CommunityDocumentationPage.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using NetBox;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -31,7 +30,8 @@ namespace AS1024.CommunityDocumentationPage.Controllers
|
|||||||
return View(filtered);
|
return View(filtered);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<RouteTargets> ReadAPI(string token)
|
[NonAction]
|
||||||
|
private async Task<RouteTargets> ReadAPI(string token)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ namespace AS1024.CommunityDocumentationPage.Controllers
|
|||||||
client.DefaultRequestHeaders.Clear();
|
client.DefaultRequestHeaders.Clear();
|
||||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", token);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", token);
|
||||||
var result = await client.GetAsync("https://netbox.as1024.net/api/ipam/route-targets/");
|
var result = await client.GetAsync(BuildNetBoxURI());
|
||||||
var stringResult = await result.Content.ReadAsStringAsync();
|
var stringResult = await result.Content.ReadAsStringAsync();
|
||||||
return JsonConvert.DeserializeObject<RouteTargets>(stringResult);
|
return JsonConvert.DeserializeObject<RouteTargets>(stringResult);
|
||||||
} catch
|
} catch
|
||||||
@@ -48,6 +48,18 @@ namespace AS1024.CommunityDocumentationPage.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
protected Uri BuildNetBoxURI()
|
||||||
|
{
|
||||||
|
var endUrl = new UriBuilder();
|
||||||
|
|
||||||
|
endUrl.Path = "/api/ipam/route-targets";
|
||||||
|
endUrl.Host = Configuration["NetBoxHost"];
|
||||||
|
endUrl.Scheme = "https";
|
||||||
|
|
||||||
|
return endUrl.Uri;
|
||||||
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,5 +8,6 @@
|
|||||||
"APIKey": "",
|
"APIKey": "",
|
||||||
"ASN": "",
|
"ASN": "",
|
||||||
"NOCEmail": "",
|
"NOCEmail": "",
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"NetBoxHost" : ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,3 +26,4 @@ This web app must be configured with asppsettings.json with the following values
|
|||||||
|
|
||||||
- ``APIKey`` - This is a netbox API Key. We strongly recommend that you do this as a read only thing
|
- ``APIKey`` - This is a netbox API Key. We strongly recommend that you do this as a read only thing
|
||||||
- ``ASN`` - This is required, without it, the AS's will not display properly
|
- ``ASN`` - This is required, without it, the AS's will not display properly
|
||||||
|
- ``NOCEmail`` - This is to display for NOC E-Mail Inquries
|
||||||
Reference in New Issue
Block a user