mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-20 17:24:00 -05:00
Add route to GetAzureFunctions request + cleanup (#1521)
* Add route to GetAzureFunctions request + cleanup * update comments * comments * Add comment
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Namespace.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Extensions.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Company.Namespace
|
||||
{
|
||||
public class ArtistsApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Function with basic name
|
||||
/// </summary>
|
||||
[FunctionName("WithName")]
|
||||
public IActionResult WithName([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "artists")] HttpRequest req)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private const string interpolated = "interpolated";
|
||||
|
||||
/// <summary>
|
||||
/// Function with interpolated string as name
|
||||
/// </summary>
|
||||
[FunctionName($"{interpolated}String")]
|
||||
public async IActionResult InterpolatedString([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "artists")] Artist body, HttpRequest req)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Namespace.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Extensions.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Namespace
|
||||
{
|
||||
public class AzureFunctionsRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests binding with a route specified
|
||||
/// </summary>
|
||||
[FunctionName("WithRoute")]
|
||||
public IActionResult WithRoute([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "withRoute")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private const string interpolated = "interpolated";
|
||||
/// <summary>
|
||||
/// Tests binding with a route specified using an interpolated string
|
||||
/// </summary>
|
||||
[FunctionName("InterpolatedString")]
|
||||
public IActionResult InterpolatedString([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = $"{interpolated}String")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with a route specified that has $'s on the beginning and end
|
||||
/// </summary>
|
||||
[FunctionName("WithDollarSigns")]
|
||||
public IActionResult WithDollarSigns([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "$withDollarSigns$")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with a route specified and no spaces between tokens
|
||||
/// </summary>
|
||||
[FunctionName("WithRouteNoSpaces")]
|
||||
public IActionResult WithRouteNoSpaces([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route="withRouteNoSpaces")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with a route specified and no spaces between tokens
|
||||
/// </summary>
|
||||
[FunctionName("WithRouteExtraSpaces")]
|
||||
public IActionResult WithRouteExtraSpaces([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "withRouteExtraSpaces")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with a null route specified
|
||||
/// </summary>
|
||||
[FunctionName("WithNullRoute")]
|
||||
public IActionResult WithNullRoute([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with a null route specified
|
||||
/// </summary>
|
||||
[FunctionName("NoRoute")]
|
||||
public IActionResult NoRoute([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests binding with an empty route specified
|
||||
/// </summary>
|
||||
[FunctionName("EmptyRoute")]
|
||||
public IActionResult EmptyRoute([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "")] HttpRequest req, [Sql("select * from [dbo].[table1]", CommandType = System.Data.CommandType.Text, ConnectionStringSetting = "SqlConnectionString")] IEnumerable<Object> result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user