doc-exports/docs/fg/umn/functiongraph_01_0401.html
Chen, Junjie dac566cf2f FG UMN 20230725 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Chen, Junjie <chenjunjie@huawei.com>
Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
2024-04-03 10:30:56 +00:00

23 lines
5.2 KiB
HTML

<a name="functiongraph_01_0401"></a><a name="functiongraph_01_0401"></a>
<h1 class="topictitle1">Creating a Function Using a Template</h1>
<div id="body32001227"><div class="section" id="functiongraph_01_0401__en-us_topic_0000001252067216_section8115125921317"><h4 class="sectiontitle">Overview</h4><p id="functiongraph_01_0401__en-us_topic_0000001252067216_p8060118">FunctionGraph provides templates to automatically complete code, and running environment configurations when you create a function, helping you quickly build applications.</p>
</div>
<div class="section" id="functiongraph_01_0401__en-us_topic_0000001252067216_section666982715557"><h4 class="sectiontitle">Creating a Function</h4><ol id="functiongraph_01_0401__en-us_topic_0000001252067216_ol113209108578"><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li86195366337">Log in to the FunctionGraph console. In the navigation pane, choose <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b2246028276">Templates</strong>.</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li173121210135713">On the page that is displayed, select the <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b5596555114315">FunctionGraph</strong> service, select the <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b71901616134511">context-class-introduction</strong> template for Python 2.7, and click <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b16325342469">Configure</strong>.<div class="note" id="functiongraph_01_0401__en-us_topic_0000001252067216_note2057716572917"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_0401__en-us_topic_0000001252067216_p85782577918">The <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b75027362506">context-class-introduction</strong> template for Python 2.7 is used as an example. You can also select other templates.</p>
</div></div>
</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li1942925112389">After you select a function template, the built-in code and configurations of the template are automatically loaded. The <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b66931157154615">Create Function</strong> page is displayed.</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li138681714133910">Set <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b144848416471">Function Name</strong> to <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b2016316713476">context</strong>, select a created agency, retain default values for other parameters, and click <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b1785952304712">Create Function</strong>.<div class="note" id="functiongraph_01_0401__en-us_topic_0000001252067216_note20468134822616"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="functiongraph_01_0401__en-us_topic_0000001252067216_p151841224162714">If no agency is configured, the following message will be displayed when the function is triggered:</p>
<pre class="screen" id="functiongraph_01_0401__en-us_topic_0000001252067216_screen2182424112711">Failed to access other services because no temporary AK, SK, or token has been obtained. Please set an agency.</pre>
</div></div>
</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li1072110321171">Set the parameters based for your service requirements.</li></ol>
</div>
<div class="section" id="functiongraph_01_0401__en-us_topic_0000001252067216_section13419321181418"><h4 class="sectiontitle">Triggering a Function</h4><ol id="functiongraph_01_0401__en-us_topic_0000001252067216_ol7649170173619"><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li1064920173612">On the <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b159481950613">Code</strong> tab page of the <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b129541052615">context</strong> function, click <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b17954053618">Test</strong> in the upper right corner.</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li112631323436">In the <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b9343842668">Configure Test Event</strong> dialog box, select <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b155398461568">Blank Template</strong> and click <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b1992717511362">Create</strong>.</li><li id="functiongraph_01_0401__en-us_topic_0000001252067216_li13861295387">Click <strong id="functiongraph_01_0401__en-us_topic_0000001252067216_b870919016710">Test</strong>. After the test is complete, view the test result.<div class="fignone" id="functiongraph_01_0401__en-us_topic_0000001252067216_fig72764172511"><span class="figcap"><b>Figure 1 </b>Successful execution result</span><br><span><img id="functiongraph_01_0401__en-us_topic_0000001252067216_image1227721142518" src="en-us_image_0000001269221818.png"></span></div>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="functiongraph_01_0150_0.html">Building Functions</a></div>
</div>
</div>