UNPKG

@kui-shell/plugin-tutorials

Version:

IBM Cloud shell plugin for tutorials

100 lines (99 loc) 4.77 kB
{ "time": "5 minutes", "skills": ["Learning the Ropes", "Composer Programming"], "steps": [ { "heading": "Introduction", "content": "This tutorial introduces you to the basics of writing, deploying, and invoking Compositions", "transition": "next", "renderingHints": "fifty-fifty", "extras": { "learnMore": { "title": "Duration", "doc": "It should take you about **5 minutes** to walk through this interactive tutorial." }, "nextSteps": [ { "command": "play @tutorials/combinators", "doc": "If you are ready to skip directly to the **reference material**, this tutorial teaches you about the features of the Composer library." } ] } }, { "heading": "Hello World", "content": "Programs for the Composition Service are crafted by **writing code**. We provide you with a library of useful operations that will let you chain together REST APIs and Cloud Functions in interesting ways. To get a sense of the kinds of programs you will be writing, click on the `compose hello` link to the right. This will launch a simple editor with a Hello World example.", "transition": "next", "extras": { "learnMore": { "doc": "- You need not use this built-in editor. Feel free to use **your favorite code editor** when coding for the Composition Service." }, "nextSteps": [ { "display": "compose hello", "command": "compose hello --template @demos/hello.js", "doc": "Start drafting a new composition. To get you started, we have specialized this particular command to import a simple Hello World **composition template**." } ] } }, { "heading": "Deploying Compositions", "content": "When you are ready to test out your composition, you may **deploy** it to the cloud. When using the built-in code editor, the **Deploy** button helps you with this task. If you have the composition editor open, you should see it circled in red, now. This button exercises `app update` command.", "transition": "next", "highlight": { "selector": ".sidecar-bottom-stripe-button[data-mode=\"Deploy\"]", "style": {} }, "extras": { "learnMore": { "doc": "- The `app update` command, as with all commands, is accessible directly from **your terminal of choice**, in addition to being accessible from this graphical UI.\n- Deploying a composition should take only a second or two." }, "nextSteps": [ { "display": "app update", "command": "app update hello @demos/hello.js", "doc": "You can always deploy a composition, or redeploy it after having made updates to its source, by using the `app update` command." } ] } }, { "heading": "Invoking Compositions", "content": "Once deployed, a composition is immediately ready to be invoked. You may do so via the `app invoke` command. The result of an invocation is available immediately, and its log output shortly thereafter. In this way, deploying and invoking a composition gives you a quick edit-debug loop.", "transition": "next", "extras": { "learnMore": { "title": "Parameter Passing", "doc": "- To experiment with input values, use the `-p` option. For example, `-p key value` will pass a JSON structure `{\"key\": \"value\"}` to your invocation.\n- Using `-P inputFile.json`, you can pass as input a JSON file stored on disk." }, "nextSteps": [ { "display": "app invoke", "command": "app invoke hello -p name Grendel", "doc": "This command will invoke a composition with the given parameters, and **wait for the response**." }, { "display": "app async", "command": "app async hello -p name Beowulf", "doc": "Sometimes, it is helpful to \"fire and forget\", e.g. for long-running compositions. For these cases, use the `app async` command." } ] } }, { "heading": "Conclusion", "content": "Congraulations, you have completed the Coding Basics tutorial. Next, consider trying one of the other tutorials on the right.", "renderingHints": "fifty-fifty", "extras": { "nextSteps": [ { "command": "play @tutorials/wookie", "doc": "Explore a more complex composition, which uses conditional execution and data forwarding." }, { "command": "getting started", "doc": "Choose your own adventure!" } ] } } ] }