Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/createRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"restructuredtext.linter.doc8.extraArgs": [
"--config",
"${workspaceFolder}/doc/doc8.ini"
]
],
"dotnet.formatting.organizeImportsOnFormat": true,
}
6 changes: 3 additions & 3 deletions buildtools/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
DependsOnTargets="build-project-packages"></Target>

<ItemGroup>
<LibraryName Include="../libraries/src/**/*.csproj" />
<LibraryName Include="../libraries/**/*.csproj" Exclude="../libraries/**/*.test.csproj"/>
</ItemGroup>

<Target Name="init">
Expand All @@ -41,8 +41,8 @@
WorkingDirectory="../libraries" />

<Exec
Command="dotnet pack --no-build -c $(Configuration) -v d -o $(MSBuildThisFileDirectory)../Deployment/nuget-packages"
WorkingDirectory="../libraries/src/%(LibraryName.FileName)" />
Command="dotnet pack --no-build --configuration $(Configuration) --include-source --verbosity detailed --output $(MSBuildThisFileDirectory)../Deployment/nuget-packages"
WorkingDirectory="../libraries/%(LibraryName.FileName)/src" />
</Target>

<Target Name="publish-nuget-local" DependsOnTargets="build-nuget-packages">
Expand Down
2 changes: 1 addition & 1 deletion buildtools/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@


<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
<None Include="..\README.md" Pack="true" PackagePath="" />
<None Include="..\..\..\images\fg.png" Pack="true" PackagePath="" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions doc/doc8.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[doc8]
ignore=D001
37 changes: 23 additions & 14 deletions doc/source/devguide/event_function/_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,62 @@ to help you develop C# event functions.
Core libraries
^^^^^^^^^^^^^^^^

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common </libraries/src/OpenTelekomCloud.Serverless.Function.Common>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common </libraries/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. (**For .NET 6.0 and later versions**)
methods to obtain the runtime information.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.legacy</libraries/src/OpenTelekomCloud.Serverless.Function.Common.legacy>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.JsonSerializer </libraries/OpenTelekomCloud.Serverless.Function.Common.JsonSerializer>`

This library contains a custom IFunctionSerializer implementation
which uses Newtonsoft.Json to serialize/deserialize .NET types
in FunctionGraph.

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**)

Event libraries
^^^^^^^^^^^^^^^^

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.APIG </libraries/src/OpenTelekomCloud.Serverless.Function.Events.APIG>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.APIG </libraries/OpenTelekomCloud.Serverless.Function.Events.APIG>`

Event library for API Gateway events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.CTS </libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.CTS </libraries/OpenTelekomCloud.Serverless.Function.Events.CTS>`

Event library for Cloud Trace Service (CTS) timer events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.DMS4Kafka </libraries/src/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.DMS4Kafka </libraries/OpenTelekomCloud.Serverless.Function.Events.DMS4Kafka>`

Event library for Distributed Messaging Service for Kafka events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.LTS </libraries/src/OpenTelekomCloud.Serverless.Function.Events.LTS>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.LTS </libraries/OpenTelekomCloud.Serverless.Function.Events.LTS>`

Event library for Log Tank Service (LTS) events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OBSS3 </libraries/src/OpenTelekomCloud.Serverless.Function.Events.OBSS3>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OBSS3 </libraries/OpenTelekomCloud.Serverless.Function.Events.OBSS3>`

Event library for Object Storage Service (OBS) S3 events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OOpenSourceKafka </libraries/src/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.OpenSourceKafka </libraries/OpenTelekomCloud.Serverless.Function.Events.OpenSourceKafka>`

Event library for Open Source Kafka events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.SMN </libraries/src/OpenTelekomCloud.Serverless.Function.Events.SMN>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.SMN </libraries/OpenTelekomCloud.Serverless.Function.Events.SMN>`

Event library for Simple Message Notification (SMN) events.

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.Timer </libraries/src/OpenTelekomCloud.Serverless.Function.Events.CTS>`
- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common.Events.Timer </libraries/OpenTelekomCloud.Serverless.Function.Events.CTS>`

Event library for Timer events.

Test libraries
^^^^^^^^^^^^^^^^

- :github_repo_master:`OpenTelekomCloud.Serverless.Function.Common </libraries/OpenTelekomCloud.Serverless.Function.Common.TestUtils>`

This library provides utility methods for unit testing
C# functions developed for FunctionGraph.


Additional libraries
^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions doc/source/devguide/event_function/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ the invocation, function, and execution environment.
Context interface
-----------------

The interface methods of :github_repo_master:`IFunctionContext </libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs>` interface are:
The interface methods of :github_repo_master:`IFunctionContext </libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionContext.cs>` interface are:

.. list-table:: **Table 1** Context interface methods
:widths: 10 25
Expand Down Expand Up @@ -109,7 +109,7 @@ The interface methods of :github_repo_master:`IFunctionContext </libraries/src/O
Logging API
-------------

FunctionGraph provides a :github_repo_master:`IFunctionLogger </libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionLogger.cs>` interface through the context object.
FunctionGraph provides a :github_repo_master:`IFunctionLogger </libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionLogger.cs>` interface through the context object.

The logger can be accessed by using the **Logger** property of the
context object.
Expand Down
31 changes: 15 additions & 16 deletions doc/source/devguide/event_function/handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
----------------

Expand Down Expand Up @@ -120,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 <libraries/src/OpenTelekomCloud.Serverless.Function.Common/IFunctionContext.cs>`
* :github_repo_master:`IFunctionContext <libraries/OpenTelekomCloud.Serverless.Function.Common/src/IFunctionContext.cs>`


Logging in FunctionGraph
Expand All @@ -141,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

Expand Down
4 changes: 2 additions & 2 deletions doc/source/devguide/event_function/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions doc/source/devguide/event_function/sampleProject.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,10 @@ C# project file
</Content>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<ItemGroup>
<PackageReference Include="OpenTelekomCloud.Serverless.Function.Common" Version="*-*" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1' or '$(TargetFramework)'=='netcoreapp2.1'">
<PackageReference Include="OpenTelekomCloud.Serverless.Function.Common.legacy" Version="*-*" />
</ItemGroup>

<!-- Create zip package after build to be uploaded to FunctionGraph -->
<Target Name="ZipOutputPath" Condition="'$(TargetFramework)'!=''" AfterTargets="Build">
<ZipDirectory
Expand Down Expand Up @@ -214,9 +210,6 @@ the ZIP file must contain the following files:
* **AssemblyName**.runtimeconfig.json,
* **AssemblyName**.pdb,
* OpenTelekomCloud.Serverless.Function.Common.dll
(for C# version .NET 6.0 and above) or
* OpenTelekomCloud.Serverless.Function.Common.legacy.dll
(for C# version prior to .NET 6.0).

.. note::
**AssemblyName** is the name defined in the project file, as `<AssemblyName>`,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -292,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Parameter description
- String
- Status of the event

For full description of all parameters see
`CTS Event Reference <https://docs.otc.t-systems.com/cloud-trace-service/umn/trace_references/trace_structure.html#id1>`_.

Example
-------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <samples-doc/event-kafka/resources/kafka_event.json>`
:caption: :github_repo_master:`dms4kafka_event.json <samples-doc/event-dms4kafka/resources/dms4kafka_event.json>`


Parameter description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <samples-doc/event-s3obs/resources/s3obs_event.json>`
:caption: :github_repo_master:`obss3_event.json <samples-doc/event-obss3/resources/obss3_event.json>`


Parameter description
Expand Down
2 changes: 1 addition & 1 deletion doc/source/devguide/http_function/minimalWebApi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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).


Expand Down
2 changes: 1 addition & 1 deletion doc/source/devguide/http_function/transferringKeys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/source/samples/obssamples/_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ OBS (S3) Samples
.. toctree::
:maxdepth: 1

S3 Event Thumbnail <event-s3obs-thumbnail/_index>
S3 Event Thumbnail <event-obss3-thumbnail/_index>
Loading
Loading