Updating the sample project
This commit is contained in:
Родитель
7f3cd883da
Коммит
de00b25180
|
@ -0,0 +1,63 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.4
|
||||
VisualStudioVersion = 15.0.26403.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleFunctionApp", "SampleFunctionApp\SampleFunctionApp.csproj", "{CB898665-1C9B-49C4-A1E8-1207289C67C4}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunctionApp", "FunctionApp\FunctionApp.csproj", "{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -11,10 +11,10 @@ Global
|
|||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CB898665-1C9B-49C4-A1E8-1207289C67C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CB898665-1C9B-49C4-A1E8-1207289C67C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CB898665-1C9B-49C4-A1E8-1207289C67C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CB898665-1C9B-49C4-A1E8-1207289C67C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0DB6AF7A-DD09-4412-AD46-CE6178D01F51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.0.1-alpha1-10692" />
|
||||
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="1.0.0-alpha1-10436" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,34 @@
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Extensions.Http;
|
||||
using Microsoft.Azure.WebJobs.Host;
|
||||
|
||||
namespace FunctionApp
|
||||
{
|
||||
public static class HttpTriggerCSharp
|
||||
{
|
||||
[FunctionName("HttpTriggerCSharp")]
|
||||
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
|
||||
{
|
||||
log.Info("C# HTTP trigger function processed a request.");
|
||||
|
||||
// parse query parameter
|
||||
string name = req.GetQueryNameValuePairs()
|
||||
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
|
||||
.Value;
|
||||
|
||||
// Get request body
|
||||
dynamic data = await req.Content.ReadAsAsync<object>();
|
||||
|
||||
// Set name to query string or body data
|
||||
name = name ?? data?.name;
|
||||
|
||||
return name == null
|
||||
? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
|
||||
: req.CreateResponse(HttpStatusCode.OK, "Hello " + name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{ "id": "c4c998a879cc4490950ed5c7caa13c82" }
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"IsEncrypted": true,
|
||||
"Values": {
|
||||
"AzureWebJobsStorage": ""
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using ImageResizer;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.ServiceBus.Messaging;
|
||||
|
||||
namespace SDKFuncs
|
||||
{
|
||||
public static class Functions
|
||||
{
|
||||
[FunctionName("ResizeImage")]
|
||||
public static void RunResizeImage(
|
||||
[BlobTrigger("sample-images/{name}")] Stream image, // input blob, large size
|
||||
[Blob("sample-images-sm/{name}", FileAccess.Write)] Stream imageSmall,
|
||||
[Blob("sample-images-md/{name}", FileAccess.Write)] Stream imageMedium) // output blobs
|
||||
{
|
||||
var imageBuilder = ImageResizer.ImageBuilder.Current;
|
||||
var size = imageDimensionsTable[ImageSize.Small];
|
||||
|
||||
imageBuilder.Build(
|
||||
image, imageSmall,
|
||||
new ResizeSettings(size.Item1, size.Item2, FitMode.Max, null), false);
|
||||
|
||||
image.Position = 0;
|
||||
size = imageDimensionsTable[ImageSize.Medium];
|
||||
|
||||
imageBuilder.Build(
|
||||
image, imageMedium,
|
||||
new ResizeSettings(size.Item1, size.Item2, FitMode.Max, null), false);
|
||||
}
|
||||
|
||||
public enum ImageSize
|
||||
{
|
||||
ExtraSmall, Small, Medium
|
||||
}
|
||||
|
||||
private static Dictionary<ImageSize, Tuple<int, int>> imageDimensionsTable = new Dictionary<ImageSize, Tuple<int, int>>()
|
||||
{
|
||||
{ ImageSize.ExtraSmall, Tuple.Create(320, 200) },
|
||||
{ ImageSize.Small, Tuple.Create(640, 400) },
|
||||
{ ImageSize.Medium, Tuple.Create(800, 600) }
|
||||
};
|
||||
|
||||
|
||||
[FunctionName("ServiceBus")]
|
||||
public static void RunServiceBus([ServiceBusTrigger("queue", "sub", AccessRights.Manage)] string message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[FunctionName("QueueFunc")]
|
||||
public static void RunQueue([QueueTrigger("queue1")] string message)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ImageResizer" version="4.0.5" />
|
||||
<PackageReference Include="Microsoft.Azure.KeyVault.Core" version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Azure.WebJobs" version="2.0.1-alpha1-10667" />
|
||||
<PackageReference Include="Microsoft.Azure.WebJobs.Core" version="2.0.1-alpha1-10667" />
|
||||
<PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.0.1-alpha1-10667" />
|
||||
<PackageReference Include="Microsoft.Data.Edm" version="5.6.4" />
|
||||
<PackageReference Include="Microsoft.Data.OData" version="5.6.4" />
|
||||
<PackageReference Include="Microsoft.Data.Services.Client" version="5.6.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" version="9.0.1" />
|
||||
<PackageReference Include="System.Spatial" version="5.6.4" />
|
||||
<PackageReference Include="WindowsAzure.Storage" version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.NET.Sdk.Functions" version="1.0.0-alpha1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="FunctionsSdkPath" value="..\src\Microsoft.NET.Sdk.Functions\bin\Release" />
|
||||
</packageSources>
|
||||
</configuration>
|
Загрузка…
Ссылка в новой задаче