You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/12/15 13:24:51 UTC
[incubator-openwhisk-website] branch master updated: Updated
documentation for .NET Core 2.2 runtime, Swift typo fix. (#356)
This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-website.git
The following commit(s) were added to refs/heads/master by this push:
new c1b0d40 Updated documentation for .NET Core 2.2 runtime, Swift typo fix. (#356)
c1b0d40 is described below
commit c1b0d403001717024f1eaaa51d1adf7a148f92b1
Author: Shawn Black <sh...@users.noreply.github.com>
AuthorDate: Sat Dec 15 07:24:47 2018 -0600
Updated documentation for .NET Core 2.2 runtime, Swift typo fix. (#356)
Addresses final item in https://github.com/apache/incubator-openwhisk/issues/4177
---
_includes/code/Hello.cs | 20 ++++++++
_layouts/documentation.html | 117 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 136 insertions(+), 1 deletion(-)
diff --git a/_includes/code/Hello.cs b/_includes/code/Hello.cs
new file mode 100644
index 0000000..6718fb7
--- /dev/null
+++ b/_includes/code/Hello.cs
@@ -0,0 +1,20 @@
+using System;
+using Newtonsoft.Json.Linq;
+
+namespace Apache.OpenWhisk.Example.Dotnet
+{
+ public class Hello
+ {
+ public JObject Main(JObject args)
+ {
+ string name = "stranger";
+ if (args.ContainsKey("name")) {
+ name = args["name"].ToString();
+ }
+ JObject message = new JObject();
+ message.Add("greeting", new JValue($"Hello, {name}!"));
+ return (message);
+ }
+ }
+}
+
diff --git a/_layouts/documentation.html b/_layouts/documentation.html
index 842f325..c4bd63a 100644
--- a/_layouts/documentation.html
+++ b/_layouts/documentation.html
@@ -78,6 +78,12 @@ layout: default
<li><a href="#swift-runtime">Swift Runtime</a></li>
<li><a href="#swift-additional-resources">Additional Resources</a></li>
</ul>
+ <li id="index-dotnet" class="index-menu-toggle"><a href="#dotnet">using .NET Core</a></li>
+ <ul class="index-menuitems">
+ <li><a href="#actions-dotnet">Creating and Invoking Action</a></li>
+ <li><a href="#dotnet-runtime">.NET Core Runtime</a></li>
+ <li><a href="#dotnet-additional-resources">Additional Resources</a></li>
+ </ul>
<!--li id="index-docker" ><a href="#docker">Docker</a></li>
<ul>
<li>Zip Action</li>
@@ -1504,7 +1510,7 @@ $ jar cvf hello.jar Hello.class
<p>
If you wish to learn more about Swift runtime along with
the libraries that are supported or "built-in" by
- default, please visit the project REAMDE
+ default, please visit the project README
<a href="https://github.com/apache/incubator-openwhisk-runtime-swift#apache-openwhisk-runtimes-for-swift">Apache OpenWhisk runtimes for Swift</a>.
</p>
<a class="indexable" id="swift-additional-resources"></a>
@@ -1522,6 +1528,115 @@ $ jar cvf hello.jar Hello.class
</div>
<!-- ************************************** -->
+ <!-- Actions - .NET Core -->
+ <!-- ************************************** -->
+ <a class="indexable" id="dotnet"></a>
+ <h6 id="section-dotnet" class="section-toggle">using .NET Core</h6>
+ <div class="section-toggleable section-toggle-start-closed">
+ <p></p>
+ <a class="indexable" id="actions-dotnet"></a>
+ <h5>Creating And Invoking .NET Core Actions</h5>
+ <p>
+ Let's look at how to write a sample hello world action in .NET Core.
+ You can visit
+ <a href="https://github.com/apache/incubator-openwhisk-runtime-dotnet#quick-net-core-action">Quick .NET Core Action</a>
+ page for further details.
+ </p>
+ <p>
+ <strong>Note:</strong> We will be using <i>wsk</i> CLI in this
+ section. If you don't have it installed and configured,
+ please refer to the section
+ <a href="#wsk-cli">OpenWhisk CLI (wsk)</a>.
+ </p>
+ <ol>
+ <li style="list-style-type: decimal">
+ <a class="indexable" id="hello-dotnet"></a>
+ Create a C# project called <i>Apache.OpenWhisk.Example.Dotnet</i>:
+ <div class="terminal">
+{% highlight bash %}
+$ dotnet new classlib -n Apache.OpenWhisk.Example.Dotnet -lang C#
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ <a class="indexable" id="hello-dotnet"></a>
+ Navigate to the <i>Apache.OpenWhisk.Example.Dotnet</i> directory:
+ <div class="terminal">
+{% highlight bash %}
+$ cd Apache.OpenWhisk.Example.Dotnet
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Install the <i>Newtonsoft.Json</i> NuGet package as follows:
+ <div class="terminal">
+{% highlight bash %}
+$ dotnet add package Newtonsoft.Json -v 12.0.1
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Create a file called <i>Hello.cs</i> with the following content:
+ <div class="terminal">
+{% highlight java linenos %}
+{% include code/Hello.cs %}
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Publish the project as follows:
+ <div class="terminal">
+{% highlight bash %}
+$ dotnet publish -c Release -o out
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Publish the project as follows:
+ <div class="terminal">
+{% highlight bash %}
+$ cd out
+$ zip -r -0 helloDotNet.zip *
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Create an action <i>helloDotNet</i>:
+ <div class="terminal">
+{% highlight bash %}
+$ wsk action create helloDotNet helloDotNet.zip --main Apache.OpenWhisk.Example.Dotnet::Apache.OpenWhisk.Example.Dotnet.Hello::Main --kind dotnet:2.2
+{% endhighlight %}
+ </div>
+ </li>
+ <li style="list-style-type: decimal">
+ Invoke an action <i>helloDotNet</i>:
+ <div class="terminal">
+{% highlight bash %}
+$ wsk action invoke helloDotNet -r -p name Shawn
+{% endhighlight %}
+ </div>
+ <div class="terminal">
+{% highlight yaml %}
+{
+"msg": "Hello Shawn!"
+}
+{% endhighlight %}
+ </div>
+ </li>
+ </ol>
+ <a class="indexable" id="dotnet-runtime"></a>
+ <h5>OpenWhisk Runtime for .NET Core</h5>
+ <p>
+ If you wish to learn more about .NET Core runtime along with
+ the libraries that are supported or "built-in" by
+ default, please visit the project README
+ <a href="https://github.com/apache/incubator-openwhisk-runtime-dotnet#apache-openwhisk-runtimes-for-net-core">Apache OpenWhisk runtimes for .NET Core</a>.
+ </p>
+ <a class="indexable" id="dotnet-additional-resources"></a>
+ <h5>Additional Resources</h5>
+ </div>
+
+ <!-- ************************************** -->
<!-- TODO: Actions - Docker -->
<!-- ************************************** -->
<!-- <h4 id="section-docker">using Docker</h4>