Created dotnet2.0 Builder Image and Added /v2/specialized Endpoint to dotnet2.0 Envrionment (#1001)
This commit is contained in:
committed by
Ta-Ching Chen
parent
56fa8fe766
commit
4632269314
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Builder.Model
|
||||
{
|
||||
public class BuilderSettings
|
||||
{
|
||||
public string NugetSpecsFile { get; set; }
|
||||
public string DllExcludeFile { get; set; }
|
||||
public string BuildLogDirectory { get; set; }
|
||||
public string NugetPackageRegEx { get; set; }
|
||||
public string ExcludeDllRegEx { get; set; }
|
||||
public bool RunningOnwindows { get; set; }
|
||||
public string functionBodyFileName { get; set; }
|
||||
public string functionSpecFileName { get; set; }
|
||||
public string DllDirectory { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Builder.Model
|
||||
{
|
||||
public class ExcludeDll
|
||||
{
|
||||
public string dllName { get; set; }
|
||||
public string packageName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using Nancy;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
namespace Fission.DotNetCore.Api
|
||||
{
|
||||
public class FissionContext
|
||||
{
|
||||
public FissionContext(Dictionary<string, object> args, Logger logger, FissionHttpRequest request)
|
||||
{
|
||||
if (args == null) throw new ArgumentNullException(nameof(args));
|
||||
if (logger == null) throw new ArgumentNullException(nameof(logger));
|
||||
if (request == null) throw new ArgumentNullException(nameof(request));
|
||||
Arguments = args;
|
||||
Logger = logger;
|
||||
Request = request;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> Arguments { get; private set; }
|
||||
|
||||
public FissionHttpRequest Request { get; private set; }
|
||||
|
||||
public Logger Logger { get; private set; }
|
||||
|
||||
public static FissionContext Build(Request request, Logger logger)
|
||||
{
|
||||
return new FissionContext(((DynamicDictionary)request.Query).ToDictionary(),
|
||||
logger,
|
||||
new FissionHttpRequest(request));
|
||||
}
|
||||
|
||||
//this are curruntly dummy , not being implemented, just to pass compilation
|
||||
//actual execution is written in environment to use the app settings as there we need it
|
||||
public T GetSettings<T>(string relativePath)
|
||||
{
|
||||
//intentionaly doing it as these are just dummy methods not being called
|
||||
//but if tomorrow if we decide to give implementation for execution in build then we
|
||||
//need to implement it
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//this are curruntly dummy , not being implemented, just to pass compilation
|
||||
//actual execution is written in environment to use the app settings as there we need it
|
||||
private string GetSettingsJson(string relativePath)
|
||||
{
|
||||
//intentionaly doing it as these are just dummy methods not being called
|
||||
//but if tomorrow if we decide to give implementation for execution in build then we
|
||||
//need to implement it
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Logger
|
||||
{
|
||||
public void Write(Severity severity, string format, params object[] args)
|
||||
{
|
||||
Console.WriteLine($"{DateTime.Now.ToString("MM/dd/yy H:mm:ss zzz")} {severity}: " + format, args);
|
||||
}
|
||||
|
||||
public void WriteInfo(string format, params object[] args)
|
||||
{
|
||||
Write(Severity.Info, format, args);
|
||||
}
|
||||
|
||||
public void WriteWarning(string format, params object[] args)
|
||||
{
|
||||
Write(Severity.Warning, format, args);
|
||||
}
|
||||
|
||||
public void WriteError(string format, params object[] args)
|
||||
{
|
||||
Write(Severity.Error, format, args);
|
||||
}
|
||||
|
||||
public void WriteCritical(string format, params object[] args)
|
||||
{
|
||||
Write(Severity.Critical, format, args);
|
||||
}
|
||||
|
||||
public void WriteVerbose(string format, params object[] args)
|
||||
{
|
||||
Write(Severity.Verbose, format, args);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Severity
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Critical,
|
||||
Verbose
|
||||
}
|
||||
|
||||
public class FissionHttpRequest
|
||||
{
|
||||
private readonly Request _request;
|
||||
internal FissionHttpRequest(Request request)
|
||||
{
|
||||
if (request == null) throw new ArgumentNullException(nameof(request));
|
||||
_request = request;
|
||||
}
|
||||
|
||||
public Stream Body { get { return _request.Body; } }
|
||||
|
||||
public string BodyAsString()
|
||||
{
|
||||
int length = (int)_request.Body.Length;
|
||||
byte[] data = new byte[length];
|
||||
_request.Body.Read(data, 0, length);
|
||||
return Encoding.UTF8.GetString(data);
|
||||
}
|
||||
|
||||
public Dictionary<string, IEnumerable<string>> Headers
|
||||
{
|
||||
get
|
||||
{
|
||||
var headers = new Dictionary<string, IEnumerable<string>>();
|
||||
foreach (var kv in _request.Headers)
|
||||
{
|
||||
headers.Add(kv.Key, kv.Value);
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
|
||||
public X509Certificate Certificate { get { return _request.ClientCertificate; } }
|
||||
public string Url { get { return _request.Url.ToString(); } }
|
||||
public string Method { get { return _request.Method; } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using NugetWorker;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Builder.Model
|
||||
{
|
||||
public class FunctionSpecification
|
||||
{
|
||||
public FunctionSpecification()
|
||||
{
|
||||
this.libraries = new List<Library>();
|
||||
}
|
||||
public string functionName { get; set; }
|
||||
public List<Library> libraries { get; set; }
|
||||
public string hash { get; set; }
|
||||
public string certificatePath { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class Library
|
||||
{
|
||||
public Library()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Library(DllInfo dllInfo)
|
||||
{
|
||||
this.name = dllInfo.name;
|
||||
this.nugetPackage = dllInfo.rootPackage;
|
||||
this.path = dllInfo.path;
|
||||
}
|
||||
public string name { get; set; }
|
||||
//public string version { get; set; }
|
||||
public string path { get; set; }
|
||||
public string nugetPackage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Builder.Model
|
||||
{
|
||||
public class IncludeNuget
|
||||
{
|
||||
public string packageName { get; set; }
|
||||
public string version { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user