Documentation changes for APEX CLI Tosca editor
[policy/parent.git] / docs / apex / APEX-User-Manual.rst
index e4a0d68..02de0b4 100644 (file)
@@ -2812,6 +2812,13 @@ REST Client Input
                   by the server configured via the URL. For instance,
                   the server could support a wait timeout via the URL as
                   ``?timeout=100ms``.
+                  The httpCodeFilter is used for filtering the status
+                  code, and it can be configured as a regular expression
+                  string. The default httpCodeFilter is "[2][0-9][0-9]"
+                  - for successful response codes.
+                  The response with HTTP status code that matches the
+                  given regular expression is forwarded to the task,
+                  otherwise it is logged as a failure.
 
                .. container:: listingblock
 
@@ -2825,16 +2832,19 @@ REST Client Input
                             "org.onap.policy.apex.plugins.event.carrier.restclient.RESTClientCarrierTechnologyParameters",
                           "parameters" : {
                             "url" : "http://example.org:8080/triggers/events", (2)
+                            "httpCodeFilter" : "[2][0-9][0-9]" (3)
                           }
                         }
 
                .. container:: colist arabic
 
-                  +-------+---------------------------------------+
-                  | **1** | set REST client as carrier technology |
-                  +-------+---------------------------------------+
-                  | **2** | the URL of the HTTP server for events |
-                  +-------+---------------------------------------+
+                  +-------+--------------------------------------------------+
+                  | **1** | set REST client as carrier technology            |
+                  +-------+--------------------------------------------------+
+                  | **2** | the URL of the HTTP server for events            |
+                  +-------+--------------------------------------------------+
+                  | **3** | use HTTP CODE FILTER for filtering status code   |
+                  +-------+--------------------------------------------------+
 
 REST Client Output
 ==================
@@ -2849,11 +2859,12 @@ REST Client Output
                   The URL can be configured statically or tagged
                   as ``?example.{site}.org:8080/{trig}/events``,
                   all tags such as ``site`` and ``trig`` in the URL
-                  need to be set  in the properties object available to the tasks.
-                  In addition, the keys should exactly match with the tags defined in url.
-                  The scope of the properties object is per HTTP call.
-                  Hence, key/value pairs set in the properties object by task
-                  is only available for that specific HTTP call.
+                  need to be set in the properties object available to
+                  the tasks. In addition, the keys should exactly match
+                  with the tags defined in url. The scope of the properties
+                  object is per HTTP call. Hence, key/value pairs set
+                  in the properties object by task are only available
+                  for that specific HTTP call.
 
                .. container:: listingblock
 
@@ -3107,11 +3118,19 @@ REST Requestor Input
                   The URL can be configured statically or tagged
                   as ``?example.{site}.org:8080/{trig}/events``,
                   all tags such as ``site`` and ``trig`` in the URL
-                  need to be set  in the properties object available to the tasks.
-                  In addition, the keys should exactly match with the tags defined in url.
-                  The scope of the properties object is per HTTP call.
-                  Hence, key/value pairs set in the properties object by task
-                  is only available for that specific HTTP call.
+                  need to be set in the properties object available to
+                  the tasks. In addition, the keys should exactly match
+                  with the tags defined in url. The scope of the properties
+                  object is per HTTP call. Hence, key/value pairs set
+                  in the properties object by task are only available
+                  for that specific HTTP call.
+                  The httpCodeFilter is used for filtering the status
+                  code, and it can be configured as a regular expression
+                  string. The default httpCodeFilter is "[2][0-9][0-9]"
+                  - for successful response codes.
+                  The response with HTTP status code that matches the
+                  given regular expression is forwarded to the task,
+                  otherwise it is logged as a failure.
 
                .. container:: listingblock
 
@@ -3126,7 +3145,8 @@ REST Requestor Input
                             "url": "http://localhost:54321/some/path/to/rest/resource", (2)
                             "url": "http://localhost:54321/{site}/path/to/rest/{resValue}", (2')
                             "httpMethod": "POST", (3)
-                            "restRequestTimeout": 2000 (4)
+                            "restRequestTimeout": 2000, (4)
+                            "httpCodeFilter" : "[2][0-9][0-9]" (5)
                           }
                         },
 
@@ -3143,6 +3163,8 @@ REST Requestor Input
                   +-------+--------------------------------------------------+
                   | **4** | request timeout in milliseconds                  |
                   +-------+--------------------------------------------------+
+                  | **5** | use HTTP CODE FILTER for filtering status code   |
+                  +-------+--------------------------------------------------+
 
                .. container:: paragraph
 
@@ -3898,6 +3920,103 @@ The APEX CLI Editor
                    -wd,--working-directory <WORKING_DIRECTORY>    the working directory that is the root for the CLI editor and is the
                                                                   root from which to look for included macro files
 
+The APEX CLI Tosca Editor
+-------------------------
+
+         .. container:: paragraph
+
+            As per the new Policy LifeCycle API, the policies are expected to be defined as ToscaServiceTemplate. The CLI Tosca Editor is an extended version of the APEX CLI Editor which can generate the policies in ToscaServiceTemplate way.
+
+         .. container:: paragraph
+
+            The APEX config file(.json), command file(.apex) and the tosca template skeleton(.json) file paths need to be passed as input arguments to the CLI Tosca Editor. Policy in ToscaServiceTemplate format is generated as the output. This can be used as the input to Policy API for creating policies.
+
+         .. container:: paragraph
+
+            On UNIX and Cygwin systems use:
+
+         .. container:: ulist
+
+            -  ``apexCLIToscaEditor.sh`` - starts the CLI Tosca editor,
+               all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
+
+            -  ``apexApps.sh cli-tosca-editor`` - starts the CLI Tosca editor,
+               all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
+
+         .. container:: paragraph
+
+            On Windows systems use:
+
+         .. container:: ulist
+
+            -  ``apexCLIToscaEditor.bat`` - starts the CLI Tosca editor,
+               all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
+
+            -  ``apexApps.bat cli-tosca-editor`` - starts the CLI Tosca
+               editor, all the arguments supported by the basic CLI Editor are supported in addition to the mandatory arguments needed to generate ToscaServiceTemplate.
+
+         .. container:: paragraph
+
+            Summary of alternatives to start the APEX CLI Tosca Editor:
+
+     +-----------------------------------------------------------------+--------------------------------------------------------------------+
+     | Unix, Cygwin                                                    | Windows                                                            |
+     +=================================================================+====================================================================+
+     | .. container::                                                  | .. container::                                                     |
+     |                                                                 |                                                                    |
+     |    .. container:: listingblock                                  |    .. container:: listingblock                                     |
+     |                                                                 |                                                                    |
+     |       .. container:: content                                    |       .. container:: content                                       |
+     |                                                                 |                                                                    |
+     |          .. code::                                              |          .. code::                                                 |
+     |                                                                 |                                                                    |
+     |             # $APEX_HOME/bin/apexCLIToscaEditor.sh.sh [args]    |             > %APEX_HOME%\bin\apexCLIToscaEditor.bat [args]        |
+     |             # $APEX_HOME/bin/apexApps.sh cli-tosca-editor [args]|             > %APEX_HOME%\bin\apexApps.bat cli-tosca-editor [args] |
+     +-----------------------------------------------------------------+--------------------------------------------------------------------+
+
+         .. container:: paragraph
+
+            The option ``-h`` provides a help screen with all command
+            line arguments.
+
+         .. container:: listingblock
+
+            .. container:: content
+
+               .. code::
+
+                  usage: org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain [options...]
+                  options
+                   -a,--model-props-file <MODEL_PROPS_FILE>         name of the apex model properties file to use
+                   -ac,--apex-config-file <APEX_CONFIG_FILE>        name of the file containing apex configuration details
+                   -c,--command-file <COMMAND_FILE>                 name of a file containing editor commands to run into the editor
+                   -h,--help                                        outputs the usage of this command
+                   -i,--input-model-file <INPUT_MODEL_FILE>         name of a file that contains an input model for the editor
+                   -if,--ignore-failures <IGNORE_FAILURES_FLAG>     true or false, ignore failures of commands in command files and
+                                                                    continue executing the command file
+                   -l,--log-file <LOG_FILE>                         name of a file that will contain command logs from the editor, will
+                                                                    log to standard output if not specified or suppressed with "-nl" flag
+                   -m,--metadata-file <CMD_METADATA_FILE>           name of the command metadata file to use
+                   -nl,--no-log                                     if specified, no logging or output of commands to standard output or
+                                                                    log file is carried out
+                   -ot,--output-tosca-file <OUTPUT_TOSCA_FILE>      name of a file that will contain the output ToscaServiceTemplate
+                   -t,--tosca-template-file <TOSCA_TEMPLATE_FILE>   name of the input file containing tosca template which needs to be
+                                                                    updated with policy
+                   -wd,--working-directory <WORKING_DIRECTORY>      the working directory that is the root for the CLI editor and is the
+                                                                    root from which to look for included macro files
+
+         .. container:: paragraph
+
+            An example command to run the APEX CLI Tosca editor on windows machine is given below.
+
+         .. container:: listingblock
+
+            .. container:: content
+
+               .. code::
+
+                  %APEX_HOME%/\bin/\apexCLIToscaEditor.bat -c %APEX_HOME%\examples\PolicyModel.apex -ot %APEX_HOME%\examples\test.json  -l %APEX_HOME%\examples\test.log -ac %APEX_HOME%\examples\RESTServerStandaloneJsonEvent.json -t %APEX_HOME%\examples\ToscaTemplate.json
+
 The APEX REST Editor
 --------------------