Define an API Query for cloud computing devices

As part of creating or modifying a discovery pattern, you can use the Cloud REST Call operation to extract information from configuration items of the PaaS (Platform as a Service) type, such as Microsoft Azure or Amazon Web Services.

Before you begin

  • Verify that the operating system of the configuration item (CI) for which you want to use the Cloud REST Call operation extends the Logical Data Center OS type [cmdb_ci_logical_datacenter]:
    1. Navigate to the Basic tab of the CI pattern.
    2. Note the operating system for this CI.
    3. Navigate to System Definition > Tables.
    4. Set the search field to Label and enter the name of the operating system as stated on the Based tab of the pattern.
    5. Find the operating system in the list and verify that Logical Datacenter appears in the Extends table column.
  • Navigate to the relevant pattern step:

    1. On the pattern form, select the relevant identification section for Discovery.

      Alternatively, select the relevant identification or connection section for Service Mapping.

    2. Select the relevant pattern step or click to add a step.

Basic knowledge of programming is desirable.

Role required: pd_admin

About this task

Deploy the Cloud REST Call operation in patterns used for discovery of PaaS CIs.

Refer to the official API-related documentation provided by manufacturers to obtain the query syntax for the device you want to query using the Cloud REST Call operation. For example:

Procedure

  1. Select Cloud REST Call from the Operation list.
  2. Define query parameters as necessary:
    Attention: If you customized this operation as described in Customize pattern operations, the query parameters may be different.
    Field Description
    URL Specify the URL as described in the official Microsoft Azure or Amazon Web Services documentation. You can use variables.

    You can use variables. You can also enter a value from the specific field in a tabular variable as described in Enter values and variables in patterns.

    Method

    Enter the method value as a string using all capital letters, for example "GET". The supported methods are:

    • GET
    • POST
    • PUT

    Refer to the relevant API guide for information. If the API documentation does specifically mention the HTTP query method, use the GET method.

    Body (Optional) Enter a request body as a string.
    Headers (Optional) If the relevant API documentation states that HTTP headers must be sent, enter these headers in the following format:

    Header_name1:header_value1,header_name2:header_value2

    For example, Content-Type:xml.
  3. To save the command output in its entirety as a variable, select NONE from the Define Parsing list and define the variable as described in 6.
  4. Select the parsing strategy from the Define Parsing list.
    Parsing strategy Description

    Oracle

    LDAP file

    XML file

    INI file

    Properties file

    JSON file (custom)

    Horizontal file parsing strategy (not vertical). You can use this parsing strategy only for text files. For more information, see Parse text from a horizontal file.
    Vertical File Retrieve text from a structured text file where each set of data spans multiple lines. For more information, see Parse text from a vertical file.

    After Keyword

    Retrieve text directly following a specific keyword. For more information, see Parse text using keyword, command, and positional type.

    Command Line Java Style

    Retrieve the value of a command-line parameter using Java-style parameters. For more information, see Parse text using keyword, command, and positional type.

    Command Line Unix Style

    Retrieve the value of a command-line parameter using standard Unix parameters. For more information, see Parse text using keyword, command, and positional type.

    Position From End

    Retrieve text specified by its position from the end of the line. For more information, see Parse text using keyword, command, and positional type.

    Position From Start

    Retrieve text specified by its position from the beginning of the line. For more information, see Parse text using keyword, command, and positional type.

    Regular Expression Retrieve text specified by a regular expression. This option requires familiarity with Regex Java syntax. For more information, see Parse text using a regular expression.
    Delimited Text Retrieve text specified by delimiters and position within the line (the most common way to retrieve text from generic text files). See Parse text using delimited text.
  5. If working in the Debug Mode, define the parsing criteria as follows:
    1. Click Run Operation to see the result in the Output pane.
    2. In the Output pane, mark text or symbols that you want a variable to contain.
    3. In the variable name box, enter the name for the new variable, for example 'process_name'.

      Defining a variable name for the string marked in the Output pane
    4. Press Enter.
      The new variable is added in the Variables pane.
  6. If you are not working in Debug Mode, define the parsing criteria as follows:
    1. In the Variables pane, click Add Variable and enter the name for the new variable.
    2. Click the Advanced icon.

      Displaying the Advanced Variables pane
    3. Click Add Column Label.
    4. Enter the parsing query.
    5. Enter a value for the delimiter.
    6. Enter a value for the position.
  7. Select Terminate to stop discovery if no results are found.
  8. If in Debug mode, test the step by clicking Test and checking that the operation brings the result you expected.

Example

This operation is used in This item
Hierarchy Application
CI Type Load Balancer Service [cmdb_ci_lb_service]
Pattern Amazon AWS Elastic Load Balancer Service
Section AWS Load Balancer Service
Step number and Name 2. Get first 100 RDS instances

Use the Cloud REST Call operation to extract information on Database instances running on the region us-west-2 in the Amazon cloud.


Example of the Cloud REST Call operation

What to do next