From 1de47ba5ebca6c15839b81750ad8c3870e124e9e Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Fri, 12 Dec 2025 15:13:00 +0100 Subject: [PATCH 1/6] OpenTelekomCloud.Serverless.Function.Common.legacy removed --- doc/source/devguide/event_function/_index.rst | 8 +- .../devguide/event_function/handler.rst | 25 ++-- .../devguide/event_function/sampleProject.rst | 13 +- libraries/libraries.sln | 15 -- ...erverless.Function.Common.TestUtils.csproj | 9 +- .../FunctionSerializerAttribute.cs | 12 -- .../IFunctionContext.cs | 131 ------------------ .../IFunctionLogger.cs | 26 ---- .../IFunctionSerializer.cs | 11 -- ...d.Serverless.Function.Common.legacy.csproj | 24 ---- .../README.md | 7 - .../FunctionSerializerAttribute.cs | 6 +- .../IFunctionContext.cs | 6 +- .../IFunctionLogger.cs | 6 +- .../IFunctionSerializer.cs | 5 +- ...komCloud.Serverless.Function.Common.csproj | 16 ++- releasenotes/v1.0.1.md | 12 -- releasenotes/v2.0.0.md | 14 ++ samples-doc/event-apig/src/event_apig.csproj | 7 +- samples-doc/event-cts/src/event_cts.csproj | 7 +- .../src/event_s3obs_thumbnail.csproj | 10 +- .../event-timer/src/event_timer.csproj | 7 +- samples-doc/invoke-fg/src/invoke_fg.csproj | 12 -- samples-doc/sdk-ecs/src/sdk_ecs.csproj | 8 +- .../src/serialization_simple.csproj | 7 +- samples-doc/simple/src/simple.csproj | 6 +- 26 files changed, 74 insertions(+), 336 deletions(-) delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/FunctionSerializerAttribute.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionContext.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionLogger.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionSerializer.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/OpenTelekomCloud.Serverless.Function.Common.legacy.csproj delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/README.md delete mode 100644 releasenotes/v1.0.1.md create mode 100644 releasenotes/v2.0.0.md diff --git a/doc/source/devguide/event_function/_index.rst b/doc/source/devguide/event_function/_index.rst index 0afa0ee..6ff3221 100644 --- a/doc/source/devguide/event_function/_index.rst +++ b/doc/source/devguide/event_function/_index.rst @@ -26,13 +26,7 @@ Core libraries This library provides the Context structure, which contains the runtime information of the function and provides - methods to obtain the runtime information. (**For .NET 6.0 and later versions**) - -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.legacy` - - This library provides the Context structure, which contains - the runtime information of the function and provides - methods to obtain the runtime information. (**prior to .NET 6.0 versions**) + methods to obtain the runtime information. Event libraries ^^^^^^^^^^^^^^^^ diff --git a/doc/source/devguide/event_function/handler.rst b/doc/source/devguide/event_function/handler.rst index 32ae024..3898778 100644 --- a/doc/source/devguide/event_function/handler.rst +++ b/doc/source/devguide/event_function/handler.rst @@ -27,22 +27,13 @@ C# function syntax: - **Function name**: user-defined function name. The name must be consistent with that you define when creating a function. -- **User-defined parameter**: parameter defined for the function. The type - must be defined as **Stream**. +- **User-defined parameter**: parameter defined for the function. + The type must be defined as **Stream**. - **context**: runtime information provided for executing the function. - .. note:: - - - For target frameworks prior to .NET 6.0, - Package **OpenTelekomCloud.Serverless.Function.Common.legacy** has to be referenced and - imported with **using HC.Serverless.Function.Common** - - for target frameworks .NET 6.0 and later versions, - the **OpenTelekomCloud.Serverless.Function.Common** package as to be referenced and - imported with **using OpenTelekomCloud.Serverless.Function.Common** - - - For details about the IFunctionContext object, see the :doc:`Context <./context>` description. + For details about the IFunctionContext object, see the + :doc:`Context <./context>` description. When creating a C# function, you need to define a method as the handler of the function. @@ -86,6 +77,14 @@ Example: This method is needed for compilation only and is not invoked by FunctionGraph. +.. note:: + + For C# versions + + - prior to .NET 6.0, classes from ``HC.Serverless.Function.Common`` must be used + + - .NET 6.0 and above, classes from ``OpenTelekomCloud.Serverless.Function.Common`` must be used. + Function Handler ---------------- diff --git a/doc/source/devguide/event_function/sampleProject.rst b/doc/source/devguide/event_function/sampleProject.rst index eb1abcb..40d03ec 100644 --- a/doc/source/devguide/event_function/sampleProject.rst +++ b/doc/source/devguide/event_function/sampleProject.rst @@ -164,14 +164,10 @@ C# project file - + - - - - `, @@ -245,13 +238,13 @@ Example directory of a C# project package .. code-block:: text :caption: Directory structure for prior to .NET 6.0 - simple_event_timer_netcoreapp3.1.zip # Example project package + simple_event_timer_netcoreapp3.1.zip # Example project package ├─ simple.deps.json # File generated after project compilation ├─ simple.dll # File generated after project compilation ├─ simple.pdb # File generated after project compilation ├─ simple.runtimeconfig.json # File generated after project compilation ├─ handler.txt # Help file, which can be directly used - └─ HC.Serverless.Function.Common.legacy.dll # .dll file provided by this runtime package + └─ HC.Serverless.Function.Common.legacy.dll # .dll file provided by this runtime package This deployment zip will be created automatically diff --git a/libraries/libraries.sln b/libraries/libraries.sln index 5298494..23adb36 100644 --- a/libraries/libraries.sln +++ b/libraries/libraries.sln @@ -25,8 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.Timer", "src\OpenTelekomCloud.Serverless.Function.Events.Timer\OpenTelekomCloud.Serverless.Function.Events.Timer.csproj", "{665A292A-B7E3-4037-866F-EE4C3CDBE995}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.legacy", "src\OpenTelekomCloud.Serverless.Function.Common.legacy\OpenTelekomCloud.Serverless.Function.Common.legacy.csproj", "{8A611667-7880-42BD-9E74-DEA25876194C}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer", "src\OpenTelekomCloud.Serverless.Function.Common.JsonSerializer\OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj", "{98047583-27B7-4EB0-B343-F44C46569A4E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.TestUtils", "src\OpenTelekomCloud.Serverless.Function.Common.TestUtils\OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj", "{4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}" @@ -161,18 +159,6 @@ Global {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x64.Build.0 = Release|Any CPU {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x86.ActiveCfg = Release|Any CPU {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x86.Build.0 = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|x64.ActiveCfg = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|x64.Build.0 = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|x86.ActiveCfg = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Debug|x86.Build.0 = Debug|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|Any CPU.Build.0 = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|x64.ActiveCfg = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|x64.Build.0 = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|x86.ActiveCfg = Release|Any CPU - {8A611667-7880-42BD-9E74-DEA25876194C}.Release|x86.Build.0 = Release|Any CPU {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -212,7 +198,6 @@ Global {1EA3E765-FD97-476D-98EC-39022F6F1BB8} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} {40BC9DCF-896A-4521-B208-E945461676AF} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} {665A292A-B7E3-4037-866F-EE4C3CDBE995} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {8A611667-7880-42BD-9E74-DEA25876194C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} {98047583-27B7-4EB0-B343-F44C46569A4E} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} EndGlobalSection diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj index b3e056d..f6a55a7 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj @@ -3,18 +3,11 @@ - + - - - - - - OpenTelekomCloud FunctionGraph .NET Core support - Common Test Utils. diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/FunctionSerializerAttribute.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/FunctionSerializerAttribute.cs deleted file mode 100644 index 87fa288..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/FunctionSerializerAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace HC.Serverless.Function.Common -{ - using System; - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Method, Inherited = false)] - public sealed class FunctionSerializerAttribute : Attribute - { - public Type SerializerType { set; get; } - - public FunctionSerializerAttribute(Type serializerType) => this.SerializerType = serializerType; - } -} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionContext.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionContext.cs deleted file mode 100644 index 76bf086..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionContext.cs +++ /dev/null @@ -1,131 +0,0 @@ -namespace HC.Serverless.Function.Common -{ - /// - /// The Context interface allows functions to obtain the function execution context, - /// such as the AccessKey/SecretKey delegated by the user, - /// the current request ID, - /// the memory space allocated for function execution, - /// the number of CPUs, and so on. - /// - public interface IFunctionContext - { - /// - /// Gets the request ID associated with the request. - /// - /// This is the same ID returned to the client that called invoke(). This ID - /// is reused for retries on the same request. - /// - /// - string RequestId { get; } - - /// - /// Project Id - /// - string ProjectId { get; } - - /// - /// Package name of the function - /// - string PackageName { get; } - - /// - /// Name of the function - /// - string FunctionName { get; } - - /// - /// Function version - /// - string FunctionVersion { get; } - - /// - /// Allocated memory. - /// - int MemoryLimitInMb { get; } - - /// - /// CPU resources used by the function. - /// - int CpuNumber { get; } - - /// - /// Obtains the AccessKey (valid for 24 hours) with an agency. If you use this method, you need to configure an agency for the function. - /// - /// - /// NOTE: - /// FunctionGraph has stopped maintaining the getAccessKey API in the Runtime SDK. You cannot use this API to obtain a temporary AK. - /// - /// - string AccessKey { get; } - - /// - /// Obtains the SecretKey (valid for 24 hours) with an agency. If you use this method, you need to configure an agency for the function. - /// - /// - /// NOTE: - /// FunctionGraph has stopped maintaining the getAccessKey API in the Runtime SDK. You cannot use this API to obtain a temporary AK. - /// - /// - string SecretKey { get; } - - /// - /// Obtains the SecurityAccessKey (valid for 24 hours) with an agency. - /// If you use this method, you need to configure an agency for the function. - /// - string SecurityAccessKey { get; } - - /// - /// Obtains the SecuritySecretKey (valid for 24 hours) with an agency. - /// If you use this method, you need to configure an agency for the function. - /// - string SecuritySecretKey { get; } - - /// - /// Obtains the SecurityToken (valid for 24 hours) with an agency. - /// If you use this method, you need to configure an agency for the function. - /// - string SecurityToken { get; } - - /// - /// //TODO - /// - string WorkflowID { get; } - - /// - /// //TODO - /// - string WorkflowRunID { get; } - /// - /// //TODO - /// - string WorkflowStateID { get; } - - - /// - /// Obtains the Token (valid for 24 hours) with an agency. - /// If you use this method, you need to configure an agency for the function. - /// - - string Token { get; } - - - /// - /// get environment variable - /// - /// name of environment variable to get - /// default value - /// value of environment variable - string GetUserData(string key, string defvalue = ""); - - /// - /// The remaining running time of the function - /// - int RemainingTimeInMilliSeconds { get; } - - /// - /// Obtains the logger method provided by the context. - /// By default, information such as the time and request ID is output. - /// - IFunctionLogger Logger { get; } - } -} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionLogger.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionLogger.cs deleted file mode 100644 index cd05593..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionLogger.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace HC.Serverless.Function.Common -{ - public interface IFunctionLogger - { - void Log(string message); - - /// - /// Records user input logs - /// This method will output the content to the standard output in the format of "time-request ID-output content". - /// - /// For example: - /// - /// 2017-10-25T09:10:03.328Z 473d369d-101a-445e-a7a8-315cca788f86 test log output - /// - /// Usage of format: - /// - /// var logger = context.Logger; - /// logger.Logf("Hello CSharp runtime test({0})", version); - /// - /// - /// - /// format - /// arguments - void Logf(string format, params object[] args); - } -} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionSerializer.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionSerializer.cs deleted file mode 100644 index f4e95a9..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/IFunctionSerializer.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace HC.Serverless.Function.Common -{ - using System.IO; - public interface IFunctionSerializer - { - T Deserialize(Stream ins); - - Stream Serialize(T value); - } -} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/OpenTelekomCloud.Serverless.Function.Common.legacy.csproj b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/OpenTelekomCloud.Serverless.Function.Common.legacy.csproj deleted file mode 100644 index e4f7cb2..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/OpenTelekomCloud.Serverless.Function.Common.legacy.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - OpenTelekomCloud FunctionGraph .NET Core support - Common package (.NETCoreApp v3.1). - - HC.Serverless.Function.Common - HC.Serverless.Function.Common - - HC.Serverless.Function.Common - - OpenTelekomCloud.Serverless.Function.Common.legacy - OpenTelekomCloud;OTC;FunctionGraph - README.md - - - - - - - - \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/README.md b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/README.md deleted file mode 100644 index 6fa04d4..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# OpenTelekomCloud.Serverless.Function.Common.legacy - -This package contains interfaces and classes that can be helpful when running your .NET code on the OpenTelekomCloud platform. - -Package has to be used for .NET Frameworks below .NET6.0. - -For .Net versions prior to Version 6.0 the namespace prefix is HC. has to be used instead of OpenTelekomCloud. \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs index 8b17292..7b5b85c 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs @@ -1,4 +1,8 @@ -namespace OpenTelekomCloud.Serverless.Function.Common +#if NET6_0_OR_GREATER +namespace OpenTelekomCloud.Serverless.Function.Common +#else +namespace HC.Serverless.Function.Common +#endif { using System; diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs index cc68079..3333c90 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs @@ -1,4 +1,8 @@ -namespace OpenTelekomCloud.Serverless.Function.Common +#if NET6_0_OR_GREATER +namespace OpenTelekomCloud.Serverless.Function.Common +#else +namespace HC.Serverless.Function.Common +#endif { /// /// The Context interface allows functions to obtain the function execution context, diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs index 12d1c98..6bd1b25 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs @@ -1,4 +1,8 @@ -namespace OpenTelekomCloud.Serverless.Function.Common +#if NET6_0_OR_GREATER +namespace OpenTelekomCloud.Serverless.Function.Common +#else +namespace HC.Serverless.Function.Common +#endif { public interface IFunctionLogger { diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs index 52c989c..0fcb665 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs @@ -1,5 +1,8 @@ - +#if NET6_0_OR_GREATER namespace OpenTelekomCloud.Serverless.Function.Common +#else +namespace HC.Serverless.Function.Common +#endif { using System.IO; public interface IFunctionSerializer diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj index 07e27be..4a39839 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj +++ b/libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj @@ -8,13 +8,23 @@ OpenTelekomCloud.Serverless.Function.Common OpenTelekomCloud.Serverless.Function.Common - - OpenTelekomCloud.Serverless.Function.Common - OpenTelekomCloud.Serverless.Function.Common OpenTelekomCloud;OTC;FunctionGraph README.md + + OpenTelekomCloud.Serverless.Function.Common + OpenTelekomCloud.Serverless.Function.Common + OpenTelekomCloud.Serverless.Function.Common + + + + HC.Serverless.Function.Common + HC.Serverless.Function.Common + HC.Serverless.Function.Common + + \ No newline at end of file diff --git a/releasenotes/v1.0.1.md b/releasenotes/v1.0.1.md deleted file mode 100644 index 5dd14a0..0000000 --- a/releasenotes/v1.0.1.md +++ /dev/null @@ -1,12 +0,0 @@ -# v1.0.1 - -## What's changed - -### Changes - -- [Issue #1](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/1): `APIGResponse` added to `APIGEvent`. - -### BREAKING CHANGES: - -- [Issue #2](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/2) : `OpenTelekomCloud.Serverless.Function.Events.DDS` removed as DDS is deprecated. -- [Issue #3](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/3) : `APIGEvent` data type for `Headers` attribute changed to `Dictionary`. diff --git a/releasenotes/v2.0.0.md b/releasenotes/v2.0.0.md new file mode 100644 index 0000000..e150406 --- /dev/null +++ b/releasenotes/v2.0.0.md @@ -0,0 +1,14 @@ +# v2.0.0 + +## What's changed + +### Changes + +- [Issue #1](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/1): `APIGResponse` added to `APIGEvent`. +- `OpenTelekomCloud.Serverless.Function.Common.TestUtils` added. Provides utility classes for XUnit tests, E.g. TestContextSimple. + +### BREAKING CHANGES: + +- library `OpenTelekomCloud.Serverless.Function.Common.legacy` removed, now part of `OpenTelekomCloud.Serverless.Function.Common` +- [Issue #2](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/2) : `OpenTelekomCloud.Serverless.Function.Events.DDS` removed as DDS is deprecated. +- [Issue #3](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/3) : `APIGEvent`, support added for not predefined properties in `APIGRequestHeaders`, `APIGResponseHeaders`, `QueryStringParameters`, `PathParameters` diff --git a/samples-doc/event-apig/src/event_apig.csproj b/samples-doc/event-apig/src/event_apig.csproj index df5e849..04576c1 100644 --- a/samples-doc/event-apig/src/event_apig.csproj +++ b/samples-doc/event-apig/src/event_apig.csproj @@ -2,15 +2,10 @@ - + - - - - diff --git a/samples-doc/event-cts/src/event_cts.csproj b/samples-doc/event-cts/src/event_cts.csproj index 68f4ddc..4ddd51d 100644 --- a/samples-doc/event-cts/src/event_cts.csproj +++ b/samples-doc/event-cts/src/event_cts.csproj @@ -2,15 +2,10 @@ - + - - - - diff --git a/samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj b/samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj index d610fa8..7a0128e 100644 --- a/samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj +++ b/samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj @@ -36,16 +36,16 @@ + + + + + - - - - - diff --git a/samples-doc/event-timer/src/event_timer.csproj b/samples-doc/event-timer/src/event_timer.csproj index beceb80..9088f00 100644 --- a/samples-doc/event-timer/src/event_timer.csproj +++ b/samples-doc/event-timer/src/event_timer.csproj @@ -2,15 +2,10 @@ - + - - - - diff --git a/samples-doc/invoke-fg/src/invoke_fg.csproj b/samples-doc/invoke-fg/src/invoke_fg.csproj index ccb1765..b53d325 100644 --- a/samples-doc/invoke-fg/src/invoke_fg.csproj +++ b/samples-doc/invoke-fg/src/invoke_fg.csproj @@ -13,22 +13,10 @@ - Exe - - diff --git a/samples-doc/sdk-ecs/src/sdk_ecs.csproj b/samples-doc/sdk-ecs/src/sdk_ecs.csproj index 5b9d17d..9b9a3f9 100644 --- a/samples-doc/sdk-ecs/src/sdk_ecs.csproj +++ b/samples-doc/sdk-ecs/src/sdk_ecs.csproj @@ -2,17 +2,11 @@ - + - - - - - diff --git a/samples-doc/serialization_simple/src/serialization_simple.csproj b/samples-doc/serialization_simple/src/serialization_simple.csproj index b3f3c68..21b31dc 100644 --- a/samples-doc/serialization_simple/src/serialization_simple.csproj +++ b/samples-doc/serialization_simple/src/serialization_simple.csproj @@ -2,15 +2,10 @@ - + - - - - diff --git a/samples-doc/simple/src/simple.csproj b/samples-doc/simple/src/simple.csproj index 9388ece..45ef5b9 100644 --- a/samples-doc/simple/src/simple.csproj +++ b/samples-doc/simple/src/simple.csproj @@ -2,12 +2,8 @@ - + - - - - \ No newline at end of file From 6ba310528a7e35f0321cc9847dc57ecebf38edad Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Tue, 16 Dec 2025 12:47:22 +0100 Subject: [PATCH 2/6] refactorings for v2.0.0 --- .github/workflows/createRelease.yml | 2 +- buildtools/build.proj | 6 +- buildtools/common.props | 2 +- clean.sh | 7 + doc/doc8.ini | 2 + doc/source/devguide/event_function/_index.rst | 33 +- .../devguide/event_function/context.rst | 4 +- .../devguide/event_function/handler.rst | 6 +- doc/source/devguide/event_function/json.rst | 4 +- .../devguide/event_function/sampleProject.rst | 4 +- .../trigger_events/trigger_cts_event.rst | 3 + .../trigger_dms4kafka_event.rst | 4 +- .../trigger_events/trigger_obs_event.rst | 4 +- .../devguide/http_function/minimalWebApi.rst | 2 +- doc/source/samples/obssamples/_index.rst | 2 +- .../_index.rst | 62 ++-- .../thumbnail.drawio.svg | 0 .../sdksamples/ecs/startstopreboot.rst | 6 +- .../README.md | 2 +- .../src/IFunctionSerializer.cs | 23 ++ .../src}/JsonSerializer.cs | 14 + ...less.Function.Common.JsonSerializer.csproj | 0 .../README.md | 0 .../src}/JsonUtils.cs | 2 +- ...erverless.Function.Common.TestUtils.csproj | 2 +- .../src/ResourceUtils.cs | 70 ++++ .../src}/TestContextSimple.cs | 0 .../src}/TestFunctionLogger.cs | 0 .../README.md | 0 .../src}/FunctionSerializerAttribute.cs | 0 .../src}/IFunctionContext.cs | 0 .../src}/IFunctionLogger.cs | 0 .../src}/IFunctionSerializer.cs | 0 ...komCloud.Serverless.Function.Common.csproj | 0 .../README.md | 0 .../src}/APIGEvent.cs | 104 +++++- ...oud.Serverless.Function.Events.APIG.csproj | 0 .../test/APIGTest.cs | 44 +++ ...erverless.Function.Events.APIG.test.csproj | 33 ++ .../test/resources/apig_base64_event.json | 29 ++ .../test/resources/apig_base64_response.json | 6 + .../test/resources/apig_event.json | 29 ++ .../resources/apig_event_with_params.json | 39 +++ .../test/resources/apig_response.json | 6 + .../README.md | 0 .../src}/CTSEvent.cs | 74 +++- ...loud.Serverless.Function.Events.CTS.csproj | 0 .../test/CTSTest.cs | 86 +++++ ...Serverless.Function.Events.CTS.test.csproj | 33 ++ .../test/resources/cts_createFunction.json | 34 ++ .../test/resources/cts_event.json | 25 ++ .../test/resources/cts_login.json | 30 ++ .../README.md | 0 .../src}/DMS4KafkaEvent.cs | 0 ...erverless.Function.Events.DMS4Kafka.csproj | 0 .../test/DMS4KafkaTest.cs | 32 ++ ...less.Function.Events.DMS4Kafka.test.csproj | 33 ++ .../test/resources/dms4kafka_event.json | 0 .../README.md | 0 .../src}/LTSEvent.cs | 0 ...loud.Serverless.Function.Events.LTS.csproj | 0 .../test/LTSTest.cs | 31 ++ ...Serverless.Function.Events.LTS.test.csproj | 33 ++ .../test/resources/lts_event.json | 5 + .../README.md | 0 .../src}/OBSS3Event.cs | 0 ...ud.Serverless.Function.Events.OBSS3.csproj | 0 .../test/OBSS3Test.cs | 31 ++ ...rverless.Function.Events.OBSS3.test.csproj | 33 ++ .../test/resources/obss3_event.json | 0 .../README.md | 0 .../src}/OpenSourceKafkaEvent.cs | 0 ...ess.Function.Events.OpenSourceKafka.csproj | 0 .../test/OpenSourceKafkaTest.cs | 31 ++ ...unction.Events.OpenSourceKafka.test.csproj | 33 ++ .../resources/opensource_kafka_event.json | 19 ++ .../README.md | 0 ...loud.Serverless.Function.Events.SMN.csproj | 0 .../src}/SMNEvent.cs | 0 ...Serverless.Function.Events.SMN.test.csproj | 33 ++ .../test/SMNTest.cs | 31 ++ .../test/resources/smn_event.json | 21 ++ .../README.md | 0 ...ud.Serverless.Function.Events.Timer.csproj | 0 .../src}/TimerEvent.cs | 0 ...rverless.Function.Events.Timer.test.csproj | 33 ++ .../test/TimerTest.cs | 31 ++ .../test/resources/timer_event.json | 7 + libraries/libraries.sln | 319 ++++++++---------- .../IFunctionSerializer.cs | 10 - .../Utils.cs | 26 -- ...ud.Serverless.Function.Common.Utils.csproj | 27 -- .../README.md | 3 - releasenotes/v2.0.0.md | 14 +- samples-doc/event-apig/src/Program.cs | 17 +- samples-doc/event-apig/test/ProgramTest.cs | 15 +- .../event-apig/test/event_apig.test.csproj | 11 +- .../resources/cts_createFunction.json | 34 ++ samples-doc/event-cts/test/ProgramTest.cs | 5 +- .../event-cts/test/event_cts.test.csproj | 7 + .../Makefile | 0 .../README.md | 0 .../event-obss3-thumbnail.sln} | 0 .../invokeFunction.py | 0 .../src/Program.cs | 0 .../src/event_obss3_thumbnail.csproj} | 0 .../event-obss3-thumbnail/src/handler.txt | 1 + .../terraform/main.tf | 0 .../terraform/net6.tfvars | 0 .../terraform/outputlocal.tf | 0 .../terraform/provider.tf | 0 .../terraform/setupTFvars.sh | 0 .../terraform/variables.tf | 0 .../test/resources/otc.jpg | Bin .../testUpload.cmd | 0 .../testUpload.sh | 0 .../event-obss3/resources/obss3_event.json | 32 ++ .../event-s3obs-thumbnail/src/handler.txt | 1 - samples-doc/http_minimalWebAPI/README.md | 3 + samples-doc/samples-doc.sln | 4 +- tox.ini | 1 - 121 files changed, 1457 insertions(+), 348 deletions(-) create mode 100644 clean.sh create mode 100644 doc/doc8.ini rename doc/source/samples/obssamples/{event-s3obs-thumbnail => event-obss3-thumbnail}/_index.rst (62%) rename doc/source/samples/obssamples/{event-s3obs-thumbnail => event-obss3-thumbnail}/thumbnail.drawio.svg (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md (60%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/IFunctionSerializer.cs rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer => OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src}/JsonSerializer.cs (67%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer => OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src}/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Common.TestUtils/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.Utils => OpenTelekomCloud.Serverless.Function.Common.TestUtils/src}/JsonUtils.cs (91%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.TestUtils => OpenTelekomCloud.Serverless.Function.Common.TestUtils/src}/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj (87%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/ResourceUtils.cs rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.TestUtils => OpenTelekomCloud.Serverless.Function.Common.TestUtils/src}/TestContextSimple.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common.TestUtils => OpenTelekomCloud.Serverless.Function.Common.TestUtils/src}/TestFunctionLogger.cs (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Common/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common => OpenTelekomCloud.Serverless.Function.Common/src}/FunctionSerializerAttribute.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common => OpenTelekomCloud.Serverless.Function.Common/src}/IFunctionContext.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common => OpenTelekomCloud.Serverless.Function.Common/src}/IFunctionLogger.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common => OpenTelekomCloud.Serverless.Function.Common/src}/IFunctionSerializer.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Common => OpenTelekomCloud.Serverless.Function.Common/src}/OpenTelekomCloud.Serverless.Function.Common.csproj (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.APIG/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.APIG => OpenTelekomCloud.Serverless.Function.Events.APIG/src}/APIGEvent.cs (82%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.APIG => OpenTelekomCloud.Serverless.Function.Events.APIG/src}/OpenTelekomCloud.Serverless.Function.Events.APIG.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/APIGTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/OpenTelekomCloud.Serverless.Function.Events.APIG.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_event.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_response.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event_with_params.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_response.json rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.CTS/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.CTS => OpenTelekomCloud.Serverless.Function.Events.CTS/src}/CTSEvent.cs (68%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.CTS => OpenTelekomCloud.Serverless.Function.Events.CTS/src}/OpenTelekomCloud.Serverless.Function.Events.CTS.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/CTSTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/OpenTelekomCloud.Serverless.Function.Events.CTS.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_createFunction.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_event.json create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_login.json rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka => OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src}/DMS4KafkaEvent.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka => OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src}/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/DMS4KafkaTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test.csproj rename samples-doc/event-kafka/resources/kafka_event.json => libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/resources/dms4kafka_event.json (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.LTS/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.LTS => OpenTelekomCloud.Serverless.Function.Events.LTS/src}/LTSEvent.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.LTS => OpenTelekomCloud.Serverless.Function.Events.LTS/src}/OpenTelekomCloud.Serverless.Function.Events.LTS.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/LTSTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/OpenTelekomCloud.Serverless.Function.Events.LTS.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/resources/lts_event.json rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.OBSS3/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.OBSS3 => OpenTelekomCloud.Serverless.Function.Events.OBSS3/src}/OBSS3Event.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.OBSS3 => OpenTelekomCloud.Serverless.Function.Events.OBSS3/src}/OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OBSS3Test.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OpenTelekomCloud.Serverless.Function.Events.OBSS3.test.csproj rename samples-doc/event-s3obs/resources/s3obs_event.json => libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/resources/obss3_event.json (100%) rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka => OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src}/OpenSourceKafkaEvent.cs (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka => OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src}/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenSourceKafkaTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/resources/opensource_kafka_event.json rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.SMN/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.SMN => OpenTelekomCloud.Serverless.Function.Events.SMN/src}/OpenTelekomCloud.Serverless.Function.Events.SMN.csproj (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.SMN => OpenTelekomCloud.Serverless.Function.Events.SMN/src}/SMNEvent.cs (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/OpenTelekomCloud.Serverless.Function.Events.SMN.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/SMNTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/resources/smn_event.json rename libraries/{src => }/OpenTelekomCloud.Serverless.Function.Events.Timer/README.md (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.Timer => OpenTelekomCloud.Serverless.Function.Events.Timer/src}/OpenTelekomCloud.Serverless.Function.Events.Timer.csproj (100%) rename libraries/{src/OpenTelekomCloud.Serverless.Function.Events.Timer => OpenTelekomCloud.Serverless.Function.Events.Timer/src}/TimerEvent.cs (100%) create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/OpenTelekomCloud.Serverless.Function.Events.Timer.test.csproj create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/TimerTest.cs create mode 100644 libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/resources/timer_event.json delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/IFunctionSerializer.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/Utils.cs delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/OpenTelekomCloud.Serverless.Function.Common.Utils.csproj delete mode 100644 libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/README.md create mode 100644 samples-doc/event-cts/resources/cts_createFunction.json rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/Makefile (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/README.md (100%) rename samples-doc/{event-s3obs-thumbnail/event-s3obs-thumbnail.sln => event-obss3-thumbnail/event-obss3-thumbnail.sln} (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/invokeFunction.py (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/src/Program.cs (100%) rename samples-doc/{event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj => event-obss3-thumbnail/src/event_obss3_thumbnail.csproj} (100%) create mode 100644 samples-doc/event-obss3-thumbnail/src/handler.txt rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/main.tf (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/net6.tfvars (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/outputlocal.tf (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/provider.tf (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/setupTFvars.sh (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/terraform/variables.tf (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/test/resources/otc.jpg (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/testUpload.cmd (100%) rename samples-doc/{event-s3obs-thumbnail => event-obss3-thumbnail}/testUpload.sh (100%) create mode 100644 samples-doc/event-obss3/resources/obss3_event.json delete mode 100644 samples-doc/event-s3obs-thumbnail/src/handler.txt diff --git a/.github/workflows/createRelease.yml b/.github/workflows/createRelease.yml index c1de80f..f7515c1 100644 --- a/.github/workflows/createRelease.yml +++ b/.github/workflows/createRelease.yml @@ -45,7 +45,7 @@ jobs: - name: Build Package run: | cd libraries - dotnet pack --output nupkgs --include-symbols --include-source /p:ContinuousIntegrationBuild=true --configuration Release + dotnet pack --output nupkgs --include-source /p:ContinuousIntegrationBuild=true --configuration Release - name: Publish Package run: | diff --git a/buildtools/build.proj b/buildtools/build.proj index b119a52..a3e5b60 100644 --- a/buildtools/build.proj +++ b/buildtools/build.proj @@ -27,7 +27,7 @@ DependsOnTargets="build-project-packages"> - + @@ -41,8 +41,8 @@ WorkingDirectory="../libraries" /> + Command="dotnet pack --no-build --configuration $(Configuration) --include-source --verbosity detailed --output $(MSBuildThisFileDirectory)../Deployment/nuget-packages" + WorkingDirectory="../libraries/%(LibraryName.FileName)/src" /> diff --git a/buildtools/common.props b/buildtools/common.props index 3b970fc..23cd07a 100644 --- a/buildtools/common.props +++ b/buildtools/common.props @@ -120,7 +120,7 @@ - + diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..f641fc5 --- /dev/null +++ b/clean.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +find ./libraries -iname "bin" | xargs rm -rf +find ./libraries -iname "obj" | xargs rm -rf +find ./samples-doc -iname "bin" | xargs rm -rf +find ./samples-doc -iname "obj" | xargs rm -rf +find ./samples-doc -iname "*.zip" | xargs rm -rf \ No newline at end of file diff --git a/doc/doc8.ini b/doc/doc8.ini new file mode 100644 index 0000000..882336a --- /dev/null +++ b/doc/doc8.ini @@ -0,0 +1,2 @@ +[doc8] +ignore=D001 \ No newline at end of file diff --git a/doc/source/devguide/event_function/_index.rst b/doc/source/devguide/event_function/_index.rst index 6ff3221..82be632 100644 --- a/doc/source/devguide/event_function/_index.rst +++ b/doc/source/devguide/event_function/_index.rst @@ -22,47 +22,62 @@ to help you develop C# event functions. Core libraries ^^^^^^^^^^^^^^^^ -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common ` This library provides the Context structure, which contains the runtime information of the function and provides methods to obtain the runtime information. +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.JsonSerializer ` + + This library contains a custom IFunctionSerializer implementation + which uses Newtonsoft.Json to serialize/deserialize .NET types + in FunctionGraph. + + Event libraries ^^^^^^^^^^^^^^^^ -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.APIG ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.APIG ` Event library for API Gateway events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.CTS ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.CTS ` Event library for Cloud Trace Service (CTS) timer events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.DMS4Kafka ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.DMS4Kafka ` Event library for Distributed Messaging Service for Kafka events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.LTS ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.LTS ` Event library for Log Tank Service (LTS) events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OBSS3 ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OBSS3 ` Event library for Object Storage Service (OBS) S3 events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OOpenSourceKafka ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OpenSourceKafka ` Event library for Open Source Kafka events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.SMN ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.SMN ` Event library for Simple Message Notification (SMN) events. -- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.Timer ` +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.Timer ` Event library for Timer events. +Test libraries +^^^^^^^^^^^^^^^^ + +- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common ` + + This library provides utility methods for unit testing + C# functions developed for FunctionGraph. + Additional libraries ^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/source/devguide/event_function/context.rst b/doc/source/devguide/event_function/context.rst index 6ecca32..f8c96e7 100644 --- a/doc/source/devguide/event_function/context.rst +++ b/doc/source/devguide/event_function/context.rst @@ -12,7 +12,7 @@ the invocation, function, and execution environment. Context interface ----------------- -The interface methods of :github_repo_master:`IFunctionContext ` interface are: +The interface methods of :github_repo_master:`IFunctionContext ` interface are: .. list-table:: **Table 1** Context interface methods :widths: 10 25 @@ -109,7 +109,7 @@ The interface methods of :github_repo_master:`IFunctionContext ` interface through the context object. +FunctionGraph provides a :github_repo_master:`IFunctionLogger ` interface through the context object. The logger can be accessed by using the **Logger** property of the context object. diff --git a/doc/source/devguide/event_function/handler.rst b/doc/source/devguide/event_function/handler.rst index 3898778..fdf80ba 100644 --- a/doc/source/devguide/event_function/handler.rst +++ b/doc/source/devguide/event_function/handler.rst @@ -119,7 +119,7 @@ function, execution environment, and so on. The context is of type ``IFunctionContext`` and is the second argument of the handler function. -* :github_repo_master:`IFunctionContext ` +* :github_repo_master:`IFunctionContext ` Logging in FunctionGraph @@ -140,8 +140,8 @@ see :doc:`Using the FunctionGraph context object to retrieve function informatio Accessing environment ^^^^^^^^^^^^^^^^^^^^^ -Environment variables defined in ``OpenTelekomCloud`` -> -``Configuration`` -> ``Environment Variables`` can be accessed using: +Environment variables defined in ``OpenTelekomCloud`` > +``Configuration`` > ``Environment Variables`` can be accessed using: .. code-block:: java diff --git a/doc/source/devguide/event_function/json.rst b/doc/source/devguide/event_function/json.rst index 9145094..40f5519 100644 --- a/doc/source/devguide/event_function/json.rst +++ b/doc/source/devguide/event_function/json.rst @@ -92,13 +92,13 @@ Create function Upload code ^^^^^^^^^^^^^^^^^^^^ -Use **Upload** -> **Local ZIP** and upload *serialization_simple_net6.0.zip* +Use **Upload** > **Local ZIP** and upload *serialization_simple_net6.0.zip* from previous step. Configure function ^^^^^^^^^^^^^^^^^^^^ -* In **Configuration** -> **Basic Settings** -> **Handler**: +* In **Configuration** > **Basic Settings** > **Handler**: set value to name as defined in **handler.txt** Test the function diff --git a/doc/source/devguide/event_function/sampleProject.rst b/doc/source/devguide/event_function/sampleProject.rst index 40d03ec..e4aa5ed 100644 --- a/doc/source/devguide/event_function/sampleProject.rst +++ b/doc/source/devguide/event_function/sampleProject.rst @@ -285,13 +285,13 @@ Create function Upload code ^^^^^^^^^^^^^^^^^^^^ -Use **Upload** -> **Local ZIP** and upload *simple_net6.0.zip* +Use **Upload** > **Local ZIP** and upload *simple_net6.0.zip* from previous step. Configure function ^^^^^^^^^^^^^^^^^^^^ -* In **Configuration** -> **Basic Settings** -> **Handler**: +* In **Configuration** > **Basic Settings** > **Handler**: set value to name as defined in **handler.txt** Test the function diff --git a/doc/source/devguide/event_function/trigger_events/trigger_cts_event.rst b/doc/source/devguide/event_function/trigger_events/trigger_cts_event.rst index a946d77..244ed3b 100644 --- a/doc/source/devguide/event_function/trigger_events/trigger_cts_event.rst +++ b/doc/source/devguide/event_function/trigger_events/trigger_cts_event.rst @@ -84,6 +84,9 @@ Parameter description - String - Status of the event +For full description of all parameters see +`CTS Event Reference `_. + Example ------- diff --git a/doc/source/devguide/event_function/trigger_events/trigger_dms4kafka_event.rst b/doc/source/devguide/event_function/trigger_events/trigger_dms4kafka_event.rst index daf6bcc..2c2c656 100644 --- a/doc/source/devguide/event_function/trigger_events/trigger_dms4kafka_event.rst +++ b/doc/source/devguide/event_function/trigger_events/trigger_dms4kafka_event.rst @@ -14,9 +14,9 @@ For details, see Kafka example event ------------------- -.. literalinclude:: /../../samples-doc/event-kafka/resources/kafka_event.json +.. literalinclude:: /../../samples-doc/event-dms4kafka/resources/dms4kafka_event.json :language: json - :caption: :github_repo_master:`kafka_event.json ` + :caption: :github_repo_master:`dms4kafka_event.json ` Parameter description diff --git a/doc/source/devguide/event_function/trigger_events/trigger_obs_event.rst b/doc/source/devguide/event_function/trigger_events/trigger_obs_event.rst index aa6e92e..2d28c33 100644 --- a/doc/source/devguide/event_function/trigger_events/trigger_obs_event.rst +++ b/doc/source/devguide/event_function/trigger_events/trigger_obs_event.rst @@ -15,9 +15,9 @@ Hints OBS example event ----------------- -.. literalinclude:: /../../samples-doc/event-s3obs/resources/s3obs_event.json +.. literalinclude:: /../../samples-doc/event-obss3/resources/obss3_event.json :language: json - :caption: :github_repo_master:`s3obs_event.json ` + :caption: :github_repo_master:`obss3_event.json ` Parameter description diff --git a/doc/source/devguide/http_function/minimalWebApi.rst b/doc/source/devguide/http_function/minimalWebApi.rst index 5b7dca3..06fd507 100644 --- a/doc/source/devguide/http_function/minimalWebApi.rst +++ b/doc/source/devguide/http_function/minimalWebApi.rst @@ -134,7 +134,7 @@ Create function Upload code ^^^^^^^^^^^^^^^^^^^^ -Use **Upload** -> **Local ZIP** and upload the generated ZIP file from step 1 +Use **Upload** > **Local ZIP** and upload the generated ZIP file from step 1 ($(MSBuildProjectName)_net8.0.zip). diff --git a/doc/source/samples/obssamples/_index.rst b/doc/source/samples/obssamples/_index.rst index 24f1854..25e4e92 100644 --- a/doc/source/samples/obssamples/_index.rst +++ b/doc/source/samples/obssamples/_index.rst @@ -4,4 +4,4 @@ OBS (S3) Samples .. toctree:: :maxdepth: 1 - S3 Event Thumbnail + S3 Event Thumbnail diff --git a/doc/source/samples/obssamples/event-s3obs-thumbnail/_index.rst b/doc/source/samples/obssamples/event-obss3-thumbnail/_index.rst similarity index 62% rename from doc/source/samples/obssamples/event-s3obs-thumbnail/_index.rst rename to doc/source/samples/obssamples/event-obss3-thumbnail/_index.rst index 072173b..10103e9 100644 --- a/doc/source/samples/obssamples/event-s3obs-thumbnail/_index.rst +++ b/doc/source/samples/obssamples/event-obss3-thumbnail/_index.rst @@ -24,7 +24,7 @@ Source ------ Source for this sample can be found in: -:github_repo_master:`/samples-doc/event-s3obs-thumbnail`. +:github_repo_master:`/samples-doc/event-obss3-thumbnail`. Deployment ---------- @@ -32,38 +32,38 @@ This sample can be deployed using Terraform, see :ref:`ref_terraform_setup` for setup details. Terraform deployment scripts can be found in: -:github_repo_master:`/samples-doc/event-s3obs-thumbnail/terraform ` +:github_repo_master:`/samples-doc/event-obss3-thumbnail/terraform ` +../Makefile +~~~~~~~~~~~ -.. tabs:: +Adapt file *Makefile* variables according to your needs. - .. tab:: ../Makefile +.. literalinclude:: /../../samples-doc/event-obss3-thumbnail/Makefile + :language: make + :caption: /Makefile - Adapt file *Makefile* variables according to your needs. - - .. literalinclude:: /../../samples-doc/event-s3obs-thumbnail/Makefile - :language: make - :caption: /Makefile +main.tf +~~~~~~~ - .. tab:: main.tf +This files contains all resources to be created for this sample. - This files contains all resources to be created for this sample. +.. literalinclude:: /../../samples-doc/event-obss3-thumbnail/terraform/main.tf + :language: terraform + :caption: /main.tf - .. literalinclude:: /../../samples-doc/event-s3obs-thumbnail/terraform/main.tf - :language: terraform - :caption: /main.tf +provider.tf +~~~~~~~~~~~ - .. tab:: provider.tf +This file contains the terraform provider configuration. - This file contains the terraform provider configuration. - - .. note:: +.. note:: - Check especially the **backend "s3"** configuration for **bucket** and **key**. + Check especially the **backend "s3"** configuration for **bucket** and **key**. - .. literalinclude:: /../../samples-doc/event-s3obs-thumbnail/terraform/provider.tf - :language: terraform - :caption: /provider.tf +.. literalinclude:: /../../samples-doc/event-obss3-thumbnail/terraform/provider.tf + :language: terraform + :caption: /provider.tf To deploy use following command in directory where *Makefile* is located: @@ -84,7 +84,7 @@ To deploy use following command in directory where *Makefile* is located: permission errors like: **`Error fetching object otc.jpg from bucket - csharp-doc-sample-event-s3obs-thumbnail-csharp-images: + csharp-doc-sample-event-obss3-thumbnail-csharp-images: One or more errors occurred. (Access Denied)`** References @@ -94,7 +94,7 @@ In this sample the `AWS SDK for .Net `_ is used to access OBS service: .. code-block:: xml - :caption: :github_repo_master:`event_s3obs_thumbnail.csproj ` + :caption: :github_repo_master:`event_obss3_thumbnail.csproj ` @@ -108,7 +108,7 @@ Upload image file to source bucket ---------------------------------- Linux/Ubuntu -^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~ .. note:: @@ -118,13 +118,13 @@ Linux/Ubuntu To upload image to source bucket, following script an be used for Ubuntu users: -.. literalinclude:: /../../samples-doc/event-s3obs-thumbnail/testUpload.sh +.. literalinclude:: /../../samples-doc/event-obss3-thumbnail/testUpload.sh :language: bash - :caption: /samples-doc/event-s3obs-thumbnail/testUpload.sh + :caption: /samples-doc/event-obss3-thumbnail/testUpload.sh Microsoft Windows -^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~ .. note:: For *Microsoft Windows*, see `OBS Browser+ `_ @@ -132,7 +132,7 @@ Microsoft Windows Alternatives (unsupported) -^^^^^^^^^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Huawei obsutil """""""""""""" @@ -142,7 +142,7 @@ Huawei obsutil Huawei *obsutil* is available for Windows, Linux and Mac from Huawei, see: `obsutil Introduction `_ -.. literalinclude:: /../../samples-doc/event-s3obs-thumbnail/testUpload.cmd +.. literalinclude:: /../../samples-doc/event-obss3-thumbnail/testUpload.cmd :language: bash - :caption: /samples-doc/event-s3obs-thumbnail/testUpload.cmd + :caption: /samples-doc/event-obss3-thumbnail/testUpload.cmd diff --git a/doc/source/samples/obssamples/event-s3obs-thumbnail/thumbnail.drawio.svg b/doc/source/samples/obssamples/event-obss3-thumbnail/thumbnail.drawio.svg similarity index 100% rename from doc/source/samples/obssamples/event-s3obs-thumbnail/thumbnail.drawio.svg rename to doc/source/samples/obssamples/event-obss3-thumbnail/thumbnail.drawio.svg diff --git a/doc/source/samples/sdksamples/ecs/startstopreboot.rst b/doc/source/samples/sdksamples/ecs/startstopreboot.rst index ff9ade2..0d470c8 100644 --- a/doc/source/samples/sdksamples/ecs/startstopreboot.rst +++ b/doc/source/samples/sdksamples/ecs/startstopreboot.rst @@ -95,16 +95,16 @@ Create function Upload code ******************* -Use **Upload** -> **Local ZIP** and upload *start_ecs_net6.0.zip* +Use **Upload** > **Local ZIP** and upload *start_ecs_net6.0.zip* from previous step. Configure function ******************* -* In **Configuration** -> **Basic Settings** -> **Handler**: +* In **Configuration** > **Basic Settings** > **Handler**: set value to name as defined in **handler.txt** -* In **Configuration** -> **Environment Variables** add following variables: +* In **Configuration** > **Environment Variables** add following variables: .. list-table:: Environment variables :widths: 20 20 25 diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md similarity index 60% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md index f0d1ce4..7d15ba6 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/README.md @@ -1,3 +1,3 @@ # OpenTelekomCloud.Serverless.Function.Common.JsonSerializer -This package contains a custom IFunctionSerializer implementation which uses NewtosoftJson to serialize/deserialize .NET types in FunctionGraph. \ No newline at end of file +This package contains a custom IFunctionSerializer implementation which uses Newtonsoft.Json to serialize/deserialize .NET types in FunctionGraph. \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/IFunctionSerializer.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/IFunctionSerializer.cs new file mode 100644 index 0000000..b99bba3 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/IFunctionSerializer.cs @@ -0,0 +1,23 @@ +namespace OpenTelekomCloud.Serverless.Function.Common +{ + using System.IO; + /// + /// Function Serializer Interface + /// + public interface IFunctionSerializer + { + + /// + /// Deserialize from stream + /// + T Deserialize(Stream ins); + + /// + /// Serialize to stream + /// + /// + /// + /// + Stream Serialize(T value); + } +} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/JsonSerializer.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/JsonSerializer.cs similarity index 67% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/JsonSerializer.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/JsonSerializer.cs index 180eb76..d8fc275 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/JsonSerializer.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/JsonSerializer.cs @@ -6,6 +6,13 @@ using System.Text; public class JsonSerializer : IFunctionSerializer { + /// + /// Deserialize from stream + /// + /// + /// + /// + /// public T Deserialize(Stream ins) { try @@ -25,6 +32,13 @@ public T Deserialize(Stream ins) } } + /// + /// Serialize to stream + /// + /// + /// + /// + /// public Stream Serialize(T value) { try diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/JsonUtils.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/JsonUtils.cs similarity index 91% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/JsonUtils.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/JsonUtils.cs index dda0c2c..1b0244e 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/JsonUtils.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/JsonUtils.cs @@ -1,4 +1,4 @@ -namespace OpenTelekomCloud.Serverless.Function.Common.Utils +namespace OpenTelekomCloud.Serverless.Function.Common.TestUtils { using System; using System.IO; diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj similarity index 87% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj index f6a55a7..6bf497a 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj @@ -5,7 +5,7 @@ - + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/ResourceUtils.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/ResourceUtils.cs new file mode 100644 index 0000000..8a3eae0 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/ResourceUtils.cs @@ -0,0 +1,70 @@ + +namespace OpenTelekomCloud.Serverless.Function.Common.TestUtils +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Reflection; + + /// + /// Utility methods to access embedded resources in test assemblies + /// + public static class ResourceUtils + { + /// + /// Get embedded resource stream from assembly + /// + public static Stream GetResourceStream(this Assembly assembly, string resourceFolder, string resourceFileName) + { + + string[] nameParts = assembly.FullName.Split(','); + + string resourceName = nameParts[0] + "." + resourceFolder + "." + resourceFileName; + + var resources = new List(assembly.GetManifestResourceNames()); + if (resources.Contains(resourceName)) + return assembly.GetManifestResourceStream(resourceName); + else + return null; + } + + /// + /// Get embedded resource content as string from assembly + /// + public static string GetResourceAsString(this Assembly assembly, string folder, string fileName) + { + string fileContent; + using (StreamReader sr = new StreamReader(GetResourceStream(assembly, folder, fileName))) + { + fileContent = sr.ReadToEnd(); + } + return fileContent; + } + + /// + /// Get embedded resource stream from type's assembly + /// + public static Stream GetResourceStream(this Type type, string resourceFolder, string resourceFileName) + { + var assembly = type.GetTypeInfo().Assembly; + return assembly.GetResourceStream(resourceFolder, resourceFileName); + } + + /// + /// Get embedded resource content as string from type's assembly + /// + public static string GetResourceAsString(this Type type, string folder, string fileName) + { + var assembly = type.GetTypeInfo().Assembly; + return assembly.GetResourceAsString(folder, fileName); + } + } + + /// + /// Exception for ResourceUtils errors + /// + public class ResourceUtilsException : Exception + { + public ResourceUtilsException(string message) : base(message) { } + } +} \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/TestContextSimple.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/TestContextSimple.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/TestFunctionLogger.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/TestFunctionLogger.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Common/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Common/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/FunctionSerializerAttribute.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/FunctionSerializerAttribute.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common/src/FunctionSerializerAttribute.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionContext.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionContext.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionSerializer.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionSerializer.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionSerializer.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/OpenTelekomCloud.Serverless.Function.Common.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Common/OpenTelekomCloud.Serverless.Function.Common.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Common/src/OpenTelekomCloud.Serverless.Function.Common.csproj diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/APIGEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/src/APIGEvent.cs similarity index 82% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/APIGEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/src/APIGEvent.cs index c98fadc..06c2a72 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/APIGEvent.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/src/APIGEvent.cs @@ -28,6 +28,24 @@ public class APIGEvent [JsonProperty("body", NullValueHandling = NullValueHandling.Ignore)] public string Body { get; set; } + + /// + /// Get the request body as string, decoding from Base64 if necessary + /// + /// + public string GetBodyAsString() + { + if (this.IsBase64Encoded) + { + byte[] data = System.Convert.FromBase64String(this.Body); + return System.Text.Encoding.UTF8.GetString(data); + } + else + { + return this.Body; + } + } + /// /// Request information, including the API gateway configuration, request ID, authentication information, and source. /// @@ -90,6 +108,9 @@ public override string ToString() } } + /// + /// Request headers + /// public class APIGRequestHeaders { /// @@ -188,7 +209,12 @@ public class APIGRequestHeaders [JsonExtensionData] public IDictionary _additionalHeaders; - public void setAdditionalHeader(string key, string value) + /// + /// Add additional header key/value pair + /// + /// + /// + public void addAdditionalHeader(string key, string value) { if (this._additionalHeaders == null) { @@ -198,6 +224,20 @@ public void setAdditionalHeader(string key, string value) this._additionalHeaders.Add(key, new JValue(value)); } + /// + /// Remove additional header by key + /// + /// + /// + public bool removeAdditionalHeader(string key) + { + if (this._additionalHeaders != null && this._additionalHeaders.ContainsKey(key)) + { + return this._additionalHeaders.Remove(key); + } + return false; + } + /// /// Get additional header by key /// @@ -235,6 +275,9 @@ public override string ToString() } + /// + /// Request context information + /// public class RequestContext { /// @@ -256,6 +299,9 @@ public class RequestContext public string Stage { get; set; } } + /// + /// Query strings configured in APIG and their actual values + /// public class QueryStringParameters { [JsonProperty("responseType", NullValueHandling = NullValueHandling.Ignore)] @@ -264,6 +310,11 @@ public class QueryStringParameters [JsonExtensionData] public IDictionary _parameters; + /// + /// Get query parameter by key + /// + /// + /// public string getParameter(string key) { if (this._parameters != null && this._parameters.ContainsKey(key)) @@ -274,6 +325,10 @@ public string getParameter(string key) return null; } + /// + /// Get all query parameter keys + /// + /// public List getParameterKeys() { if (this._parameters != null) @@ -287,7 +342,9 @@ public List getParameterKeys() } - + /// + /// Path parameters configured in APIG and their actual values + /// public class PathParameters { [JsonExtensionData] @@ -315,9 +372,15 @@ public string[] getParameters() } + /// + /// API Gateway (APIG) Response object + /// public class APIGResponse { + /// + /// Constructor setting default IsBase64Encoded to true + /// public APIGResponse() { this.IsBase64Encoded = true; @@ -352,19 +415,29 @@ public APIGResponse() public class APIGResponseHeaders { + /// + /// Constructor setting default Content-Type to application/json + /// public APIGResponseHeaders() { this.ContentType = "application/json"; } + /// + /// Content-Type header + /// [JsonProperty("Content-Type", NullValueHandling = NullValueHandling.Ignore)] - public string ContentType { get; set; } [JsonExtensionData] public IDictionary _additionalHeaders; - public void setAdditionalHeader(string key, string value) + /// + /// Add additional header key/value pair + /// + /// + /// + public void addAdditionalHeader(string key, string value) { if (this._additionalHeaders == null) { @@ -374,6 +447,11 @@ public void setAdditionalHeader(string key, string value) this._additionalHeaders.Add(key, new JValue(value)); } + /// + /// Get additional header by key + /// + /// + /// public string getAdditionalHeader(string key) { if (this._additionalHeaders != null && this._additionalHeaders.ContainsKey(key)) @@ -384,6 +462,10 @@ public string getAdditionalHeader(string key) return null; } + /// + /// Get all additional header keys + /// + /// public List getAdditionalHeaderKeys() { if (this._additionalHeaders != null) @@ -394,6 +476,20 @@ public List getAdditionalHeaderKeys() return new List(); } + /// + /// Remove additional header by key + /// + /// + /// + public bool removeAdditionalHeader(string key) + { + if (this._additionalHeaders != null && this._additionalHeaders.ContainsKey(key)) + { + return this._additionalHeaders.Remove(key); + } + return false; + } + } } diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/OpenTelekomCloud.Serverless.Function.Events.APIG.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/src/OpenTelekomCloud.Serverless.Function.Events.APIG.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG/OpenTelekomCloud.Serverless.Function.Events.APIG.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/src/OpenTelekomCloud.Serverless.Function.Events.APIG.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/APIGTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/APIGTest.cs new file mode 100644 index 0000000..72e2454 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/APIGTest.cs @@ -0,0 +1,44 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.APIG; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_APIGEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "apig_base64_event.json"); + + APIGEvent apigEvent = serializer.Deserialize(jsonStream); + + Console.WriteLine("APIG Event: " + apigEvent.ToString()); + } + + + [Fact] + public void Test_APIGResponse() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "apig_response.json"); + + APIGResponse apigResponse = serializer.Deserialize(jsonStream); + + Console.WriteLine("APIGResponse Event: " + apigResponse.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/OpenTelekomCloud.Serverless.Function.Events.APIG.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/OpenTelekomCloud.Serverless.Function.Events.APIG.test.csproj new file mode 100644 index 0000000..5629930 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/OpenTelekomCloud.Serverless.Function.Events.APIG.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_event.json new file mode 100644 index 0000000..48b3ed5 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_event.json @@ -0,0 +1,29 @@ +{ + "body": "eyJuYW1lIjogIk9wZW5UZWxla29tQ2xvdWQifQ==", + "requestContext": { + "apiId": "bc1dcffd-aa35-474d-897c-d53425a4c08e", + "requestId": "11cdcdcf33949dc6d722640a13091c77", + "stage": "RELEASE" + }, + "queryStringParameters": { + "responseType": "html" + }, + "httpMethod": "GET", + "pathParameters": {}, + "headers": { + "accept-language": "q=0.5,en-US;q=0.3,en;q=0.2", + "accept-encoding": "gzip, deflate, br", + "x-forwarded-port": "443", + "x-forwarded-for": "103.218.216.98", + "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", + "upgrade-insecure-requests": "1", + "host": "host", + "x-forwarded-proto": "https", + "pragma": "no-cache", + "cache-control": "no-cache", + "x-real-ip": "103.218.216.98", + "user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0" + }, + "path": "/", + "isBase64Encoded": true +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_response.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_response.json new file mode 100644 index 0000000..3fb657f --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_base64_response.json @@ -0,0 +1,6 @@ +{ + "body": "SGVsbG8gT3BlblRlbGVrb21DbG91ZA==", + "headers": { "Content-Type": "application/json" }, + "statusCode": 200, + "isBase64Encoded": true +} diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event.json new file mode 100644 index 0000000..b066225 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event.json @@ -0,0 +1,29 @@ +{ + "body": "{\"name\": \"OpenTelekomCloud\"}", + "requestContext": { + "apiId": "bc1dcffd-aa35-474d-897c-d53425a4c08e", + "requestId": "11cdcdcf33949dc6d722640a13091c77", + "stage": "RELEASE" + }, + "queryStringParameters": { + "responseType": "html" + }, + "httpMethod": "GET", + "pathParameters": {}, + "headers": { + "accept-language": "q=0.5,en-US;q=0.3,en;q=0.2", + "accept-encoding": "gzip, deflate, br", + "x-forwarded-port": "443", + "x-forwarded-for": "103.218.216.98", + "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", + "upgrade-insecure-requests": "1", + "host": "host", + "x-forwarded-proto": "https", + "pragma": "no-cache", + "cache-control": "no-cache", + "x-real-ip": "103.218.216.98", + "user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0" + }, + "path": "/", + "isBase64Encoded": false +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event_with_params.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event_with_params.json new file mode 100644 index 0000000..cc15aff --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_event_with_params.json @@ -0,0 +1,39 @@ +{ +"requestContext": { +"requestId": "a31d3d70415214292fa8b2cade9b4538", +"apiId": "caf65eeb83a44b98a6264626007a73d4", +"stage": "RELEASE" +}, +"headers": { +"sec-ch-ua-platform": "\"Windows\"", +"upgrade-insecure-requests": "1", +"x-real-ip": "62.156.151.12", +"x-forwarded-host": "dde39b6334e34bbabed439eccfd29e7b.apic.eu-de.otc.t-systems.com", +"sec-fetch-site": "none", +"sec-fetch-mode": "navigate", +"sec-fetch-user": "?1", +"sec-fetch-dest": "document", +"accept-encoding": "gzip, deflate, br, zstd", +"priority": "u=0, i", +"accept-language": "en-US,en;q=0.9,de-DE;q=0.8,de;q=0.7", +"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36", +"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", +"x-request-id": "a31d3d70415214292fa8b2cade9b4538", +"x-forwarded-port": "443", +"x-forwarded-proto": "https", +"x-forwarded-for": "62.156.151.12", +"sec-ch-ua": "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\"", +"host": "dde39b6334e34bbabed439eccfd29e7b.apic.eu-de.otc.t-systems.com", +"sec-ch-ua-mobile": "?0" +}, +"httpMethod": "GET", +"pathParameters": { +"": "helloWorld/Test" +}, +"queryStringParameters": { +"name": "2" +}, +"body": "", +"isBase64Encoded": true, +"path": "/PathParameterTest/helloWorld/Test" +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_response.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_response.json new file mode 100644 index 0000000..e4ca9ab --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.APIG/test/resources/apig_response.json @@ -0,0 +1,6 @@ +{ + "body": "Hello OpenTelekomCloud", + "headers": { "Content-Type": "application/json" }, + "statusCode": 200, + "isBase64Encoded": false +} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/CTSEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/src/CTSEvent.cs similarity index 68% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/CTSEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/src/CTSEvent.cs index a8b7c82..626722c 100644 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/CTSEvent.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/src/CTSEvent.cs @@ -108,17 +108,89 @@ public class Cts public string TraceId { get; set; } /// - /// Status of the event + /// Status of the trace (e.g. normal) /// [JsonProperty("trace_status", NullValueHandling = NullValueHandling.Ignore)] public string TraceStatus { get; set; } + + /// + /// Trace rating (e.g., normal) + /// + [JsonProperty("trace_rating", NullValueHandling = NullValueHandling.Ignore)] + public string TraceRating { get; set; } + + /// + /// API version + /// + [JsonProperty("api_version", NullValueHandling = NullValueHandling.Ignore)] + public string ApiVersion { get; set; } + + /// + /// Message + /// + [JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)] + public string Message { get; set; } + + /// + /// Source IP address + /// + [JsonProperty("source_ip", NullValueHandling = NullValueHandling.Ignore)] + public string SourceIp { get; set; } + + /// + /// Domain ID + /// + [JsonProperty("domain_id", NullValueHandling = NullValueHandling.Ignore)] + public string DomainId { get; set; } + + /// + /// Project ID + /// + [JsonProperty("project_id", NullValueHandling = NullValueHandling.Ignore)] + public string ProjectId { get; set; } + + /// + /// Indicates whether the event is read-only + /// + [JsonProperty("read_only", NullValueHandling = NullValueHandling.Ignore)] + public bool ReadOnly { get; set; } + + /// + /// ID of the operation (ex. CreateFunction) + /// + [JsonProperty("operation_id", NullValueHandling = NullValueHandling.Ignore)] + public string OperationId { get; set; } + + /// + /// ID of the resource account + /// + [JsonProperty("resource_account_id", NullValueHandling = NullValueHandling.Ignore)] + public string ResourceAccountId { get; set; } + + /// + /// Event type (e.g. global) + /// + [JsonProperty("event_type", NullValueHandling = NullValueHandling.Ignore)] + public string EventType { get; set; } + + // [JsonProperty("tracker_name", NullValueHandling = NullValueHandling.Ignore)] + // public string TrackerName { get; set; } + + [JsonExtensionData] + public IDictionary _properties; } public class Domain { + /// + /// Domain name + /// [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] public string Name { get; set; } + /// + /// Domain ID + /// [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] public string Id { get; set; } } diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/OpenTelekomCloud.Serverless.Function.Events.CTS.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/src/OpenTelekomCloud.Serverless.Function.Events.CTS.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS/OpenTelekomCloud.Serverless.Function.Events.CTS.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/src/OpenTelekomCloud.Serverless.Function.Events.CTS.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/CTSTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/CTSTest.cs new file mode 100644 index 0000000..271fb3b --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/CTSTest.cs @@ -0,0 +1,86 @@ +namespace test +{ + + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.CTS; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_CreateFunction() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "cts_createFunction.json"); + // string json = typeof(UnitTest1).GetResourceAsString("resources", "cts_createFunction.json"); + + // CTSEvent ctsEvent = serializer.Deserialize(new MemoryStream(Encoding.UTF8.GetBytes(json))); + CTSEvent ctsEvent = serializer.Deserialize(jsonStream); + + Console.WriteLine(ctsEvent.Cts.Message); + + if (ctsEvent.Cts._properties != null) + { + + IDictionary p = ctsEvent.Cts._properties; + + bool success = p.TryGetValue("tracker_name", out JToken? trackerNameToken); + if (success && trackerNameToken != null) + { + string trackerName = trackerNameToken.ToString(); + Console.WriteLine("Tracker Name: " + trackerName); + } + else + { + Console.WriteLine("Tracker Name not found in additional properties."); + } + + + } + + } + + + [Fact] + public void Test_Login() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "cts_login.json"); + + CTSEvent ctsEvent = serializer.Deserialize(jsonStream); + + Console.WriteLine(ctsEvent.Cts.Message); + + if (ctsEvent.Cts._properties != null) + { + + IDictionary p = ctsEvent.Cts._properties; + + bool success = p.TryGetValue("tracker_name", out JToken? trackerNameToken); + if (success && trackerNameToken != null) + { + string trackerName = trackerNameToken.ToString(); + Console.WriteLine("Tracker Name: " + trackerName); + } + else + { + Console.WriteLine("Tracker Name not found in additional properties."); + } + + + } + + } + } +} diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/OpenTelekomCloud.Serverless.Function.Events.CTS.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/OpenTelekomCloud.Serverless.Function.Events.CTS.test.csproj new file mode 100644 index 0000000..0581b9e --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/OpenTelekomCloud.Serverless.Function.Events.CTS.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_createFunction.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_createFunction.json new file mode 100644 index 0000000..7aaef48 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_createFunction.json @@ -0,0 +1,34 @@ +{ + "cts": { + "request": {}, + "trace_id": "f828ab77-d993-11f0-b09f-35adcfa25f3b", + "code": 0, + "trace_name": "createFunction", + "resource_type": "Functions", + "trace_rating": "normal", + "api_version": "", + "message": "POST /v2/d52e41d2434941b194ce3f91b1b12f8a/fgs/functions, create function[test4]", + "source_ip": "62.156.151.4", + "domain_id": "e51dfca1c18747919f6c16af2721f35d", + "service_type": "FunctionGraph", + "trace_type": "ConsoleAction", + "project_id": "d52e41d2434941b194ce3f91b1b12f8a", + "read_only": false, + "response": {}, + "resource_id": "test4", + "trace_status": "normal", + "operation_id": "CreateFunction", + "resource_account_id": "", + "time": 1765788999507, + "resource_name": "test4", + "record_time": 1765788999507, + "user": { + "domain": { + "name": "USERDOMAINNAME", + "id": "USERDOMAINID" + }, + "name": "USERNAME", + "id": "USERID" + } + } +} diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_event.json new file mode 100644 index 0000000..f25edec --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_event.json @@ -0,0 +1,25 @@ +{ + "cts": { + "time": 1529996047, + "user": { + "name": "userName", + "id": "5b726c4fbfd84821ba866bafaaf56aax", + "domain": { + "name": "domainName", + "id": "b2b3853af40448fcb9e40dxj89505ba" + } + }, + "request": {}, + "response": {}, + "code": 204, + "service_type": "FunctionGraph", + "resource_type": "graph", + "resource_name": "workflow-2be1", + "resource_id": "urn:fgs:region:projectId:graph:workflow-2be1", + "trace_name": "deleteGraph", + "trace_type": "ConsoleAction", + "record_time": 1529996047, + "trace_id": "69be64a7-0233-11e8-82e4-e5d37911193e", + "trace_status": "normal" + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_login.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_login.json new file mode 100644 index 0000000..aa7e535 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.CTS/test/resources/cts_login.json @@ -0,0 +1,30 @@ +{ + "cts": { + "trace_id": "b394d958-d990-11f0-91ec-f9a8f9ca8a51", + "code": 302, + "trace_name": "login", + "resource_type": "user", + "trace_rating": "normal", + "message": "{\"login\":{\"mode\":\"password\",\"user_type\":\"iam user\",\"login_protect\":{\"status\":\"off\"}}}", + "source_ip": "62.156.151.4", + "domain_id": "e51dfca1c18747919f6c16af2721f35d", + "trace_type": "ConsoleAction", + "service_type": "IAM", + "event_type": "global", + "project_id": "ae050143781c4ab6a130522e5f2d30c1", + "read_only": false, + "resource_id": "e14aed517380466cac2d109877a5ac6b", + "tracker_name": "system", + "time": "1765788999507", + "resource_name": "USERNAME", + "user": { + "domain": { + "name": "USERDOMAINNAME", + "id": "e51dfca1c18747919f6c16af2721f35d" + }, + "name": "USERNAME", + "id": "USERID" + }, + "record_time": "1765788999507" + } +} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/DMS4KafkaEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src/DMS4KafkaEvent.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/DMS4KafkaEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src/DMS4KafkaEvent.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/DMS4KafkaTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/DMS4KafkaTest.cs new file mode 100644 index 0000000..7dd3633 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/DMS4KafkaTest.cs @@ -0,0 +1,32 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_DMS4KafkaEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "dms4kafka_event.json"); + + DMS4KafkaEvent apigEvent = serializer.Deserialize(jsonStream); + + Console.WriteLine("DMS4Kafka Event: " + apigEvent.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test.csproj new file mode 100644 index 0000000..bdf7951 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples-doc/event-kafka/resources/kafka_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/resources/dms4kafka_event.json similarity index 100% rename from samples-doc/event-kafka/resources/kafka_event.json rename to libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka/test/resources/dms4kafka_event.json diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/LTSEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/src/LTSEvent.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/LTSEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/src/LTSEvent.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/OpenTelekomCloud.Serverless.Function.Events.LTS.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/src/OpenTelekomCloud.Serverless.Function.Events.LTS.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS/OpenTelekomCloud.Serverless.Function.Events.LTS.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/src/OpenTelekomCloud.Serverless.Function.Events.LTS.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/LTSTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/LTSTest.cs new file mode 100644 index 0000000..a8d25f6 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/LTSTest.cs @@ -0,0 +1,31 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.LTS; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_LTSEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "lts_event.json"); + + LTSEvent ltsEvent = serializer.Deserialize(jsonStream); + Console.WriteLine("LTS Event: " + ltsEvent.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/OpenTelekomCloud.Serverless.Function.Events.LTS.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/OpenTelekomCloud.Serverless.Function.Events.LTS.test.csproj new file mode 100644 index 0000000..7653b44 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/OpenTelekomCloud.Serverless.Function.Events.LTS.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/resources/lts_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/resources/lts_event.json new file mode 100644 index 0000000..d42f56b --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.LTS/test/resources/lts_event.json @@ -0,0 +1,5 @@ +{ + "lts": { + "data": "eyJsb2dzIjoiW3tcIm1lc3NhZ2VcIjpcIjIwMTgtMDgtMDgvMDg6MDg6MDggW1dSTl0gW3Rlc3QuZ286MDhdVGhpcyBpcyBhIHRlc3QgbWVzc2FnZS5cIixcInRpbWVcIjoxNTMwMDA5NjUzMDU5LFwiaG9zdF9uYW1lXCI6XCJlY3MtdGVzdFwiLFwiaXBcIjpcIjE5Mi4xNjguMS4xXCIsXCJwYXRoXCI6XCJ2YXIvbG9nL3Rlc3QubG9nXCIsXCJsb2dfdWlkXCI6XCI2NjNkNjkzMC03OTJkLTExZTgtOGIwOC0yODZlZDQ4OGNlNzBcIixcImxpbmVfbm9cIjoxfV0iLCJvd25lciI6IjYyODBlMTcwYmQ5MzRmNjBhNGQ4NTFjZjVjYTA1MTI5IiwibG9nX2dyb3VwX2lkIjoiOTdhOWQyODQtNDQ0OC0xMWU4LThmYTQtMjg2ZWQ0ODhjZTcwIiwibG9nX3RvcGljX2lkIjoiMWE5Njc1YTctNzg0ZC0xMWU4LTlmNzAtMjg2ZWQ0ODhjZTcwIn0=" + } +} \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/OBSS3Event.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/src/OBSS3Event.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/OBSS3Event.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/src/OBSS3Event.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3/OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OBSS3Test.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OBSS3Test.cs new file mode 100644 index 0000000..8a113ff --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OBSS3Test.cs @@ -0,0 +1,31 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.OBSS3; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_OBSS3Event() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "obss3_event.json"); + + OBSS3Event obss3Event = serializer.Deserialize(jsonStream); + Console.WriteLine("OBSS3 Event: " + obss3Event.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OpenTelekomCloud.Serverless.Function.Events.OBSS3.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OpenTelekomCloud.Serverless.Function.Events.OBSS3.test.csproj new file mode 100644 index 0000000..e628d7c --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/OpenTelekomCloud.Serverless.Function.Events.OBSS3.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples-doc/event-s3obs/resources/s3obs_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/resources/obss3_event.json similarity index 100% rename from samples-doc/event-s3obs/resources/s3obs_event.json rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3/test/resources/obss3_event.json diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/OpenSourceKafkaEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src/OpenSourceKafkaEvent.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/OpenSourceKafkaEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src/OpenSourceKafkaEvent.cs diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenSourceKafkaTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenSourceKafkaTest.cs new file mode 100644 index 0000000..e808ea8 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenSourceKafkaTest.cs @@ -0,0 +1,31 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_OpenSourceKafkaEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "opensource_kafka_event.json"); + + OpenSourceKafkaEvent openSourceKafkaEvent = serializer.Deserialize(jsonStream); + Console.WriteLine("OpenSourceKafka Event: " + openSourceKafkaEvent.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test.csproj new file mode 100644 index 0000000..5243a4b --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/resources/opensource_kafka_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/resources/opensource_kafka_event.json new file mode 100644 index 0000000..d68dff3 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka/test/resources/opensource_kafka_event.json @@ -0,0 +1,19 @@ +{ + "event_version": "v1.0", + "event_time": 1576737962, + "trigger_type": "KAFKA", + "region": "eu-de", + "instance_id": "08fd3e1b-cf56-401f-b4c6-81fd2a1d3ae6", + "records": [ + { + "messages": [ + "kafka message1", + "kafka message2", + "kafka message3", + "kafka message4", + "kafka message5" + ], + "topic_id": "topic-test" + } + ] +} \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/OpenTelekomCloud.Serverless.Function.Events.SMN.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/src/OpenTelekomCloud.Serverless.Function.Events.SMN.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/OpenTelekomCloud.Serverless.Function.Events.SMN.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/src/OpenTelekomCloud.Serverless.Function.Events.SMN.csproj diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/SMNEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/src/SMNEvent.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN/SMNEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/src/SMNEvent.cs diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/OpenTelekomCloud.Serverless.Function.Events.SMN.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/OpenTelekomCloud.Serverless.Function.Events.SMN.test.csproj new file mode 100644 index 0000000..4798ce8 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/OpenTelekomCloud.Serverless.Function.Events.SMN.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/SMNTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/SMNTest.cs new file mode 100644 index 0000000..c3502ef --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/SMNTest.cs @@ -0,0 +1,31 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.SMN; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_SMNEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "smn_event.json"); + + SMNEvent smnEvent = serializer.Deserialize(jsonStream); + Console.WriteLine("SMN Event: " + smnEvent.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/resources/smn_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/resources/smn_event.json new file mode 100644 index 0000000..4563a27 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.SMN/test/resources/smn_event.json @@ -0,0 +1,21 @@ +{ + "record": [ + { + "event_version": "1.0", + "smn": { + "topic_urn": "topicUrn", + "timestamp": "2018-01-09T07:11:40Z", + "message_attributes": null, + "message": "this is smn message content", + "type": "notification", + "message_id": "a51671f77d4a479cacb09e2cd591a983", + "subject": "this is smn message subject" + }, + "event_subscription_urn": "functionUrn", + "event_source": "smn" + } + ], + "functionname": "test", + "requestId": "7c307f6a-cf68-4e65-8be0-4c77405a1b2c", + "timestamp": "Tue Jan 09 2018 15:11:40 GMT+0800 (CST)" +} \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/README.md b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/README.md similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/README.md rename to libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/README.md diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/OpenTelekomCloud.Serverless.Function.Events.Timer.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/src/OpenTelekomCloud.Serverless.Function.Events.Timer.csproj similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/OpenTelekomCloud.Serverless.Function.Events.Timer.csproj rename to libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/src/OpenTelekomCloud.Serverless.Function.Events.Timer.csproj diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/TimerEvent.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/src/TimerEvent.cs similarity index 100% rename from libraries/src/OpenTelekomCloud.Serverless.Function.Events.Timer/TimerEvent.cs rename to libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/src/TimerEvent.cs diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/OpenTelekomCloud.Serverless.Function.Events.Timer.test.csproj b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/OpenTelekomCloud.Serverless.Function.Events.Timer.test.csproj new file mode 100644 index 0000000..adbb2e3 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/OpenTelekomCloud.Serverless.Function.Events.Timer.test.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/TimerTest.cs b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/TimerTest.cs new file mode 100644 index 0000000..8959dd8 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/TimerTest.cs @@ -0,0 +1,31 @@ +namespace test +{ + using System; + using Xunit; + using System.IO; + using System.Text; + using OpenTelekomCloud.Serverless.Function.Common; + using OpenTelekomCloud.Serverless.Function.Common.TestUtils; + using OpenTelekomCloud.Serverless.Function.Events.Timer; + + using Newtonsoft.Json.Linq; + using System.Collections.Generic; + + + public class UnitTest1 + { + + JsonSerializer serializer = new JsonSerializer(); + + [Fact] + public void Test_TimerEvent() + { + + Stream jsonStream = typeof(UnitTest1).GetResourceStream("resources", "timer_event.json"); + + TimerEvent timerEvent = serializer.Deserialize(jsonStream); + Console.WriteLine("Timer Event: " + timerEvent.ToString()); + } + + } +} \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/resources/timer_event.json b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/resources/timer_event.json new file mode 100644 index 0000000..e2ec038 --- /dev/null +++ b/libraries/OpenTelekomCloud.Serverless.Function.Events.Timer/test/resources/timer_event.json @@ -0,0 +1,7 @@ +{ + "version": "v1.0", + "time": "2023-06-01T08:30:00+08:00", + "trigger_type": "TIMER", + "trigger_name": "Timer_001", + "user_event": "{\"message\": \"timer triggered event\", \"topic\":\"test\"}" +} diff --git a/libraries/libraries.sln b/libraries/libraries.sln index 23adb36..2d16e0c 100644 --- a/libraries/libraries.sln +++ b/libraries/libraries.sln @@ -3,202 +3,171 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer", "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer", "{5467D691-F3A9-4CC8-AE7C-B20565E6590A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common", "src\OpenTelekomCloud.Serverless.Function.Common\OpenTelekomCloud.Serverless.Function.Common.csproj", "{FF690003-F047-409C-9808-51C6F59DEB2F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer", "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer\src\OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj", "{8FCF6332-9B54-43BC-83B3-1CB074CBCE81}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.Utils", "src\OpenTelekomCloud.Serverless.Function.Common.Utils\OpenTelekomCloud.Serverless.Function.Common.Utils.csproj", "{54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Common.TestUtils", "OpenTelekomCloud.Serverless.Function.Common.TestUtils", "{DABEA768-DC77-4E28-9B7B-BEA5D2095EDC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.APIG", "src\OpenTelekomCloud.Serverless.Function.Events.APIG\OpenTelekomCloud.Serverless.Function.Events.APIG.csproj", "{770F13AD-8D53-4414-A2B2-1656B0FCDED2}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.TestUtils", "OpenTelekomCloud.Serverless.Function.Common.TestUtils\src\OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj", "{BF495CDA-5A90-4773-8009-F16BECDC2547}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.CTS", "src\OpenTelekomCloud.Serverless.Function.Events.CTS\OpenTelekomCloud.Serverless.Function.Events.CTS.csproj", "{07ECC178-E341-4AEF-BD58-33AFC57E4B60}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Common", "OpenTelekomCloud.Serverless.Function.Common", "{7A0D8ADD-03FD-4AB2-BF66-9633001FCA34}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka", "src\OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka\OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj", "{88826207-873C-4813-9300-EBFC36026373}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common", "OpenTelekomCloud.Serverless.Function.Common\src\OpenTelekomCloud.Serverless.Function.Common.csproj", "{A782DFB4-60CD-46C0-9551-EB56D21AF1DF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.LTS", "src\OpenTelekomCloud.Serverless.Function.Events.LTS\OpenTelekomCloud.Serverless.Function.Events.LTS.csproj", "{D7C9C0F2-644B-41FC-8465-522E740EEE1F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.APIG", "OpenTelekomCloud.Serverless.Function.Events.APIG", "{0926DBBB-8BB2-49C1-A603-092E88C892B8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OBSS3", "src\OpenTelekomCloud.Serverless.Function.Events.OBSS3\OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj", "{59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.APIG", "OpenTelekomCloud.Serverless.Function.Events.APIG\src\OpenTelekomCloud.Serverless.Function.Events.APIG.csproj", "{8085764E-45FE-4373-93E5-304E0116583A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka", "src\OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka\OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj", "{1EA3E765-FD97-476D-98EC-39022F6F1BB8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.APIG.test", "OpenTelekomCloud.Serverless.Function.Events.APIG\test\OpenTelekomCloud.Serverless.Function.Events.APIG.test.csproj", "{618F22A3-0C4A-42D9-8CDE-376DC181FF6B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.SMN", "src\OpenTelekomCloud.Serverless.Function.Events.SMN\OpenTelekomCloud.Serverless.Function.Events.SMN.csproj", "{40BC9DCF-896A-4521-B208-E945461676AF}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.CTS", "OpenTelekomCloud.Serverless.Function.Events.CTS", "{9C995D7E-E431-41E8-BFF9-C49F7B68A06E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.Timer", "src\OpenTelekomCloud.Serverless.Function.Events.Timer\OpenTelekomCloud.Serverless.Function.Events.Timer.csproj", "{665A292A-B7E3-4037-866F-EE4C3CDBE995}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.CTS", "OpenTelekomCloud.Serverless.Function.Events.CTS\src\OpenTelekomCloud.Serverless.Function.Events.CTS.csproj", "{6514535E-01D6-4E99-A615-3C46FCF6AE4B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.JsonSerializer", "src\OpenTelekomCloud.Serverless.Function.Common.JsonSerializer\OpenTelekomCloud.Serverless.Function.Common.JsonSerializer.csproj", "{98047583-27B7-4EB0-B343-F44C46569A4E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.CTS.test", "OpenTelekomCloud.Serverless.Function.Events.CTS\test\OpenTelekomCloud.Serverless.Function.Events.CTS.test.csproj", "{07F1B13E-AA46-4704-9054-440C293B49C5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Common.TestUtils", "src\OpenTelekomCloud.Serverless.Function.Common.TestUtils\OpenTelekomCloud.Serverless.Function.Common.TestUtils.csproj", "{4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka", "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka", "{CB31879B-0DB5-4604-A3E9-D2E698C9D49E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka", "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka\src\OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.csproj", "{B4B8CFE8-1AB8-4176-B5E7-9E29A5793093}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test", "OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka\test\OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka.test.csproj", "{E8582D55-C726-4FA2-A257-AF682994F99B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.LTS", "OpenTelekomCloud.Serverless.Function.Events.LTS", "{1077D387-EA81-4325-96E5-D4DD619EDBCF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.LTS", "OpenTelekomCloud.Serverless.Function.Events.LTS\src\OpenTelekomCloud.Serverless.Function.Events.LTS.csproj", "{68B1987F-769C-493B-AA6B-5EACA13BE63A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.LTS.test", "OpenTelekomCloud.Serverless.Function.Events.LTS\test\OpenTelekomCloud.Serverless.Function.Events.LTS.test.csproj", "{FFF16461-2213-4025-8699-C57DE853D944}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.OBSS3", "OpenTelekomCloud.Serverless.Function.Events.OBSS3", "{C534E74F-980A-445D-A4FC-6D1C32E8E695}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OBSS3", "OpenTelekomCloud.Serverless.Function.Events.OBSS3\src\OpenTelekomCloud.Serverless.Function.Events.OBSS3.csproj", "{51CF3E5D-CF6E-420A-AC09-781279196320}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OBSS3.test", "OpenTelekomCloud.Serverless.Function.Events.OBSS3\test\OpenTelekomCloud.Serverless.Function.Events.OBSS3.test.csproj", "{24251B34-6EF6-4DF3-8A43-DF569D4C7CE9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka", "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka", "{ADD75171-8874-4615-B28B-BAD250412615}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka", "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka\src\OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.csproj", "{58743754-CE44-447F-91B1-48E973DDA8BA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test", "OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka\test\OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka.test.csproj", "{DB8DCC92-A4F2-468A-A582-689B1208D37F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.SMN", "OpenTelekomCloud.Serverless.Function.Events.SMN", "{B8BCB322-033A-42A6-9D16-363731224B9F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.SMN", "OpenTelekomCloud.Serverless.Function.Events.SMN\src\OpenTelekomCloud.Serverless.Function.Events.SMN.csproj", "{04174A3F-F1C1-4D7E-9158-3E8148679634}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.SMN.test", "OpenTelekomCloud.Serverless.Function.Events.SMN\test\OpenTelekomCloud.Serverless.Function.Events.SMN.test.csproj", "{4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTelekomCloud.Serverless.Function.Events.Timer", "OpenTelekomCloud.Serverless.Function.Events.Timer", "{5C1E78B5-8FD6-460C-AC4A-FCC04060BBB4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.Timer", "OpenTelekomCloud.Serverless.Function.Events.Timer\src\OpenTelekomCloud.Serverless.Function.Events.Timer.csproj", "{07C4FB6A-90DA-4E2F-875E-FD38802269E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelekomCloud.Serverless.Function.Events.Timer.test", "OpenTelekomCloud.Serverless.Function.Events.Timer\test\OpenTelekomCloud.Serverless.Function.Events.Timer.test.csproj", "{58F43785-0C70-466B-8549-C9634DC77E54}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|x64.ActiveCfg = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|x64.Build.0 = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|x86.ActiveCfg = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Debug|x86.Build.0 = Debug|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|Any CPU.Build.0 = Release|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|x64.ActiveCfg = Release|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|x64.Build.0 = Release|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|x86.ActiveCfg = Release|Any CPU - {FF690003-F047-409C-9808-51C6F59DEB2F}.Release|x86.Build.0 = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|x64.ActiveCfg = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|x64.Build.0 = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|x86.ActiveCfg = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Debug|x86.Build.0 = Debug|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|Any CPU.Build.0 = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|x64.ActiveCfg = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|x64.Build.0 = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|x86.ActiveCfg = Release|Any CPU - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB}.Release|x86.Build.0 = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|x64.ActiveCfg = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|x64.Build.0 = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|x86.ActiveCfg = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Debug|x86.Build.0 = Debug|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|Any CPU.Build.0 = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|x64.ActiveCfg = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|x64.Build.0 = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|x86.ActiveCfg = Release|Any CPU - {770F13AD-8D53-4414-A2B2-1656B0FCDED2}.Release|x86.Build.0 = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|x64.ActiveCfg = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|x64.Build.0 = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|x86.ActiveCfg = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Debug|x86.Build.0 = Debug|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|Any CPU.Build.0 = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|x64.ActiveCfg = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|x64.Build.0 = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|x86.ActiveCfg = Release|Any CPU - {07ECC178-E341-4AEF-BD58-33AFC57E4B60}.Release|x86.Build.0 = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|x64.ActiveCfg = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|x64.Build.0 = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|x86.ActiveCfg = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Debug|x86.Build.0 = Debug|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|Any CPU.Build.0 = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|x64.ActiveCfg = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|x64.Build.0 = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|x86.ActiveCfg = Release|Any CPU - {88826207-873C-4813-9300-EBFC36026373}.Release|x86.Build.0 = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|x64.ActiveCfg = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|x64.Build.0 = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|x86.ActiveCfg = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Debug|x86.Build.0 = Debug|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|Any CPU.Build.0 = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|x64.ActiveCfg = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|x64.Build.0 = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|x86.ActiveCfg = Release|Any CPU - {D7C9C0F2-644B-41FC-8465-522E740EEE1F}.Release|x86.Build.0 = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|x64.ActiveCfg = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|x64.Build.0 = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|x86.ActiveCfg = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Debug|x86.Build.0 = Debug|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|Any CPU.Build.0 = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|x64.ActiveCfg = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|x64.Build.0 = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|x86.ActiveCfg = Release|Any CPU - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A}.Release|x86.Build.0 = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|x64.ActiveCfg = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|x64.Build.0 = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|x86.ActiveCfg = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Debug|x86.Build.0 = Debug|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|Any CPU.Build.0 = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|x64.ActiveCfg = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|x64.Build.0 = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|x86.ActiveCfg = Release|Any CPU - {1EA3E765-FD97-476D-98EC-39022F6F1BB8}.Release|x86.Build.0 = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|x64.ActiveCfg = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|x64.Build.0 = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|x86.ActiveCfg = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Debug|x86.Build.0 = Debug|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|Any CPU.Build.0 = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|x64.ActiveCfg = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|x64.Build.0 = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|x86.ActiveCfg = Release|Any CPU - {40BC9DCF-896A-4521-B208-E945461676AF}.Release|x86.Build.0 = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|Any CPU.Build.0 = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|x64.ActiveCfg = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|x64.Build.0 = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|x86.ActiveCfg = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Debug|x86.Build.0 = Debug|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|Any CPU.ActiveCfg = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|Any CPU.Build.0 = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x64.ActiveCfg = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x64.Build.0 = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x86.ActiveCfg = Release|Any CPU - {665A292A-B7E3-4037-866F-EE4C3CDBE995}.Release|x86.Build.0 = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|x64.ActiveCfg = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|x64.Build.0 = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|x86.ActiveCfg = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Debug|x86.Build.0 = Debug|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|Any CPU.Build.0 = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|x64.ActiveCfg = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|x64.Build.0 = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|x86.ActiveCfg = Release|Any CPU - {98047583-27B7-4EB0-B343-F44C46569A4E}.Release|x86.Build.0 = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|x64.ActiveCfg = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|x64.Build.0 = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|x86.ActiveCfg = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Debug|x86.Build.0 = Debug|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|Any CPU.Build.0 = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|x64.ActiveCfg = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|x64.Build.0 = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|x86.ActiveCfg = Release|Any CPU - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FCF6332-9B54-43BC-83B3-1CB074CBCE81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FCF6332-9B54-43BC-83B3-1CB074CBCE81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FCF6332-9B54-43BC-83B3-1CB074CBCE81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FCF6332-9B54-43BC-83B3-1CB074CBCE81}.Release|Any CPU.Build.0 = Release|Any CPU + {BF495CDA-5A90-4773-8009-F16BECDC2547}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF495CDA-5A90-4773-8009-F16BECDC2547}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF495CDA-5A90-4773-8009-F16BECDC2547}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF495CDA-5A90-4773-8009-F16BECDC2547}.Release|Any CPU.Build.0 = Release|Any CPU + {A782DFB4-60CD-46C0-9551-EB56D21AF1DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A782DFB4-60CD-46C0-9551-EB56D21AF1DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A782DFB4-60CD-46C0-9551-EB56D21AF1DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A782DFB4-60CD-46C0-9551-EB56D21AF1DF}.Release|Any CPU.Build.0 = Release|Any CPU + {8085764E-45FE-4373-93E5-304E0116583A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8085764E-45FE-4373-93E5-304E0116583A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8085764E-45FE-4373-93E5-304E0116583A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8085764E-45FE-4373-93E5-304E0116583A}.Release|Any CPU.Build.0 = Release|Any CPU + {618F22A3-0C4A-42D9-8CDE-376DC181FF6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {618F22A3-0C4A-42D9-8CDE-376DC181FF6B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {618F22A3-0C4A-42D9-8CDE-376DC181FF6B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {618F22A3-0C4A-42D9-8CDE-376DC181FF6B}.Release|Any CPU.Build.0 = Release|Any CPU + {6514535E-01D6-4E99-A615-3C46FCF6AE4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6514535E-01D6-4E99-A615-3C46FCF6AE4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6514535E-01D6-4E99-A615-3C46FCF6AE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6514535E-01D6-4E99-A615-3C46FCF6AE4B}.Release|Any CPU.Build.0 = Release|Any CPU + {07F1B13E-AA46-4704-9054-440C293B49C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07F1B13E-AA46-4704-9054-440C293B49C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07F1B13E-AA46-4704-9054-440C293B49C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07F1B13E-AA46-4704-9054-440C293B49C5}.Release|Any CPU.Build.0 = Release|Any CPU + {B4B8CFE8-1AB8-4176-B5E7-9E29A5793093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4B8CFE8-1AB8-4176-B5E7-9E29A5793093}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4B8CFE8-1AB8-4176-B5E7-9E29A5793093}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4B8CFE8-1AB8-4176-B5E7-9E29A5793093}.Release|Any CPU.Build.0 = Release|Any CPU + {E8582D55-C726-4FA2-A257-AF682994F99B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8582D55-C726-4FA2-A257-AF682994F99B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8582D55-C726-4FA2-A257-AF682994F99B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8582D55-C726-4FA2-A257-AF682994F99B}.Release|Any CPU.Build.0 = Release|Any CPU + {68B1987F-769C-493B-AA6B-5EACA13BE63A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68B1987F-769C-493B-AA6B-5EACA13BE63A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68B1987F-769C-493B-AA6B-5EACA13BE63A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68B1987F-769C-493B-AA6B-5EACA13BE63A}.Release|Any CPU.Build.0 = Release|Any CPU + {FFF16461-2213-4025-8699-C57DE853D944}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFF16461-2213-4025-8699-C57DE853D944}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFF16461-2213-4025-8699-C57DE853D944}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFF16461-2213-4025-8699-C57DE853D944}.Release|Any CPU.Build.0 = Release|Any CPU + {51CF3E5D-CF6E-420A-AC09-781279196320}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51CF3E5D-CF6E-420A-AC09-781279196320}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51CF3E5D-CF6E-420A-AC09-781279196320}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51CF3E5D-CF6E-420A-AC09-781279196320}.Release|Any CPU.Build.0 = Release|Any CPU + {24251B34-6EF6-4DF3-8A43-DF569D4C7CE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24251B34-6EF6-4DF3-8A43-DF569D4C7CE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24251B34-6EF6-4DF3-8A43-DF569D4C7CE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24251B34-6EF6-4DF3-8A43-DF569D4C7CE9}.Release|Any CPU.Build.0 = Release|Any CPU + {58743754-CE44-447F-91B1-48E973DDA8BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58743754-CE44-447F-91B1-48E973DDA8BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58743754-CE44-447F-91B1-48E973DDA8BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58743754-CE44-447F-91B1-48E973DDA8BA}.Release|Any CPU.Build.0 = Release|Any CPU + {DB8DCC92-A4F2-468A-A582-689B1208D37F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB8DCC92-A4F2-468A-A582-689B1208D37F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB8DCC92-A4F2-468A-A582-689B1208D37F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB8DCC92-A4F2-468A-A582-689B1208D37F}.Release|Any CPU.Build.0 = Release|Any CPU + {04174A3F-F1C1-4D7E-9158-3E8148679634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04174A3F-F1C1-4D7E-9158-3E8148679634}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04174A3F-F1C1-4D7E-9158-3E8148679634}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04174A3F-F1C1-4D7E-9158-3E8148679634}.Release|Any CPU.Build.0 = Release|Any CPU + {4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F}.Release|Any CPU.Build.0 = Release|Any CPU + {07C4FB6A-90DA-4E2F-875E-FD38802269E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07C4FB6A-90DA-4E2F-875E-FD38802269E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07C4FB6A-90DA-4E2F-875E-FD38802269E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07C4FB6A-90DA-4E2F-875E-FD38802269E4}.Release|Any CPU.Build.0 = Release|Any CPU + {58F43785-0C70-466B-8549-C9634DC77E54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58F43785-0C70-466B-8549-C9634DC77E54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58F43785-0C70-466B-8549-C9634DC77E54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58F43785-0C70-466B-8549-C9634DC77E54}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(NestedProjects) = preSolution - {FF690003-F047-409C-9808-51C6F59DEB2F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {54FF2D45-66E9-4894-9D7B-C5AF48DD88EB} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {770F13AD-8D53-4414-A2B2-1656B0FCDED2} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {07ECC178-E341-4AEF-BD58-33AFC57E4B60} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {88826207-873C-4813-9300-EBFC36026373} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {D7C9C0F2-644B-41FC-8465-522E740EEE1F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {59BB44BB-D3A0-4A35-9E6C-6F98627A7E8A} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {1EA3E765-FD97-476D-98EC-39022F6F1BB8} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {40BC9DCF-896A-4521-B208-E945461676AF} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {665A292A-B7E3-4037-866F-EE4C3CDBE995} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {98047583-27B7-4EB0-B343-F44C46569A4E} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} - {4B0B79C1-F5CC-4F9B-9C92-E15894C2BDDE} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + {8FCF6332-9B54-43BC-83B3-1CB074CBCE81} = {5467D691-F3A9-4CC8-AE7C-B20565E6590A} + {BF495CDA-5A90-4773-8009-F16BECDC2547} = {DABEA768-DC77-4E28-9B7B-BEA5D2095EDC} + {A782DFB4-60CD-46C0-9551-EB56D21AF1DF} = {7A0D8ADD-03FD-4AB2-BF66-9633001FCA34} + {8085764E-45FE-4373-93E5-304E0116583A} = {0926DBBB-8BB2-49C1-A603-092E88C892B8} + {618F22A3-0C4A-42D9-8CDE-376DC181FF6B} = {0926DBBB-8BB2-49C1-A603-092E88C892B8} + {6514535E-01D6-4E99-A615-3C46FCF6AE4B} = {9C995D7E-E431-41E8-BFF9-C49F7B68A06E} + {07F1B13E-AA46-4704-9054-440C293B49C5} = {9C995D7E-E431-41E8-BFF9-C49F7B68A06E} + {B4B8CFE8-1AB8-4176-B5E7-9E29A5793093} = {CB31879B-0DB5-4604-A3E9-D2E698C9D49E} + {E8582D55-C726-4FA2-A257-AF682994F99B} = {CB31879B-0DB5-4604-A3E9-D2E698C9D49E} + {68B1987F-769C-493B-AA6B-5EACA13BE63A} = {1077D387-EA81-4325-96E5-D4DD619EDBCF} + {FFF16461-2213-4025-8699-C57DE853D944} = {1077D387-EA81-4325-96E5-D4DD619EDBCF} + {51CF3E5D-CF6E-420A-AC09-781279196320} = {C534E74F-980A-445D-A4FC-6D1C32E8E695} + {24251B34-6EF6-4DF3-8A43-DF569D4C7CE9} = {C534E74F-980A-445D-A4FC-6D1C32E8E695} + {58743754-CE44-447F-91B1-48E973DDA8BA} = {ADD75171-8874-4615-B28B-BAD250412615} + {DB8DCC92-A4F2-468A-A582-689B1208D37F} = {ADD75171-8874-4615-B28B-BAD250412615} + {04174A3F-F1C1-4D7E-9158-3E8148679634} = {B8BCB322-033A-42A6-9D16-363731224B9F} + {4D37D142-BD9D-4FC4-B43F-BE7CF26F7F5F} = {B8BCB322-033A-42A6-9D16-363731224B9F} + {07C4FB6A-90DA-4E2F-875E-FD38802269E4} = {5C1E78B5-8FD6-460C-AC4A-FCC04060BBB4} + {58F43785-0C70-466B-8549-C9634DC77E54} = {5C1E78B5-8FD6-460C-AC4A-FCC04060BBB4} EndGlobalSection EndGlobal diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/IFunctionSerializer.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/IFunctionSerializer.cs deleted file mode 100644 index 3d2f61d..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer/IFunctionSerializer.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace OpenTelekomCloud.Serverless.Function.Common -{ - using System.IO; - public interface IFunctionSerializer - { - T Deserialize(Stream ins); - - Stream Serialize(T value); - } -} diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/Utils.cs b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/Utils.cs deleted file mode 100644 index 261903d..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.TestUtils/Utils.cs +++ /dev/null @@ -1,26 +0,0 @@ -#if NET6_0_OR_GREATER -namespace OpenTelekomCloud.Serverless.Function.Common -#else -namespace HC.Serverless.Function.Common -#endif -{ - using System; - using System.IO; - public class Utils - { - /// - /// Get the path to the current project, useful to access test resource files - /// - /// - public static string GetPathProjectFolder() - { - string pathAssembly = System.Reflection.Assembly.GetExecutingAssembly().Location; - string folderAssembly = System.IO.Path.GetDirectoryName(pathAssembly); - - string folderProjectLevel = System.IO.Path.GetFullPath(folderAssembly); - - folderProjectLevel = Path.Combine(folderProjectLevel, "../../../../"); - return folderProjectLevel; - } - } -} \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/OpenTelekomCloud.Serverless.Function.Common.Utils.csproj b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/OpenTelekomCloud.Serverless.Function.Common.Utils.csproj deleted file mode 100644 index d4085f2..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/OpenTelekomCloud.Serverless.Function.Common.Utils.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - OpenTelekomCloud FunctionGraph .NET Core support - Common Utils. - OpenTelekomCloud.Serverless.Function.Common.Utils - - OpenTelekomCloud.Serverless.Function.Common.Utils - - 1.0.0.0 - - OpenTelekomCloud.Serverless.Function.Common.Utils - - OpenTelekomCloud.Serverless.Function.Common.Utils - OpenTelekomCloud;OTC;FunctionGraph - README.md - - - - - - - - - \ No newline at end of file diff --git a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/README.md b/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/README.md deleted file mode 100644 index 808f937..0000000 --- a/libraries/src/OpenTelekomCloud.Serverless.Function.Common.Utils/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# HC.Serverless.Function.Common.Utils - -This package contains interfaces and classes that can be helpful when running your .NET code on the OpenTelekomCloud platform. \ No newline at end of file diff --git a/releasenotes/v2.0.0.md b/releasenotes/v2.0.0.md index e150406..0770c01 100644 --- a/releasenotes/v2.0.0.md +++ b/releasenotes/v2.0.0.md @@ -5,10 +5,20 @@ ### Changes - [Issue #1](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/1): `APIGResponse` added to `APIGEvent`. -- `OpenTelekomCloud.Serverless.Function.Common.TestUtils` added. Provides utility classes for XUnit tests, E.g. TestContextSimple. + +- added: `OpenTelekomCloud.Serverless.Function.Common.TestUtils` + Provides utility classes for XUnit tests, E.g. TestContextSimple. + +- added: `APIGEvent.getBodyAsString()` + returns body as string (decodes if necessary) + +- Refactorings: Moved libraries sources to src `sub` folder. ### BREAKING CHANGES: -- library `OpenTelekomCloud.Serverless.Function.Common.legacy` removed, now part of `OpenTelekomCloud.Serverless.Function.Common` - [Issue #2](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/2) : `OpenTelekomCloud.Serverless.Function.Events.DDS` removed as DDS is deprecated. + - [Issue #3](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/3) : `APIGEvent`, support added for not predefined properties in `APIGRequestHeaders`, `APIGResponseHeaders`, `QueryStringParameters`, `PathParameters` + +- [Issue #4](https://github.com/opentelekomcloud-community/otc-functiongraph-csharp-runtime/issues/4): library `OpenTelekomCloud.Serverless.Function.Common.legacy` removed, now part of `OpenTelekomCloud.Serverless.Function.Common` + diff --git a/samples-doc/event-apig/src/Program.cs b/samples-doc/event-apig/src/Program.cs index 38f17ef..6c2ff86 100644 --- a/samples-doc/event-apig/src/Program.cs +++ b/samples-doc/event-apig/src/Program.cs @@ -40,18 +40,9 @@ public Stream Handler(Stream inputEvent, IFunctionContext context) if (apigEvent != null) { - if (apigEvent.IsBase64Encoded) - { - byte[] data = System.Convert.FromBase64String(apigEvent.Body); - payload = Encoding.UTF8.GetString(data); - logger.Logf("Base64 decoded Body={0}", payload); - } - else - { - payload = apigEvent.Body; - logger.Logf("Unencoded Body={0}", payload); - } - + payload = apigEvent.GetBodyAsString(); + logger.Logf("APIG Event Payload: {0}", payload); + // display path parameters var parameters = apigEvent.PathParameters.getParameters(); if (parameters != null) @@ -89,7 +80,7 @@ public Stream Handler(Stream inputEvent, IFunctionContext context) } APIGResponseHeaders responseHeaders = new APIGResponseHeaders(); - responseHeaders.setAdditionalHeader("X-Custom-Header", "CustomValue"); + responseHeaders.addAdditionalHeader("X-Custom-Header", "CustomValue"); APIGResponse response = new APIGResponse() { diff --git a/samples-doc/event-apig/test/ProgramTest.cs b/samples-doc/event-apig/test/ProgramTest.cs index e53d70b..931de4b 100644 --- a/samples-doc/event-apig/test/ProgramTest.cs +++ b/samples-doc/event-apig/test/ProgramTest.cs @@ -6,7 +6,6 @@ using System.Text; using OpenTelekomCloud.Serverless.Function.Common; using OpenTelekomCloud.Serverless.Function.Events.APIG; -using System.Security.Cryptography; public class UnitTest1 { @@ -23,10 +22,7 @@ public void TestHandlerWithValidJson() string jsonInput = ""; - string folderProjectLevel = Utils.GetPathProjectFolder(); - - // Read sample APIG event JSON from file - string filePath = Path.Combine(folderProjectLevel, "resources/apig_event.json"); + string filePath = "resources/apig_event.json"; using (StreamReader r = new StreamReader(filePath)) { @@ -52,6 +48,7 @@ public void TestHandlerWithValidJson() Console.WriteLine("Function output: " + apigResponse.Body); } + } [Fact] @@ -64,10 +61,8 @@ public void TestHandlerWithValidJsonBase64() string jsonInput = ""; - string folderProjectLevel = Utils.GetPathProjectFolder(); - // Read sample APIG event JSON from file - string filePath = Path.Combine(folderProjectLevel, "resources/apig_base64_event.json"); + string filePath = "resources/apig_base64_event.json"; using (StreamReader r = new StreamReader(filePath)) { @@ -108,10 +103,8 @@ public void TestHandlerWithParameters() string jsonInput = ""; - string folderProjectLevel = Utils.GetPathProjectFolder(); - // Read sample APIG event JSON from file - string filePath = Path.Combine(folderProjectLevel, "resources/apig_event_with_params.json"); + string filePath = "resources/apig_event_with_params.json"; using (StreamReader r = new StreamReader(filePath)) { diff --git a/samples-doc/event-apig/test/event_apig.test.csproj b/samples-doc/event-apig/test/event_apig.test.csproj index 2be0891..8ebab21 100644 --- a/samples-doc/event-apig/test/event_apig.test.csproj +++ b/samples-doc/event-apig/test/event_apig.test.csproj @@ -24,7 +24,14 @@ + Version="*-*" /> - + + + PreserveNewest + resources/%(RecursiveDir)%(Filename)%(Extension) + + + + \ No newline at end of file diff --git a/samples-doc/event-cts/resources/cts_createFunction.json b/samples-doc/event-cts/resources/cts_createFunction.json new file mode 100644 index 0000000..d83902b --- /dev/null +++ b/samples-doc/event-cts/resources/cts_createFunction.json @@ -0,0 +1,34 @@ +{ + "cts": { + "request": {}, + "trace_id": "f828ab77-d993-11f0-b09f-35adcfa25f3b", + "code": 0, + "trace_name": "createFunction", + "resource_type": "Functions", + "trace_rating": "normal", + "api_version": "", + "message": "POST /v2/d52e41d2434941b194ce3f91b1b12f8a/fgs/functions, create function[test4]", + "source_ip": "62.156.151.4", + "domain_id": "e51dfca1c18747919f6c16af2721f35d", + "service_type": "FunctionGraph", + "trace_type": "ConsoleAction", + "project_id": "d52e41d2434941b194ce3f91b1b12f8a", + "read_only": false, + "response": {}, + "resource_id": "test4", + "trace_status": "normal", + "operation_id": "CreateFunction", + "resource_account_id": "", + "time": 1765788999507, + "resource_name": "test4", + "record_time": 1765788999507, + "user": { + "domain": { + "name": "OTC00000000001000100974", + "id": "e51dfca1c18747919f6c16af2721f35d" + }, + "name": "harald", + "id": "e14aed517380466cac2d109877a5ac6b" + } + } +} diff --git a/samples-doc/event-cts/test/ProgramTest.cs b/samples-doc/event-cts/test/ProgramTest.cs index 4c7d714..9f18a53 100644 --- a/samples-doc/event-cts/test/ProgramTest.cs +++ b/samples-doc/event-cts/test/ProgramTest.cs @@ -6,7 +6,6 @@ using System.Text; using OpenTelekomCloud.Serverless.Function.Common; using OpenTelekomCloud.Serverless.Function.Events.CTS; -using System.Security.Cryptography; public class UnitTest1 { @@ -23,10 +22,8 @@ public void TestHandlerWithValidJson() string jsonInput = ""; - string folderProjectLevel = Utils.GetPathProjectFolder(); - // Read sample CTS event JSON from file - string filePath = Path.Combine(folderProjectLevel, "resources/cts_event.json"); + string filePath = "resources/cts_event.json"; using (StreamReader r = new StreamReader(filePath)) { diff --git a/samples-doc/event-cts/test/event_cts.test.csproj b/samples-doc/event-cts/test/event_cts.test.csproj index 34e4c2e..d549de1 100644 --- a/samples-doc/event-cts/test/event_cts.test.csproj +++ b/samples-doc/event-cts/test/event_cts.test.csproj @@ -27,4 +27,11 @@ Version="*-*" /> + + + PreserveNewest + resources/%(RecursiveDir)%(Filename)%(Extension) + + + diff --git a/samples-doc/event-s3obs-thumbnail/Makefile b/samples-doc/event-obss3-thumbnail/Makefile similarity index 100% rename from samples-doc/event-s3obs-thumbnail/Makefile rename to samples-doc/event-obss3-thumbnail/Makefile diff --git a/samples-doc/event-s3obs-thumbnail/README.md b/samples-doc/event-obss3-thumbnail/README.md similarity index 100% rename from samples-doc/event-s3obs-thumbnail/README.md rename to samples-doc/event-obss3-thumbnail/README.md diff --git a/samples-doc/event-s3obs-thumbnail/event-s3obs-thumbnail.sln b/samples-doc/event-obss3-thumbnail/event-obss3-thumbnail.sln similarity index 100% rename from samples-doc/event-s3obs-thumbnail/event-s3obs-thumbnail.sln rename to samples-doc/event-obss3-thumbnail/event-obss3-thumbnail.sln diff --git a/samples-doc/event-s3obs-thumbnail/invokeFunction.py b/samples-doc/event-obss3-thumbnail/invokeFunction.py similarity index 100% rename from samples-doc/event-s3obs-thumbnail/invokeFunction.py rename to samples-doc/event-obss3-thumbnail/invokeFunction.py diff --git a/samples-doc/event-s3obs-thumbnail/src/Program.cs b/samples-doc/event-obss3-thumbnail/src/Program.cs similarity index 100% rename from samples-doc/event-s3obs-thumbnail/src/Program.cs rename to samples-doc/event-obss3-thumbnail/src/Program.cs diff --git a/samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj b/samples-doc/event-obss3-thumbnail/src/event_obss3_thumbnail.csproj similarity index 100% rename from samples-doc/event-s3obs-thumbnail/src/event_s3obs_thumbnail.csproj rename to samples-doc/event-obss3-thumbnail/src/event_obss3_thumbnail.csproj diff --git a/samples-doc/event-obss3-thumbnail/src/handler.txt b/samples-doc/event-obss3-thumbnail/src/handler.txt new file mode 100644 index 0000000..51cfa79 --- /dev/null +++ b/samples-doc/event-obss3-thumbnail/src/handler.txt @@ -0,0 +1 @@ +obss3Thumbnail::src.Program::Handler \ No newline at end of file diff --git a/samples-doc/event-s3obs-thumbnail/terraform/main.tf b/samples-doc/event-obss3-thumbnail/terraform/main.tf similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/main.tf rename to samples-doc/event-obss3-thumbnail/terraform/main.tf diff --git a/samples-doc/event-s3obs-thumbnail/terraform/net6.tfvars b/samples-doc/event-obss3-thumbnail/terraform/net6.tfvars similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/net6.tfvars rename to samples-doc/event-obss3-thumbnail/terraform/net6.tfvars diff --git a/samples-doc/event-s3obs-thumbnail/terraform/outputlocal.tf b/samples-doc/event-obss3-thumbnail/terraform/outputlocal.tf similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/outputlocal.tf rename to samples-doc/event-obss3-thumbnail/terraform/outputlocal.tf diff --git a/samples-doc/event-s3obs-thumbnail/terraform/provider.tf b/samples-doc/event-obss3-thumbnail/terraform/provider.tf similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/provider.tf rename to samples-doc/event-obss3-thumbnail/terraform/provider.tf diff --git a/samples-doc/event-s3obs-thumbnail/terraform/setupTFvars.sh b/samples-doc/event-obss3-thumbnail/terraform/setupTFvars.sh similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/setupTFvars.sh rename to samples-doc/event-obss3-thumbnail/terraform/setupTFvars.sh diff --git a/samples-doc/event-s3obs-thumbnail/terraform/variables.tf b/samples-doc/event-obss3-thumbnail/terraform/variables.tf similarity index 100% rename from samples-doc/event-s3obs-thumbnail/terraform/variables.tf rename to samples-doc/event-obss3-thumbnail/terraform/variables.tf diff --git a/samples-doc/event-s3obs-thumbnail/test/resources/otc.jpg b/samples-doc/event-obss3-thumbnail/test/resources/otc.jpg similarity index 100% rename from samples-doc/event-s3obs-thumbnail/test/resources/otc.jpg rename to samples-doc/event-obss3-thumbnail/test/resources/otc.jpg diff --git a/samples-doc/event-s3obs-thumbnail/testUpload.cmd b/samples-doc/event-obss3-thumbnail/testUpload.cmd similarity index 100% rename from samples-doc/event-s3obs-thumbnail/testUpload.cmd rename to samples-doc/event-obss3-thumbnail/testUpload.cmd diff --git a/samples-doc/event-s3obs-thumbnail/testUpload.sh b/samples-doc/event-obss3-thumbnail/testUpload.sh similarity index 100% rename from samples-doc/event-s3obs-thumbnail/testUpload.sh rename to samples-doc/event-obss3-thumbnail/testUpload.sh diff --git a/samples-doc/event-obss3/resources/obss3_event.json b/samples-doc/event-obss3/resources/obss3_event.json new file mode 100644 index 0000000..b87b002 --- /dev/null +++ b/samples-doc/event-obss3/resources/obss3_event.json @@ -0,0 +1,32 @@ +{ + "Records": [ + { + "eventVersion": "2.0", + "eventTime": "2018-01-09T07:50:50.028Z", + "requestParameters": { + "sourceIPAddress": "103.218.216.125" + }, + "s3": { + "configurationId": "UK1DGFPYUKUZFHNQ00000160CC0B471D101ED30CE24DF4DB", + "object": { + "eTag": "9d377b10ce778c4938b3c7e2c63a229a", + "sequencer": "00000000160D9E681484D6B4C0000000", + "key": "job.png", + "size": 777835 + }, + "bucket": { + "arn": "arn:fss:s3:::syj-input2", + "name": "functionstorage-template", + "ownerIdentity": { + "PrincipalId": "0ed1b73473f24134a478962e631651eb" + } + } + }, + "awsRegion": "region", + "eventName": "ObjectCreated:Post", + "userIdentity": { + "principalId": "9bf43789b1ff4b679040f35cc4f0dc05" + } + } + ] +} \ No newline at end of file diff --git a/samples-doc/event-s3obs-thumbnail/src/handler.txt b/samples-doc/event-s3obs-thumbnail/src/handler.txt deleted file mode 100644 index 8e3c511..0000000 --- a/samples-doc/event-s3obs-thumbnail/src/handler.txt +++ /dev/null @@ -1 +0,0 @@ -s3obsThumbnail::src.Program::Handler \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/README.md b/samples-doc/http_minimalWebAPI/README.md index 2542eb9..2ebd547 100644 --- a/samples-doc/http_minimalWebAPI/README.md +++ b/samples-doc/http_minimalWebAPI/README.md @@ -1 +1,4 @@ # Sample for minimal WebAPI + +Sample for a FunctionGraph HTTP Function written in .NET 8.0, deployable using Terraform. + diff --git a/samples-doc/samples-doc.sln b/samples-doc/samples-doc.sln index 7d26736..04fcb02 100644 --- a/samples-doc/samples-doc.sln +++ b/samples-doc/samples-doc.sln @@ -23,9 +23,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "event_cts", "event-cts\src\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "event_cts.test", "event-cts\test\event_cts.test.csproj", "{8B1F682B-0895-4554-86DF-DC2EBE25A81B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "event-s3obs-thumbnail", "event-s3obs-thumbnail", "{92074C0D-F408-47DB-80D6-05FA69085896}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "event-obss3-thumbnail", "event-obss3-thumbnail", "{92074C0D-F408-47DB-80D6-05FA69085896}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "event_s3obs_thumbnail", "event-s3obs-thumbnail\src\event_s3obs_thumbnail.csproj", "{6A15D748-C7B0-427D-9F75-51BD72485967}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "event_obss3_thumbnail", "event-obss3-thumbnail\src\event_obss3_thumbnail.csproj", "{6A15D748-C7B0-427D-9F75-51BD72485967}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "http_minimalWebAPI", "http_minimalWebAPI", "{20FB5318-612C-402D-BF78-CBDDFD36A65F}" EndProject diff --git a/tox.ini b/tox.ini index 410b407..873e125 100644 --- a/tox.ini +++ b/tox.ini @@ -17,4 +17,3 @@ allowlist_externals = rm commands = rm -rf doc/build sphinx-autobuild --port 8882 doc/source/ doc/build/html - From 03bd77f1059acf11753ab101f8a0f6a2edae481b Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Tue, 16 Dec 2025 12:49:02 +0100 Subject: [PATCH 3/6] refactorings for v2.0.0 --- doc/source/devguide/http_function/transferringKeys.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/devguide/http_function/transferringKeys.rst b/doc/source/devguide/http_function/transferringKeys.rst index 296456d..6e4a173 100644 --- a/doc/source/devguide/http_function/transferringKeys.rst +++ b/doc/source/devguide/http_function/transferringKeys.rst @@ -12,7 +12,7 @@ perform the following steps: 1. Log in to the :fg_console:`FunctionGraph console<>` console and go to the details page of the HTTP function to be configured -2. Choose **Configuration** -> **Advanced Settings** and enable +2. Choose **Configuration** > **Advanced Settings** and enable **Include Keys**. .. figure:: console_advanced_settings.png From 1f8522f1c8378b638fe8ec66d0c6886470b71414 Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Tue, 16 Dec 2025 15:11:40 +0100 Subject: [PATCH 4/6] configurable TestContextSimple --- .../src/TestContextSimple.cs | 64 ++++++++++++------- .../src/TestFunctionLogger.cs | 12 ++-- .../src/IFunctionLogger.cs | 9 ++- samples-doc/simple/resources/simple.json | 3 + samples-doc/simple/test/ProgramTest.cs | 49 ++++++++++++++ samples-doc/simple/test/simple.test.csproj | 37 +++++++++++ 6 files changed, 141 insertions(+), 33 deletions(-) create mode 100644 samples-doc/simple/resources/simple.json create mode 100644 samples-doc/simple/test/ProgramTest.cs create mode 100644 samples-doc/simple/test/simple.test.csproj diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs index e818416..eac5dbf 100644 --- a/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestContextSimple.cs @@ -6,6 +6,7 @@ namespace HC.Serverless.Function.Common { using System; + using System.Collections.Generic; /// /// Test Context implementation to be used in unit tests @@ -16,49 +17,66 @@ public class TestContextSimple : OpenTelekomCloud.Serverless.Function.Common.IFu public class TestContextSimple : HC.Serverless.Function.Common.IFunctionContext #endif { - public string FunctionName => "TestFunction"; - public string FunctionVersion => "latest"; + public Dictionary UserData { get; set; } = new Dictionary(); + private DateTime _funcStartTime = DateTime.Now; - public string RequestId => Guid.NewGuid().ToString(); - - public string ProjectId => "TestProjectId"; + public int TimeoutSeconds { get; set; } = 30; + + public string FunctionName { get; set; } = "TestFunction"; - public string PackageName => "TestPackage"; + public string FunctionVersion { get; set; } = "latest"; - public int MemoryLimitInMb => 128; + public string RequestId => Guid.NewGuid().ToString(); - public int CpuNumber => 1; + public string ProjectId { get; set; } = "TestProjectId"; - public string AccessKey => "FakeAccessKey"; + public string PackageName { get; set; } = "TestPackage"; - public string SecretKey => "FakeSecretKey"; + public int MemoryLimitInMb { get; set; } = 128; - public string SecurityAccessKey => "FakeSecurityAccessKey"; + + public int CpuNumber { get; set; } = 1; - public string SecuritySecretKey => "FakeSecuritySecretKey"; + public string AccessKey { get; set; } = "FakeAccessKey"; - public string WorkflowID => ""; + public string SecretKey { get; set; } = "FakeSecretKey"; - public string WorkflowRunID => ""; + public string SecurityAccessKey { get; set; } = "FakeSecurityAccessKey"; - public string WorkflowStateID => ""; + public string SecuritySecretKey { get; set; } = "FakeSecuritySecretKey"; + public string WorkflowID { get; set; } = ""; - public string Token => "FakeToken"; + public string WorkflowRunID { get; set; } = ""; - public string SecurityToken => "FakeSecurityToken"; + public string WorkflowStateID { get; set; } = ""; - public int RemainingTimeInMilliSeconds => 60000; + public string Token { get; set; } = "FakeToken"; - public IFunctionLogger Logger => new TestFunctionLogger(); + public string SecurityToken { get; set; } = "FakeSecurityToken"; + public int RemainingTimeInMilliSeconds + { + get + { + return this.TimeoutSeconds * 1000 - Convert.ToInt32(DateTime.Now.Subtract(this._funcStartTime).TotalMilliseconds); + } + } - public string GetUserData(string key, string defaultValue = "") + public IFunctionLogger Logger { - if (key == "Key") + get { - return "Value"; + return new TestFunctionLogger() + { + RequestId = this.RequestId, + InvokeId = Guid.NewGuid().ToString() + }; } - return defaultValue; + } + + public string GetUserData(string key, string defaultValue = "") + { + return UserData == null || !UserData.ContainsKey(key) ? defaultValue : UserData[key]; } } diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs index 745c7f1..5a1734b 100644 --- a/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils/src/TestFunctionLogger.cs @@ -12,14 +12,16 @@ namespace HC.Serverless.Function.Common /// public class TestFunctionLogger : IFunctionLogger { + public string RequestId { get; set; } + + public string InvokeId { get; set; } + public void Log(string message) { - Console.WriteLine(message); + Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff01")}] {this.RequestId}:{this.InvokeId} {message}"); } - public void Logf(string format, params object[] args) - { - Console.WriteLine(format, args); - } + public void Logf(string format, params object[] args) => this.Log(string.Format(format, args)); + } } \ No newline at end of file diff --git a/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs index 6bd1b25..9196750 100644 --- a/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs +++ b/libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs @@ -6,16 +6,15 @@ namespace HC.Serverless.Function.Common { public interface IFunctionLogger { + /// + /// Records user input logs + /// + /// void Log(string message); /// /// Records user input logs - /// This method will output the content to the standard output in the format of "time-request ID-output content". /// - /// For example: - /// - /// 2017-10-25T09:10:03.328Z 473d369d-101a-445e-a7a8-315cca788f86 test log output - /// /// Usage of format: /// /// Logger.Logf("hello CSharp runtime test({0})", version); diff --git a/samples-doc/simple/resources/simple.json b/samples-doc/simple/resources/simple.json new file mode 100644 index 0000000..d5df76e --- /dev/null +++ b/samples-doc/simple/resources/simple.json @@ -0,0 +1,3 @@ +{ + "key": "value" +} \ No newline at end of file diff --git a/samples-doc/simple/test/ProgramTest.cs b/samples-doc/simple/test/ProgramTest.cs new file mode 100644 index 0000000..4585139 --- /dev/null +++ b/samples-doc/simple/test/ProgramTest.cs @@ -0,0 +1,49 @@ +namespace src; + +using System; +using Xunit; +using System.IO; +using System.Text; +using OpenTelekomCloud.Serverless.Function.Common; + + +public class UnitTest1 +{ + + [Fact] + public void TestHandlerWithValidJson() + { + // Arrange + var program = new Program(); + + // configure test context + var context = new TestContextSimple(){ + TimeoutSeconds = 60 + }; + context.UserData["ud-a"] = "USER DATA A VALUE"; + + string jsonInput = ""; + + // Read sample CTS event JSON from file + string filePath = "resources/simple.json"; + + using (StreamReader r = new StreamReader(filePath)) + { + jsonInput = r.ReadToEnd(); + var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonInput)); + + // call the handler + var resultStream = program.Handler(inputStream, context); + + Assert.NotNull(resultStream); + + using (var reader = new StreamReader(resultStream)) + { + string result = reader.ReadToEnd(); + Console.WriteLine("Function output: " + result); + } + + } + } + +} \ No newline at end of file diff --git a/samples-doc/simple/test/simple.test.csproj b/samples-doc/simple/test/simple.test.csproj new file mode 100644 index 0000000..df1571f --- /dev/null +++ b/samples-doc/simple/test/simple.test.csproj @@ -0,0 +1,37 @@ + + + + net6.0 + enable + enable + false + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + resources/%(RecursiveDir)%(Filename)%(Extension) + + + + From 286738173313595be8bc8770682887bf9a98a9d4 Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Thu, 18 Dec 2025 14:31:36 +0100 Subject: [PATCH 5/6] http_minimalWebApi added: swagger-ui, logging --- .vscode/settings.json | 3 +- .../src/LoggingMiddleware.cs | 80 +++++++++++++ samples-doc/http_minimalWebAPI/src/Program.cs | 107 ++++++++++++++---- .../src/http_minimalWebAPI.csproj | 28 ++++- .../src/wwwroot/swagger/favicon-16x16.png | Bin 0 -> 1677 bytes .../src/wwwroot/swagger/favicon-32x32.png | Bin 0 -> 1677 bytes 6 files changed, 192 insertions(+), 26 deletions(-) create mode 100644 samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs create mode 100644 samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-16x16.png create mode 100644 samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-32x32.png diff --git a/.vscode/settings.json b/.vscode/settings.json index 9caeec4..f33fb08 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "restructuredtext.linter.doc8.extraArgs": [ "--config", "${workspaceFolder}/doc/doc8.ini" - ] + ], + "dotnet.formatting.organizeImportsOnFormat": true, } \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs b/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs new file mode 100644 index 0000000..2c70f86 --- /dev/null +++ b/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs @@ -0,0 +1,80 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Primitives; +using Serilog.Context; +using Serilog.Events; +using Serilog.Expressions; + +/// +/// Middleware to log the x-cff-request-id header for each incoming HTTP request. +/// +public class LoggingMiddleware +{ + readonly RequestDelegate _next; + + /// + /// Constructor for LoggingMiddleware + /// + /// + public LoggingMiddleware(RequestDelegate next) + { + _next = next; + } + + /// + /// Invoke method to process the HTTP request + /// + /// + /// + public async Task Invoke(HttpContext context) + { + context.Request.Headers.TryGetValue("X-CFF-Request-Id", out StringValues requestId); + + context.Request.Headers.TryGetValue("X-CFF-Memory", out StringValues memory); + context.Request.Headers.TryGetValue("X-CFF-Timeout", out StringValues timeout); + context.Request.Headers.TryGetValue("X-CFF-Func-Version", out StringValues funcVersion); + context.Request.Headers.TryGetValue("X-CFF-Func-Name", out StringValues funcName); + context.Request.Headers.TryGetValue("X-CFF-Project-Id", out StringValues projectId); + context.Request.Headers.TryGetValue("X-CFF-Package", out StringValues package); + context.Request.Headers.TryGetValue("X-CFF-Region", out StringValues region); + + using (LogContext.PushProperty("XCFFRequestId", requestId.FirstOrDefault(), true)) + using (LogContext.PushProperty("XCFFMemory", memory.FirstOrDefault())) + using (LogContext.PushProperty("XCFFTimeout", timeout.FirstOrDefault())) + using (LogContext.PushProperty("XCFFFuncVersion", funcVersion.FirstOrDefault())) + using (LogContext.PushProperty("XCFFFuncName", funcName.FirstOrDefault())) + using (LogContext.PushProperty("XCFFProjectId", projectId.FirstOrDefault())) + using (LogContext.PushProperty("XCFFPackage", package.FirstOrDefault())) + using (LogContext.PushProperty("XCFFRegion", region.FirstOrDefault())) + { + await _next.Invoke(context); + } + } + +} + +/// +/// Static class containing DateTime conversion functions for Serilog.Expressions +/// +static class DateTimeFunctions +{ + /// + /// Converts a DateTime or DateTimeOffset LogEventPropertyValue to UTC. + /// + /// + /// + public static LogEventPropertyValue? ToUtc(LogEventPropertyValue? value) + { + if (value is ScalarValue scalar) + { + if (scalar.Value is DateTimeOffset dto) + return new ScalarValue(dto.UtcDateTime); + + if (scalar.Value is DateTime dt) + return new ScalarValue(dt.ToUniversalTime()); + } + + return null; + } +} \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/src/Program.cs b/samples-doc/http_minimalWebAPI/src/Program.cs index 1eb4639..dac03f7 100644 --- a/samples-doc/http_minimalWebAPI/src/Program.cs +++ b/samples-doc/http_minimalWebAPI/src/Program.cs @@ -1,40 +1,109 @@ namespace http_minimalWebAPI; +using System.Linq.Expressions; +using System.Reflection; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using Serilog; +using Serilog.Context; +using Serilog.Core; +using Serilog.Expressions; +using Serilog.Extensions.Hosting; +using Serilog.Formatting.Compact; +using Serilog.Formatting.Json; +using Serilog.Templates; + public class Program { + + public static void Main(string[] args) { - var builder = WebApplication.CreateBuilder(); - var app = builder.Build(); + // Create the WebApplication builder + var builder = WebApplication.CreateBuilder(); - // Enable serving static files (including favicon.ico from wwwroot) - app.UseStaticFiles(); + // timezone conversion functions for Serilog.Expressions + var dateTimeFunctions = new StaticMemberNameResolver(typeof(DateTimeFunctions)); - // Minimal API endpoint definitions - app.MapGet("/", () => "Hello World!"); + // Configure Serilog + builder.Host.UseSerilog((context, loggerConfig) => + loggerConfig + .WriteTo.Async(a => a.Console( + new ExpressionTemplate( + "{ { ts: ToUtc(@t), requestId: XCFFRequestId, lvl: @l, msg: @m, threadId: ThreadId } }\n", + nameResolver: dateTimeFunctions + ) + ), bufferSize: 50) + .Enrich.FromLogContext() + .Enrich.WithThreadId() + ); - // Route parameter example: /greeting/John - app.MapGet("/greeting/{name}", (string name) => - { - return $"Hello, {name}!"; - }); + // add swagger + builder.Services.AddControllers(); - // Query parameter example: /hello?name=John - app.MapGet("/hello", (string? name) => + builder.Services.AddEndpointsApiExplorer(); + builder.Services.AddSwaggerGen(options => { - return $"Hello, {name ?? "Guest"}!"; + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Minimal Web API", Version = "v1" }); + }); - app.MapGet("/test", async context => - { - string? requestId = context.Request.Headers["x-cff-request-id"]; + var app = builder.Build(); - await context.Response.WriteAsync($"Request ID is: {requestId}"); - }); + // Use the custom logging middleware + app.UseMiddleware(); + + // Enable serving static files (including favicon.ico from wwwroot) + app.UseStaticFiles(); + + // Enable Swagger middleware + app.UseSwagger(); + app.UseSwaggerUI(); + + // Map API endpoints + APIEndpoints.Map(app); // Start the application app.Run(); } + + public static class APIEndpoints + { + public static void Map(WebApplication app) + { + // Minimal API endpoint definitions + app.MapGet("/", () => "Hello World!"); + + + // Route parameter example: /greeting/John + app.MapGet("/greeting/{name}", (string name) => + { + Log.Information("Greeting {Name}", name); + return $"Hello, {name}!"; + }); + + + // Query parameter example: /hello?name=John + app.MapGet("/hello", (string? name) => + { + return $"Hello, {name ?? "Guest"}!"; + }); + + app.MapGet("/test", async context => + { + string? requestId = context.Request.Headers["x-cff-request-id"]; + + await context.Response.WriteAsync($"Request ID is: {requestId}"); + }); + } + } } \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj b/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj index 7c39665..1107646 100644 --- a/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj +++ b/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj @@ -14,7 +14,7 @@ - + true \ @@ -25,7 +25,7 @@ Always Always - + @@ -33,7 +33,7 @@ - @@ -73,4 +71,22 @@ $RUNTIME_CODE_ROOT/$(MSBuildProjectName) + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-16x16.png b/samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..2f3e37f695aca9404d930bbdfaf4cffce7592df8 GIT binary patch literal 1677 zcmV;826Fj{P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T8zJJZs?-??*V?wO%&Fed6remUoU>;HVcGacc7v6OFa zLwWscD4P!d;Su&f@wcTYfW?S|5L88V}(3rcGblml0x zv~)vm2-?Foij|wRSVmh9yssXH5>Y#d|HVVP0C`>&l$E5ICu2X9qrW1wMu`W6@469Q z65_jUQSEH`t{C8J?}2>NqQ>w`exEL}qT!+X@(Z8q0=%;;Ak&RQ_}D(b8s3vP)gr8U z;JyQ{R}R6Kz8~_OO87c|SAA^xKBJp1Ci}wuaK3#E!%m;(0lZsIL0+oWU0N5$yXk-~ zz>~6<3e-m6p(e_i+iDSoZYE{c!<$h9?-KH-R=|7umg-~6O9FfgYv5zKlsEL+VGR2M zs&M!A&R`A+4DK46+I0a^QYqY2+)ZN-Lg&ZIp`5#m2O|$4z0(1AdUZHPBEgM;w54fLju1mG$7HX=97#uiRMd@ue$K)Ggs zOn(L^iHY#fETQ*97vO5`f@f|;WXy6Jd3P^7W#5yaNT146&AI?Ft^m$?6 zK^UBr6D*Lt2M!JUlsve)??dTxK)G*M@m}qRZDtV$r{uzYTo)iV{S1*crW<=N-J@77 z$Lxe7>on{sRFl=$a3q(&zNS_eU=y-orvf}SAqRe|q_qgH5xW=G#6k>C-VN#aFPfDE zG+u=wS+FM+g>eu}0J{OdMyzgF6Y?+^lLM(k z7ckWD6YTK?5H~hrxL?$)!R0JFOAYnfK?>n`oD*Obc408FfFmDPnu-!}n^6qYL@e>S z7$hGrK&<}}wzxdlpKic#U!(xB^ehIG_}T@qCD6X2N*6F7>?C7;7%K%Z0aE8J_^%k@ z?>4B&XYODiE|+{+a2>s_wE!Fq7gPa*ne-wWkTxo`;zlh5Y7eyH%o}c`QrIbpb{az>MPsM`NUkxjJrW z?MXo0dG)5u_oyNUmT&?L!Zw(u=1d4n3hf5rV|eKE9$L;Xdti#mekf-m1{QMy`h=}8 zPWf~~Op~&x@eX1e`sWuSASqgV`qeYwLVsK~O=i0~9b@d+HF(U6%6I`=V2I5gpO~HK zTU!NN_9-~pFG4nm>W_`kVrRKmgstWrEIUrZkeEw(BzUY^8pegCx`191&_6kAe1uP6 zdXs+TNHT_PZVa1U^o=J)Fl-{5%>%zvM(^B0YLbP%NxLHIu;&nlj1peJhv;X)<1v|_ z(cTk2BDPM*U3Qrm)-b9@6vlK;KpzP(G9!m!taD88{HTQTc|vy60#3l6bhAG8caEZ; zFwkc{`utB}@04jJ_bIS`a1@5=?B$@*#nOn__!#W`cj0rR>u6^~N*-+aow|VkZVAF) XKLgGK=9auw00000NkvXXu0mjfb%zYI literal 0 HcmV?d00001 diff --git a/samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-32x32.png b/samples-doc/http_minimalWebAPI/src/wwwroot/swagger/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..2f3e37f695aca9404d930bbdfaf4cffce7592df8 GIT binary patch literal 1677 zcmV;826Fj{P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T8zJJZs?-??*V?wO%&Fed6remUoU>;HVcGacc7v6OFa zLwWscD4P!d;Su&f@wcTYfW?S|5L88V}(3rcGblml0x zv~)vm2-?Foij|wRSVmh9yssXH5>Y#d|HVVP0C`>&l$E5ICu2X9qrW1wMu`W6@469Q z65_jUQSEH`t{C8J?}2>NqQ>w`exEL}qT!+X@(Z8q0=%;;Ak&RQ_}D(b8s3vP)gr8U z;JyQ{R}R6Kz8~_OO87c|SAA^xKBJp1Ci}wuaK3#E!%m;(0lZsIL0+oWU0N5$yXk-~ zz>~6<3e-m6p(e_i+iDSoZYE{c!<$h9?-KH-R=|7umg-~6O9FfgYv5zKlsEL+VGR2M zs&M!A&R`A+4DK46+I0a^QYqY2+)ZN-Lg&ZIp`5#m2O|$4z0(1AdUZHPBEgM;w54fLju1mG$7HX=97#uiRMd@ue$K)Ggs zOn(L^iHY#fETQ*97vO5`f@f|;WXy6Jd3P^7W#5yaNT146&AI?Ft^m$?6 zK^UBr6D*Lt2M!JUlsve)??dTxK)G*M@m}qRZDtV$r{uzYTo)iV{S1*crW<=N-J@77 z$Lxe7>on{sRFl=$a3q(&zNS_eU=y-orvf}SAqRe|q_qgH5xW=G#6k>C-VN#aFPfDE zG+u=wS+FM+g>eu}0J{OdMyzgF6Y?+^lLM(k z7ckWD6YTK?5H~hrxL?$)!R0JFOAYnfK?>n`oD*Obc408FfFmDPnu-!}n^6qYL@e>S z7$hGrK&<}}wzxdlpKic#U!(xB^ehIG_}T@qCD6X2N*6F7>?C7;7%K%Z0aE8J_^%k@ z?>4B&XYODiE|+{+a2>s_wE!Fq7gPa*ne-wWkTxo`;zlh5Y7eyH%o}c`QrIbpb{az>MPsM`NUkxjJrW z?MXo0dG)5u_oyNUmT&?L!Zw(u=1d4n3hf5rV|eKE9$L;Xdti#mekf-m1{QMy`h=}8 zPWf~~Op~&x@eX1e`sWuSASqgV`qeYwLVsK~O=i0~9b@d+HF(U6%6I`=V2I5gpO~HK zTU!NN_9-~pFG4nm>W_`kVrRKmgstWrEIUrZkeEw(BzUY^8pegCx`191&_6kAe1uP6 zdXs+TNHT_PZVa1U^o=J)Fl-{5%>%zvM(^B0YLbP%NxLHIu;&nlj1peJhv;X)<1v|_ z(cTk2BDPM*U3Qrm)-b9@6vlK;KpzP(G9!m!taD88{HTQTc|vy60#3l6bhAG8caEZ; zFwkc{`utB}@04jJ_bIS`a1@5=?B$@*#nOn__!#W`cj0rR>u6^~N*-+aow|VkZVAF) XKLgGK=9auw00000NkvXXu0mjfb%zYI literal 0 HcmV?d00001 From ae2ccf62edecab960cb6e12acc2bde30a9f069d4 Mon Sep 17 00:00:00 2001 From: Harald Sack Date: Fri, 19 Dec 2025 11:47:51 +0100 Subject: [PATCH 6/6] http_minimalWebAPI: swagger & controller added --- .../src/Controllers/SampleController.cs | 27 +++++++++++++++++ .../src/LoggingMiddleware.cs | 2 ++ samples-doc/http_minimalWebAPI/src/Program.cs | 30 ++++++++++++++----- .../src/http_minimalWebAPI.csproj | 17 ++++++++--- .../http_minimalWebAPI/terraform/function.tf | 9 ++++-- .../http_minimalWebAPI/terraform/output.tf | 8 +++++ .../http_minimalWebAPI/terraform/variables.tf | 5 ++++ 7 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 samples-doc/http_minimalWebAPI/src/Controllers/SampleController.cs diff --git a/samples-doc/http_minimalWebAPI/src/Controllers/SampleController.cs b/samples-doc/http_minimalWebAPI/src/Controllers/SampleController.cs new file mode 100644 index 0000000..4013a84 --- /dev/null +++ b/samples-doc/http_minimalWebAPI/src/Controllers/SampleController.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace http_minimalWebAPI.Controllers; + +[ApiController] +[Route("[controller]")] +public class SampleController : ControllerBase +{ + private readonly ILogger _logger; + public SampleController(ILogger logger) + { + _logger = logger; + } + + /// + /// GET method for SampleController + /// + /// + [HttpGet(Name = "GetSample")] + public IActionResult Get() + { + _logger.LogInformation("SampleController Get method called."); + return Ok(new { Message = "Hello from SampleController!" }); + } +} + diff --git a/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs b/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs index 2c70f86..63b44f3 100644 --- a/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs +++ b/samples-doc/http_minimalWebAPI/src/LoggingMiddleware.cs @@ -5,6 +5,8 @@ using Serilog.Context; using Serilog.Events; using Serilog.Expressions; +using System.Linq; +using System; /// /// Middleware to log the x-cff-request-id header for each incoming HTTP request. diff --git a/samples-doc/http_minimalWebAPI/src/Program.cs b/samples-doc/http_minimalWebAPI/src/Program.cs index dac03f7..b0f2f4b 100644 --- a/samples-doc/http_minimalWebAPI/src/Program.cs +++ b/samples-doc/http_minimalWebAPI/src/Program.cs @@ -1,5 +1,6 @@ namespace http_minimalWebAPI; +using System; using System.Linq.Expressions; using System.Reflection; using Microsoft.AspNetCore.Builder; @@ -23,7 +24,6 @@ namespace http_minimalWebAPI; public class Program { - public static void Main(string[] args) { @@ -33,7 +33,7 @@ public static void Main(string[] args) // timezone conversion functions for Serilog.Expressions var dateTimeFunctions = new StaticMemberNameResolver(typeof(DateTimeFunctions)); - // Configure Serilog + // Configure Serilog to log requestId and timestamp in UTC builder.Host.UseSerilog((context, loggerConfig) => loggerConfig .WriteTo.Async(a => a.Console( @@ -46,15 +46,21 @@ public static void Main(string[] args) .Enrich.WithThreadId() ); - - // add swagger + // Add controller services builder.Services.AddControllers(); + // Add Swagger services builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "Minimal Web API", Version = "v1" }); + var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath= Path.Combine(AppContext.BaseDirectory, xmlFilename); + // Console.WriteLine($"########################################### Including XML comments from: {xmlPath}"); + + options.IncludeXmlComments(xmlPath); + }); var app = builder.Build(); @@ -66,12 +72,19 @@ public static void Main(string[] args) app.UseStaticFiles(); // Enable Swagger middleware - app.UseSwagger(); - app.UseSwaggerUI(); + string useSwaggerUI = (Environment.GetEnvironmentVariable("USE_SWAGGER_UI") ?? "false").ToLower(); + if (useSwaggerUI.Equals("true")) + { + app.UseSwagger(); + app.UseSwaggerUI(); + } - // Map API endpoints + // Map API endpoints (e.g in case of not using controllers) APIEndpoints.Map(app); + // Map controller routes + app.MapControllers(); + // Start the application app.Run(); } @@ -106,4 +119,5 @@ public static void Map(WebApplication app) }); } } -} \ No newline at end of file + +} diff --git a/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj b/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj index 1107646..f2d0fed 100644 --- a/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj +++ b/samples-doc/http_minimalWebAPI/src/http_minimalWebAPI.csproj @@ -1,6 +1,7 @@ + Exe net8.0 enable enable @@ -33,9 +34,11 @@ @@ -58,9 +61,10 @@ $RUNTIME_CODE_ROOT/$(MSBuildProjectName) - true + true - true + + true true true @@ -82,10 +86,15 @@ $RUNTIME_CODE_ROOT/$(MSBuildProjectName) - + + true + $(NoWarn);1591 + + + diff --git a/samples-doc/http_minimalWebAPI/terraform/function.tf b/samples-doc/http_minimalWebAPI/terraform/function.tf index 5563a95..496343e 100644 --- a/samples-doc/http_minimalWebAPI/terraform/function.tf +++ b/samples-doc/http_minimalWebAPI/terraform/function.tf @@ -5,16 +5,21 @@ resource "opentelekomcloud_fgs_function_v2" "MyFunction" { depends_on = [opentelekomcloud_obs_bucket_object.code_object] name = format("%s_%s", var.prefix, var.function_name) app = "default" - + handler = var.function_handler_name description = "Minimal WebAPI deployed with terraform." - memory_size = 128 + memory_size = 256 timeout = 30 max_instance_num = 10 runtime = var.function_runtime + user_data = jsonencode({ + "USE_SWAGGER_UI" = var.use_swagger_ui + }) + + # -------------------------------------------------------------- # # Use code uploaded to OBS as ZIP file # see code in code_from_obs_bucket.tf diff --git a/samples-doc/http_minimalWebAPI/terraform/output.tf b/samples-doc/http_minimalWebAPI/terraform/output.tf index dcf990e..f1b2e4c 100644 --- a/samples-doc/http_minimalWebAPI/terraform/output.tf +++ b/samples-doc/http_minimalWebAPI/terraform/output.tf @@ -4,4 +4,12 @@ output "API_GATEWAY_TRIGGER_URL" { opentelekomcloud_apigw_group_v2.group1.id , opentelekomcloud_apigw_group_v2.group1.region) +} + +output "SWAGGER_UI_URL" { + description = "The URL for Swagger UI to test the API endpoints" + value = var.use_swagger_ui == "true" ? format("https://%s.apic.%s.otc.t-systems.com/swagger/index.html", + opentelekomcloud_apigw_group_v2.group1.id , + opentelekomcloud_apigw_group_v2.group1.region) : "Swagger UI is disabled" + } \ No newline at end of file diff --git a/samples-doc/http_minimalWebAPI/terraform/variables.tf b/samples-doc/http_minimalWebAPI/terraform/variables.tf index 1e30714..082b09e 100644 --- a/samples-doc/http_minimalWebAPI/terraform/variables.tf +++ b/samples-doc/http_minimalWebAPI/terraform/variables.tf @@ -37,4 +37,9 @@ variable "tag_app_group" { variable "API_GATEWAY_INSTANCE_ID" { type = string # default = "your_api_gateway_instance_id" +} + +variable "use_swagger_ui" { + type = string + default = "true" } \ No newline at end of file